[FFmpeg-devel] [RFC] Sending H.264 stream to multiple containers

Stefano Sabatini stefasab at gmail.com
Mon Jul 15 13:03:27 CEST 2013


On date Monday 2013-07-15 09:00:25 +0800, Peng encoded:
> >My objective is to be able to generate a command like this one
> >(requires my pending and unreviewed -tee_bsfs patch):
> >ffmpeg -i INPUT -map 0 -flags +global_header -c:v libx264 -c:a libvo_aacenc -tee_bsfs "h264_mp4toannexb:v|aac_adtstoasc:a" -f tee "out.ts|out.mp4"
> >
> >and avoid the need to remux the generated MP4.
> >
> >Do you know if this is possible? Do you have specific hints?
> 
> Not familiar with the current version of FFmpeg. But I suspect
> CODEC_FLAG_GLOBAL_HEADER has anything to do with MP4-compliant H.264
> bitstream.
> 
> CODEC_FLAG_GLOBAL_HEADER just tells FFmpeg not to repeat SPS+PPS for
> every H.264 keyframe, which will be placed in codec->extradata
> instead.

If I create and MP4 file, I can remux it with:
ffmpeg -i in.mp4 -c copy -bsf:v h264_mp4toannexb out.ts

thus my expectation is that the h264_mp4toannexb filter should be able
to add the packet header when doing:
 
ffmpeg -i INPUT -map 0 -flags +global_header -c:v libx264 -c:a libvo_aacenc -bsf:v h264_mp4toannexb out.ts

which is not the case since this will result in an error when parsing
the header.

> MP4-compliant H.264 bitstream is produced by replacing NALU
> startcode by four-byte NALU length. The h264_mp4toannexb  filter does
> the reverse.
> 
> IMO, they are irrelevant.
-- 
FFmpeg = Friendly Funny Mysterious Pitiful Extended God


More information about the ffmpeg-devel mailing list