-
Notifications
You must be signed in to change notification settings - Fork 461
Added Video Framerate to Fix 'prepare' crash #15
Conversation
I tried this on a Nexus 7 (2013) with 5.0.1 but i still get the exception. Maybe something related to the 5.0.1? |
@monxalo Good! Someone else tried this out. Since every device is different, trying different parameters before calling Instead of:
Try:
Basically, we should probably check to see the devices capabilities for support these codes before setting up the |
Ugh 😦 |
Okay, after testing a few times the setVideoFrameRate(30) works, but only with video size set to: 75% and 50%. |
After debugging some more, i noticed that I think although the Nexus 7 (2013) has a display of 1200 x 1920 the MediaRecorder must only record up to 1080x1920. |
So there's two problems:
Both seem reasonable changes then. |
Agreed, maybe the default framerate would be 30 and like @jaredsburrows said, allow to change framerate from list of common framerates. (24, 25, 30, 50, 60) |
Why would changing the framerate be useful? |
I was thinking about file size but i just reminded that only the bitrate affects file size. |
Also I was only able to record at a max framerate of 30 on this device. A note from the documentation:
|
@monxalo Yes, the framerate should at least be set. Without that, it will not run on my device. When you say you were only able to record a max framerate, were you just trying different values to verify? |
@jaredsburrows yes, i tried various values above 30 and always resulted in a crash. BTW, what message do you get when it crashes on your device? I always get |
That is the same as others have reported. |
@monxalo What I usually see is the same error as I posted in the post:
Is there anyway we could automatically check to see what the user's device is capable of and then let them decide on specifics? Or figure out what works for all devices and have a try/catch, put the specifics in the try and the defaults in the catch. |
I'd rather crash. Otherwise there's no way of knowing which devices are operating in the crappy settings. |
You throw the |
A quick update, after some more tests I was able to record at a framerate higher that 30. Here are the results:
So there seems to be a relation between the video size and the framerate you can record. |
@monxalo This makes sense, lower the resolution -> higher the framerate. It would be nice if |
The After some testing recording with various profiles, the best one for a smooth video playback with no stuttering was |
Continue any discussion in #17 around media recorder failing. |
Added Video Framerate to Fix 'prepare' crash - on HTC DNA running Android 5.0.2
Crash:
java.lang.RuntimeException: Unable to prepare MediaRecorder.
at com.jakewharton.telecine.RecordingSession.startRecording(RecordingSession.java:179)
at com.jakewharton.telecine.RecordingSession.access$100(RecordingSession.java:47)
at com.jakewharton.telecine.RecordingSession$1.onStart(RecordingSession.java:111)
at com.jakewharton.telecine.OverlayView.startRecording(OverlayView.java:147)
at com.jakewharton.telecine.OverlayView.access$300(OverlayView.java:31)
at com.jakewharton.telecine.OverlayView$5$1$1.run(OverlayView.java:163)
at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1121)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1089)
at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:666)
at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:682)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:795)
at android.view.Choreographer.doCallbacks(Choreographer.java:599)
at android.view.Choreographer.doFrame(Choreographer.java:559)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:781)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5466)
at java.lang.reflect.Method.invoke(Method.java:-2)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:938)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:733)
Caused by: java.io.IOException: prepare failed.
at android.media.MediaRecorder._prepare(MediaRecorder.java:-2)
at android.media.MediaRecorder.prepare(MediaRecorder.java:742)
at com.jakewharton.telecine.RecordingSession.startRecording(RecordingSession.java:177)
at com.jakewharton.telecine.RecordingSession.access$100(RecordingSession.java:47)
at com.jakewharton.telecine.RecordingSession$1.onStart(RecordingSession.java:111)
at com.jakewharton.telecine.OverlayView.startRecording(OverlayView.java:147)
at com.jakewharton.telecine.OverlayView.access$300(OverlayView.java:31)
at com.jakewharton.telecine.OverlayView$5$1$1.run(OverlayView.java:163)
at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1121)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1089)
at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:666)
at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:682)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:795)
at android.view.Choreographer.doCallbacks(Choreographer.java:599)
at android.view.Choreographer.doFrame(Choreographer.java:559)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:781)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5466)
at java.lang.reflect.Method.invoke(Method.java:-2)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:938)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:733)