封装成MP4格式

在Android中遇到MediaMuxer使用video/mp4v-es格式时出现错误,csd找不到。解决方法包括参考StackOverflow上的解答,以及查看Android源码相关变更。
摘要由CSDN通过智能技术生成

1.需要做一下修改,主要是在MPEG4Writer中报错csd找不到,解决方案参考如下:


http://stackoverflow.com/questions/27302280/android-how-to-use-mediamuxer-with-video-mp4v-es-instead-of-video-avc


http://code.google.com/p/android/issues/detail?id=90138


https://android-review.googlesource.com/#/c/120945/1/media/libstagefright/Utils.cpp


https://github.com/CyanogenMod/android_frameworks_av/commit/0f730ffb77bce9cdaa95dc04625ced14fe193757





I want to be able to use mp4v-es instead of avc on some devices. The encoder runs fine using avc, but when I replace it with mp4v-es, the muxer reports:

E/MPEG4Writer(12517): Missing codec specific data

as in MediaMuxer error "Failed to stop the muxer", and the video cannot be played. The difference is that I am adding the correct track/format to the muxer, without receiving any error:

...else if (encoderStatus == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
           
           MediaFormat newFormat = encoder.getOutputFormat();
           mTrackIndex[encID] = mMuxer.addTrack(newFormat);

Is there any difference in handling mp4v-es compared to avc? One mention, I just skip "bufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG" when it occurs, as for avc it was not needed.Thanks.

share improve this question
 
 
Does newFormat have csd-0 and csd-1? –  Marlon  Dec 5 '14 at 7:00
1  
@Marlon: the newFormat is: {height
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值