[FFmpeg-user] MPEG-TS CBR?

Anjo Krank anjo at krank.net
Mon Apr 2 23:53:23 CEST 2012


Hi,

I have a customer in the TV biz that requires MPEG2-TS with 4000kbit CBR. Currently, I create files with:

    bandwidth=4000
    bandwidth="-b:v #{bandwidth}k -minrate:v #{bandwidth}k -maxrate:v #{bandwidth}k  -bufsize #{bandwidth/4}k"
    extra="-g 12 -bf 2 -flags +cgop -flags2 sgop -sc_threshold 1000000000 -streamid:v 0:480 -streamid:a 1:481 -packetsize 188 "
    video="-c:v mpeg2video -pix_fmt yuv420p -ec +deblock -vf yadif -r 25 -s 720x576 #{bandwidth} #{extra}"
    audio_flags="-c:a mp2 -ar 48000 -b:a 192k"
    audio="#{audio_flags}"
    cmd="#{mapping} #{video} #{audio} -f #{type} -y #{outfile(file,type,ext)}"

which Igot from the ffmpeg docs on how to create CBR streams (with fixed GOP).

The customer has an unknown check program that rejects some (but not all, sigh) files I create with the message "MPEGError[Target bitrate too low]". I have no idea what this means but looking at the file with a stream checker indeed shows a drop to ~3.5mbit around 90 secs in, however overall bitrate is pretty much at 4 mbit with little variation.

From a lot of searching on the web I get the impression that "real" CBR isn't really possible with ffmpeg or mpeg2 in general. Does anyone has a suggestion to create a broadcast TV stream with 4 mbit CBR that (hopefully) wouldn't fail?

Or at least tell me what number -bufsize #{bandwidth/4}k should really be for that kind of stream? Or if how I could play around with -muxrate setting to match my requirements?

Thanks in advance, Anjo



More information about the ffmpeg-user mailing list