Android MediaMuxer无法停止

Android MediaMuxer无法停止,第1张

概述我正在尝试使用MediaCodec,MediaExtractor和MediaMuxer生成mp4文件.EveryThing似乎都可以正常工作,但是当我致电MediaMuxer.stop时,出现了错误.MP4文件已创建,但我无法使用播放器播放.这是我的日志:02-1310:41:22.420:D/OpenGLRenderer(11768):Enablingdebugmode002-13

我正在尝试使用MediaCodec,MediaExtractor和Mediamuxer生成mp4文件. EveryThing似乎都可以正常工作,但是当我致电Mediamuxer.stop时,出现了错误. MP4文件已创建,但我无法使用播放器播放.

这是我的日志:

02-13 10:41:22.420: D/Openglrenderer(11768): Enabling deBUG mode 002-13 10:41:22.600: I/OMXClIEnt(11768): Using clIEnt-sIDe OMX mux.02-13 10:41:22.717: E/ACodec(11768): [OMX.TI.DUCATI1.VIDEO.DECODER] storeMetaDataInBuffers Failed w/ err -214748364802-13 10:41:22.717: I/ACodec(11768): DRC Mode: Port Reconfig Mode02-13 10:41:22.725: I/MPEG4Writer(11768): limits: 2147483647/0 bytes/us, bit rate: -1 bps and the estimated moov size 3072 bytes02-13 10:41:22.803: I/MPEG4Writer(11768): setStartTimestampus: 002-13 10:41:22.803: I/MPEG4Writer(11768): EarlIEst track starting time: 002-13 10:41:22.896: W/AHIErarchicalStateMachine(11768): Warning message AMessage(what = 'omx ', target = 1) = {02-13 10:41:22.896: W/AHIErarchicalStateMachine(11768):   int32_t type = 002-13 10:41:22.896: W/AHIErarchicalStateMachine(11768):   voID *node = 0x4d02-13 10:41:22.896: W/AHIErarchicalStateMachine(11768):   int32_t event = 302-13 10:41:22.896: W/AHIErarchicalStateMachine(11768):   int32_t data1 = 102-13 10:41:22.896: W/AHIErarchicalStateMachine(11768):   int32_t data2 = 11744052702-13 10:41:22.896: W/AHIErarchicalStateMachine(11768): } unhandled in root state.02-13 10:41:22.912: I/MPEG4Writer(11768): setStartTimestampus: 002-13 10:41:22.912: D/DecodeActivity(11768): INFO_OUTPUT_BUFFERS_CHANGED02-13 10:41:22.935: D/DecodeActivity(11768): New format {height=832, what=1869968451, color-format=256, slice-height=832, crop-left=32, wIDth=1408, crop-bottom=743, crop-top=24, mime=vIDeo/raw, strIDe=4096, crop-right=1311}02-13 10:41:22.959: W/MPEG4Writer(11768): 0-duration samples found: 102-13 10:41:22.975: W/MPEG4Writer(11768): 0-duration samples found: 102-13 10:41:22.990: I/ActivityManager(11768): Timeline: Activity_IDle ID: androID.os.BinderProxy@41ab6858 time:2642044102-13 10:41:33.701: D/DecodeActivity(11768): inputBuffer BUFFER_FLAG_END_OF_STREAM02-13 10:41:33.709: D/DecodeActivity(11768): OutputBuffer BUFFER_FLAG_END_OF_STREAM02-13 10:41:33.709: E/MPEG4Writer(11768): There are no sync frames for vIDeo track02-13 10:41:33.717: W/MPEG4Writer(11768): 0-duration samples found: 28302-13 10:41:33.717: I/MPEG4Writer(11768): Received total/0-length (284/0) buffers and encoded 284 frames. - vIDeo02-13 10:41:33.717: D/MPEG4Writer(11768): StopPing VIDeo track02-13 10:41:33.717: D/MPEG4Writer(11768): StopPing VIDeo track source02-13 10:41:33.717: D/MPEG4Writer(11768): VIDeo track stopped02-13 10:41:33.717: D/MPEG4Writer(11768): StopPing Audio track02-13 10:41:36.076: W/MPEG4Writer(11768): 0-duration samples found: 45302-13 10:41:36.076: I/MPEG4Writer(11768): Received total/0-length (454/0) buffers and encoded 454 frames. - audio02-13 10:41:36.271: I/MPEG4Writer(11768): Audio track drift time: 0 us02-13 10:41:36.271: D/MPEG4Writer(11768): StopPing Audio track source02-13 10:41:36.271: D/MPEG4Writer(11768): Audio track stopped02-13 10:41:36.271: D/MPEG4Writer(11768): Duration from tracks range is [0, 0] us02-13 10:41:36.271: D/MPEG4Writer(11768): StopPing writer thread02-13 10:41:36.271: D/MPEG4Writer(11768): 0 chunks are written in the last batch02-13 10:41:36.271: D/MPEG4Writer(11768): Writer thread stopped02-13 12:28:47.507: E/Mediamuxer(14233): stop() is called in invalID state 302-13 10:41:36.271: W/dalvikvm(11768): threadID=11: thread exiting with uncaught exception (group=0x417fbc80)02-13 10:41:36.271: E/AndroIDRuntime(11768): FATAL EXCEPTION: Thread-239402-13 10:41:36.271: E/AndroIDRuntime(11768): Process: com.test.applyexporter, PID: 1176802-13 10:41:36.271: E/AndroIDRuntime(11768): java.lang.IllegalStateException: Failed to stop the muxer02-13 10:41:36.271: E/AndroIDRuntime(11768):    at androID.media.Mediamuxer.nativeStop(Native Method)02-13 10:41:36.271: E/AndroIDRuntime(11768):    at androID.media.Mediamuxer.stop(Mediamuxer.java:226)02-13 10:41:36.271: E/AndroIDRuntime(11768):    at com.test.applyexporter.MainActivity$DecoderThread.releaseDecoder(MainActivity.java:266)02-13 10:41:36.271: E/AndroIDRuntime(11768):    at com.test.applyexporter.MainActivity$DecoderThread.run(MainActivity.java:113)02-13 10:41:36.310: I/Process(11768): Sending signal. PID: 11768 SIG: 9

有什么线索可以阻止失败?

解决方法:

注意错误:

E/MPEG4Writer(11768): There are no sync frames for vIDeo track

多路复用视频输出必须以同步帧(a / k / a关键帧,a / k / a I帧)开头.如果您从预测帧开始,但是没有什么可预测的,则解码器将不知道该怎么做.

确保将所有MediaCodec.BufferInfo值都传递给Mediamuxer,这是标志所在的位置.同步帧将设置BUFFER_FLAG_SYNC_FRAME标志.

(更新:从API 21开始,不推荐使用BUFFER_FLAG_SYNC_FRAME,而建议使用BUFFER_FLAG_KEY_FRAME.两个符号都具有相同的整数值和相同的含义;更改只是在API中采用一致术语的一部分.)

总结

以上是内存溢出为你收集整理的Android MediaMuxer无法停止全部内容,希望文章能够帮你解决Android MediaMuxer无法停止所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1087948.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存