[Libav-user] How can I really pick up the correct format when storing incoming stream?

Shupeng Lai shupenglai at gmail.com
Mon Feb 1 19:43:04 CET 2016


I want to re-mux a incoming h264 stream. But how could I pick the
correct AVOutputFormat for the AVFormatContext?

Currently I used:

AVOutputFormat* fmt = av_guess_format(NULL, "xxx.avi", NULL);

// Open the context
//---------------------------------------------------------------------
outFormatCtx = ffmpeg::avformat_alloc_context();

//Set the output format
//----------------------------------------------------------------------
outFormatCtx->oformat = fmt;

And everything works fine.
However, if I change the first line to:
av_guess_format("h264",NULL, NULL);
the recorded stream cannot be played because of bad header/tailer.

Is there a more smart way of picking the correct AVOutputFormat to be used?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160202/2b790219/attachment.html>


More information about the Libav-user mailing list