[FFmpeg-user] Sending partial GOP / flushing buffers

André Hänsel andre at webkr.de
Wed Jun 13 21:38:28 EEST 2018

> $ ffmpeg -f avfoundation -framerate 30 -s 1280x720 -pixel_format yuyv422 -i default -an -c:v libx264 -profile:v main -level 3.2  -preset medium -tune zerolatency -b:v 2000k -flags +cgop+low_delay -movflags empty_moov+omit_tfhd_offset+frag_keyframe+default_base_moof+isml -x264opts keyint=250:no-scenecut -pix_fmt yuv420p -r 30  -f mp4 -
> The above emits MOOF/MDAT atoms every 250 frames with a nice bitrate. The atoms are sent to stdout only upon completion, i.e. the whole 250 GOP is written at once. Is there any way to force buffers to be flushed more frequently without increasing the number of i-frames? I would like to start processing the data as soon as possible rather than having to wait for all 250 frames to be processed.

You are creating fragments at each keyframe (-movflags frag_keyframe). There are other conditions you can use to create fragments, like -frag_duration and -frag_size.

I don't think it is allowed for the moof to come after the mdat, so it's not possible to start emitting the mdat until the moof is complete.

More information about the ffmpeg-user mailing list