[FFmpeg-user] ffmpeg encoding

Steffen Richter - m.objects info at mobjects.com
Thu Sep 25 10:37:31 CEST 2014

>I need to encode an specific mp4, i have been trying with the ffmpeg, but i 
>couldnt make it, if you could help me with these would be great.
>The encoding requirements are these:

>Main profile Level 3.0

>Set CABAC for Main profile
>Constant bit rate encoding
>1.5-2.0 Mb´s  resolution
>Closed GOP must be set
>GOP size shall be equal to 1/2 second, with the following exceptions:
>      -Utilizing GOP size less than 1/2 second is acceptable and shall be 
> used for       scene change detection.
>Every I-frame must be in IDR- IDR Frecuency shall be set to 1
>Streaming format is required e.g SPS and other secuence headers shall be 
>repeated throughout the stream to facilitate fast decoder synchronization 
>during random acces.
>B-Frames shall be used when main profile is chosen
>No referenced B-frames
>Number of B-Frames shall be set to 2 or 3
>Number of referenced frames shall be set to 2
>Encode without wight prediction
>Number of slices shall be set to 1,2 or 4
>Deblocking filter shall be enable
>720x480 NTSC
>Thanks you so much!!!

I am not (yet) an experienced ffmpeg user, so I cannot guarantee for the 
correctness of all the following:

In my opinion, it is sufficient to specify .mp4 as file extension in order 
to get the right container format.
Constant Bitrate encoding can be achieved by specifying -b:v X -minrate 
X -maxrate X, where X is the desried datarate in KBit/s
Using the option -faststart will lead to all relevant packet information 
written to the beginning of the file instead of the end, which of course is 
better for streaming applications
MP4 muxer also supports fragmentation, which means that smaller fragments 
will be packed together with all packet information necessary for decoding. 
See https://www.ffmpeg.org/ffmpeg-all.html, 23.11
Most things concerning GOP size, B-frames, weight-prediction, scene 
detection can be controlled by using -x264opts opt1=1:opt2=2:... in the 
ffmpeg commandline, you will find the options by downloading and opening 
x264.exe with -fullhelp. Maybe you will find a prest that is matching most 
of your needs,so only options that differ from the preset will need to be 
This is where my knowledge ends - I hope this will already help a bit.

ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org

More information about the ffmpeg-user mailing list