Upload 3gpp file to a web server - android

My question is I have used many examples of http uploads of files for the android. They all seem to work except for video files that are .3gpp. I use the same code for .mov video files and it works OK. On the web side is just a PHP script. Does any know or have successfully uploaded a video (.3gpp) to a server? I don't get any error that I can see. The code I use also works for image files (jpg). It's just the .3gpp file type.
Thanks for any help you can give me..

isnt it 3gp
is it possible u are giving it the wrong extension?
i would say that the method u are using to upload should be pretty dumb to what files its uploading so it should work (as u said). the only other thing is i would try to match file size. so do a 5mb picture then a 5min video to ensure it is the file type causing the error
i would also say that maybe the 3 in the extension could cause problems (depending on how or what is reading it)

Related

Android mediaplayer getDuration() returns 0 for some mp3 files

I have a large collection of mp3 files on my server and i'm using android media player for playing them. The problem is for almost all of them getDuration() method returns 0. I uploaded sample mp3 file and put it somewhere on my server. mediaplayer works perfectly fine with that file!!
I can't understand what's the different. My knowledge about audio files is very limited. Can anyone give me a suggestion what to do?
can I somehow modify mp3 files on my server so mediaplayer can read the metadata?
BTW this problem occurs only on Android. My links on google chrome are fine. and google shows the duration of file right from the beginning of playing when only small percentage of file is downloaded.
We finally fixed this issue by replacing our web server. We replaced tomcat with apache and it fixed the issue. I don't exactly know why

Posting large video file on Facebook from android

Hi am trying to post video file on Facebook from my android application, I am able to post 5MB file successfully but when I am trying to post large file say 95MB java.lang.OutOfMemoryError brokes out. I followed this link to post the video.
Is there any other methods to post the video file on Facebook. Please help me to resolved this issue.
Thank you.
Your video filesize is probably larger than the amount of free memory allocated on your device. Considering that you said you were trying to upload a 95MB file on your smartphone, that is too large to hold in a byte[].
I found solutions online that allows you to upload chunks of data at a time to prevent OOM exceptions, but AFAIK our Facebook Android SDK doesn't have that sort of option available. Your best bet is to either compress/scale the video to a more acceptable size, or write your own method to POST a video to Facebook in chunks.

Android Compress Video before Upload to Server

How can I compress a video file in Android before uploading to a remote server? I'm not looking to zip up the file, because I don't think that will help much. I want to compress the video and re-encode it with a lower bit-rate or resolution. The idea is to get a standard 360х480, 30 FPS video file from every device. This way I can avoid users with better cameras being forced to upload huge video files.
I know iOS makes it fairly simple to force video file resolutions. 10 second video recorded on iPhone 4:
high (1280х720) = ~14MB = ~11Mbit/s
640 (640х480) = ~4MB = ~3.2Mbit/s
medium (360х480) = ~1MB = ~820Kbit/s
low (144х192) = ~208KB = ~170Kbit/s
Is there any easy way to do this in Android? Do I need to find some external library that will let me re-encode the video file, then save it to the SD card (or overwrite the old video file), then upload that file? Mainly looking for general direction here and not code to copy and paste, although anything is helpful.
I got a similar problem. Where I had to upload video in server having size within 5.4mb. But due to different camera resolutions of different phones, there was a problem. These are the solutions which I have opted
mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
mediaRecorder.setVideoEncodingBitRate(690000 );
Hope these will help you
One of the app that I worked on earlier has this requirement of sending the video file after compressing it. Here are the steps I followed which worked:
Compress the file using a Silicompressor library in android. Run the compression task on a background thread.
The output file format will have the mime type "video/raw". You can check that in logcat. So, you need to add this mime type in your server so that the compressed file format is uploaded successfully.
After this is done, trying sending the compressed file and it should work.
Make sure the mime type of the file you are uploading to server is accepted by the server.
Read About this Library, its the best for new mobile which has a Full HD cameras
Compress Video with high quality for Java and Kotlin
We decided to save this functionality for another iteration of the project. We opted to warn the users of the large data payload (especially if they are not on Wi-Fi). I'm confident this can be done, and the link provided by tabbykitten is the best related SO post I've found on this topic to this date.
From API level 18 onwards you have direct android API to do Video Encoding but if you are targeting Less than API level 18 it not straight forward
the below link does the encoding
https://github.com/google/grafika/blob/master/src/com/android/grafika/VideoEncoderCore.java

android secure data storage

i am developing one android application. it download videos from server and store it in mobile.
i want to store those video in secure manner.(deny the user from copying. or deny them from viewing the video directly from sdcard)
i found two ways to solve the problem.
1)Store the video's inside the application.
2)Encrypt the entire video
but facing some problem in implementing solution
i)first solution found suitable. but i am fearing that. if we store too much video inside the application .it would become bulkier.and fore the user to uninstall.
ii)but in second solution. i did not find any correct way to do so.
so please help me to solve the problem.
This is kind of suggestion :
To store the videos you must have created some folder on SDCARD, so you can hide the folder by putting the "." in front of the name while creating it. on top of this you can encrypt the video file using AES algorithm so it can not be viewed, if copied outside the android it will not be view able. but from your application you can decry-pt the file and view it.
Definitively, you must encrypt the media and that's quite simple. What is more difficult is to play the media, because MediaPlayer only accepts clear contents. A basic way would be to convert an encrypted file to a decrypted one, just for the time of the playing session. A better approach is to build a stream from the file, decrypt that stream and feed it to the player. The hard point is to have a local http server to serve the stream.

(Android) Downloading MP3 file with app (Content not support)

When I download MP3 files with my app they go to the download folder and when I navigate there and try to play them I get content not supported. I have looked around a little bit, but can't figure out why. Anyone know how I can fix this, is it something with the MIME types? What does this do:
connection.setRequestProperty("Content-Type", "audio/*");
MP3 • Mono/Stereo 8-320Kbps constant (CBR) or variable bit-rate
(VBR) MP3 (.mp3)
Android Supports MP3 in the above format. Incorrect encoding makes this type of error. Also check to see if the extension and file names are proper. Because some downloaders may name the file like mywebsite.com-mysong.mp3. The android OS may wrongly interpret the file as a .com file rather than a .mp3 file.
Reference:
http://developer.android.com/guide/appendix/media-formats.html#core
Please ensure you save with the .mp3 extension. sometimes it can get lost along the way.

Categories

Resources