android - Samsung Galaxy SIII mediaRecorder() issues. (Corrupt Video) -


i have problem samsung galaxy siii. in app creating, use mediarecorder record video of user using front camera. have looked thoroughly in documentation , on forums , have seen few similar posts sii or crashes in general, fixes unfortunately did not work us. process camera records follows --> there function (code provided) checks each devices compatible camera resolutions, check see if meet our specifications (right 480p or less) if there 1 meets criteria uses quality set videosize() (function provided android set recording size of video). seems pretty trivial , looks work device. code work couple different devices we've tested on (e.g. galaxy s4, , galaxy stellar). reason siii being difficult. when record on siii in resolution lower 720p, video becomes corrupt , plays multi colored screen (screen shots in link below). why not record video in 720p+ then? unfortunately need lower video sizes not such heavy data load transfer on cell phone provider network.

so question is, why recording corrupt video in lower resolution 720p, when resolution uses being pulled out list of device supported resolutions?

this function pull supported resolutions device.

public camera.size getsupportedrecordingsizes() {      camera.size result = null;     camera.parameters params = camera.getparameters();     list<size> sizes = params.getsupportedpicturesizes();      (size s : sizes) {         if (s.height < 481 && s.width < 721) {             if (result == null) {                 result = s;             } else {                 int resultvideosize = result.width * result.height;                 int newvideosize = s.width * s.height;                  if (newvideosize > resultvideosize) {                     result = s;                 }             }         }     }     if (!sizes.isempty() && result == null) {          context context = getapplicationcontext();         charsequence text = "used default first value";         int duration = toast.length_short;          toast toast = toast.maketext(context, text, duration);         toast.show();         (size size : sizes) {             if (result == null) {                 result = size;             }             int previoussize = result.width * result.height;             int newsize = size.width * size.height;             if (newsize < previoussize) {                 result = size;             }         }      }     return (result); } 

this code our mediarecorder (shortened simplicity)

mediarecorder = new mediarecorder();      setcameradisplayorientaion();     //sets devices supported video size less or equal 480p (720x480 resolution).     camera.size vidsize = getsupportedrecordingsizes();      camera.unlock();     mediarecorder.setcamera(camera);     mediarecorder.setaudiosource(mediarecorder.audiosource.mic);     mediarecorder.setvideosource(mediarecorder.videosource.camera);     mediarecorder.setoutputformat(videoformat);     mediarecorder.setaudioencoder(audioencoder);     mediarecorder.setvideoencoder(videoencoder);     mediarecorder.setoutputfile(fullquestionpath);     if (vidsize == null) {         mediarecorder.setvideosize(480, 360);     } else {         mediarecorder.setvideosize(vidsize.width, vidsize.height);     }     mediarecorder.setvideoframerate(videoframerate);     mediarecorder.setpreviewdisplay(surfaceholder.getsurface());       //set bitrate manually if possible.     if (android.os.build.version.sdk_int > 7) {         mediarecorder.setvideoencodingbitrate(videobitrate);     } try {         mediarecorder.prepare();         mediarecorder.start(); } catch (exception e) {         log.e(responseactivity.class                 .tostring(), e.getmessage());         releasemediarecorder();     } 

the images correlate problem here http://imgur.com/a/8f7tb (sorry not posting earlier.)

the order of these images follows --> 1) before recording, preview going. 2)recording, preview showing current recording/recording. 3)stop recording, recording has stopped preview. 4) playback, issue is, shows multicolored corrupt image, same if pull device directly.

edit: note, have tried using camcorderprofile , setting quality low or high. setting quality_high forces 720p recording works at, quality_low, despite having quite opposite problem, not work me.

edit: have idea point me in right direction?


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -