MediaMuxer fails to stop if csd-1 not exist

拥有回忆 提交于 2019-11-28 10:59:27

问题


I am using MediaExtractor to extract video and audio tracks from a Video file and then feed them again to a MediaMuxer.

The code works fine if extracted Media format contains both csd-0 and csd-1 and the converted video is working nicely. However, some videos only have csd-0 only and these videos cause the application to crash at MediaMuxer.stop().

Here is the stack trace:

 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  

来源:https://stackoverflow.com/questions/21341169/mediamuxer-fails-to-stop-if-csd-1-not-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!