[Libav-user] H.264 annex B muxing in mp4

Malik Cisse mc at enciris.com
Tue Jan 14 15:39:53 CET 2014

I managed to write a H.264 annex B muxer (from a compression board) in mp4 using libavformat.
If I don't specify extradata as bellow, the generated MP4 stream appears to be corrupted and won't play in quicktime.
pMux_ctx->video_st = NULL;
if ( pMux_ctx->fmt->video_codec != CODEC_ID_NONE )
                AVCodecContext * c;
                pMux_ctx->video_st = av_new_stream (pMux_ctx->oc , 0);
                if (! pMux_ctx->video_st)
                               fprintf( stderr, "Could not alloc video_stream\n" );
                c = pMux_ctx->video_st->codec;
c->extradata = buffer;
c->extradata_size = size;
This all works fine but I just don't understand why the muxer needs the extradata since all necessary metadata have already been set through AVCodecContext.
I would like to simplify the code and avoid computing extradata in advance (saving thus 600 lines of code).
Thanks, Malikcis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20140114/8b120758/attachment.html>

More information about the Libav-user mailing list