我正在使用MediaExtractor
从视频文件中提取视频和音轨,然后将它们再次提供给MediaMuxer
.
如果提取的媒体格式同时包含csd-0和csd-1并且转换后的视频运行良好,则代码运行良好。但是,有些视频只有csd-0,这些视频会导致应用程序在MediaMuxer.stop()
.
这是堆栈跟踪:
V/ACodec(5925) [OMX.Exynos.mpeg4.enc] Now Executing->Idle
V/ACodec(5925) [OMX.Exynos.mpeg4.enc] saw error -1011 instead of an input buffer
V/ACodec(5925) [OMX.Exynos.mpeg4.enc] saw error -1011 instead of an input buffer
V/ACodec(5925) [OMX.Exynos.mpeg4.enc] onOMXFillBufferDone 0xb9398f00 time 0 us, flags = 0x00000000
V/ACodec(5925) [OMX.Exynos.mpeg4.enc] onOMXFillBufferDone 0xb9355318 time 0 us, flags = 0x00000000
V/ACodec(5925) [OMX.Exynos.mpeg4.enc] Now Idle->Loaded
V/ACodec(5925) [OMX.Exynos.mpeg4.enc] Now Loaded
V/ACodec(5925) Now uninitialized
D/MPEG4Writer(5925) Stopping Video track
E/MPEG4Writer(5925) Missing codec specific data
I/MPEG4Writer(5925) Received total/0-length (59454/0) buffers and encoded 59454 frames. - audio
I/MPEG4Writer(5925) Received total/0-length (33102/0) buffers and encoded 33102 frames. - video
I/MPEG4Writer(5925) Audio track drift time 0 us
D/MPEG4Writer(5925) Stopping Video track source
D/MPEG4Writer(5925) Video track stopped
D/MPEG4Writer(5925) Stopping Audio track
D/MPEG4Writer(5925) Stopping Audio track source
D/MPEG4Writer(5925) Audio track stopped
D/MPEG4Writer(5925) Duration from tracks range is [1380519183, 1380629229] us
D/MPEG4Writer(5925) Stopping writer thread
D/MPEG4Writer(5925) 0 chunks are written in the last batch
D/MPEG4Writer(5925) Writer thread stopped
W/dalvikvm(5925) threadid=13 thread exiting with uncaught exception (group=0x417b9700)
E/AndroidRuntime(5925) FATAL EXCEPTION AsyncTask #2
E/AndroidRuntime(5925) java.lang.RuntimeException An error occured while executing doInBackground()
E/AndroidRuntime(5925) at android.os.AsyncTask$3.done(AsyncTask.java 299)
E/AndroidRuntime(5925) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java 352)
E/AndroidRuntime(5925) at java.util.concurrent.FutureTask.setException(FutureTask.java 219)
E/AndroidRuntime(5925) at java.util.concurrent.FutureTask.run(FutureTask.java 239)
E/AndroidRuntime(5925) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java 230)
E/AndroidRuntime(5925) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java 1080)
E/AndroidRuntime(5925) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java 573)
E/AndroidRuntime(5925) at java.lang.Thread.run(Thread.java 841)
E/AndroidRuntime(5925) Caused by java.lang.IllegalStateException Failed to stop the muxer
E/AndroidRuntime(5925) at android.media.MediaMuxer.nativeStop(Native Method)
E/AndroidRuntime(5925) at android.media.MediaMuxer.stop(MediaMuxer.java 190)
E/AndroidRuntime(5925) at xxx.xxx.xxx.xxx$AsyncTask1.doInBackground(EditorActivity2.java 1519)
E/AndroidRuntime(5925) at xxx.xxx.xxx.xxx$AsyncTask1.doInBackground(EditorActivity2.java 1)
E/AndroidRuntime(5925) at android.os.AsyncTask$2.call(AsyncTask.java 287)
E/AndroidRuntime(5925) at java.util.concurrent.FutureTask.run(FutureTask.java 234)
E/AndroidRuntime(5925) ... 4 more
V/ACodec(5925) [OMX.Exynos.mpeg4.dec] Now Executing->Idle
V/ACodec(5925) [OMX.Exynos.mpeg4.dec] saw error -1011 instead of an input buffer
V/ACodec(5925) [OMX.Exynos.mpeg4.dec] saw error -1011 instead of an input buffer
V/ACodec(5925) [OMX.Exynos.mpeg4.dec] saw error -1011 instead of an input buffer
V/ACodec(5925) [OMX.Exynos.mpeg4.dec] saw error -1011 instead of an input buffer
V/ACodec(5925) [OMX.Exynos.mpeg4.dec] saw error -1011 instead of an input buffer
V/ACodec(5925) [OMX.Exynos.mpeg4.dec] onOMXFillBufferDone 0xb9160970 time 291950 us, flags = 0x00000000
V/ACodec(5925) [OMX.Exynos.mpeg4.dec] onOMXFillBufferDone 0xb9353db8 time 0 us, flags = 0x00000000
V/ACodec(5925) [OMX.Exynos.mpeg4.dec] Now Idle->Loaded
V/ACodec(5925) [OMX.Exynos.mpeg4.dec] Now Loaded
V/ACodec(5925) Now uninitialized