[FFmpeg-user] MPEG-TS CBR?

Anjo Krank anjo at krank.net
Tue Apr 3 16:37:58 CEST 2012


Hi Carl,

thanks for your reply! Here's a complete line and the resulting output. There is nothing noteworthy in there, AFAICS. No error messages during running whatsoever.

ffmpeg -i /mvl/412/Office.sd.mpg  -c:v mpeg2video -pix_fmt yuv420p -ec +deblock -vf yadif -r 25 -s 720x576 -b:v 4000k -minrate:v 4000k -maxrate:v 4000k  -bufsize 1000k -g 12 -bf 2 -flags +cgop -flags2 sgop -sc_threshold 1000000000 -streamid:v 0:480 -streamid:a 1:481  -c:a mp2 -ar 48000 -b:a 192k -packetsize 188 -f mpegts -y tst.mpg 

ffmpeg version git-2011-09-16-0f692db Copyright (c) 2000-2012 the FFmpeg developers
  built on Feb 15 2012 13:56:35 with gcc 4.0.1 (Apple Inc. build 5493)
  configuration: --prefix=/Users/ak/sffmpeg/build --datadir=/Users/ak/sffmpeg/build/etc --arch=x86_64 --disable-shared --enable-static --enable-gpl --enable-version3 --enable-nonfree --disable-doc --disable-debug --disable-ffplay --disable-ffserver --disable-avdevice --disable-indevs --disable-outdevs --enable-runtime-cpudetect --enable-memalign-hack --extra-cflags=-I/Users/ak/sffmpeg/build/include --extra-cflags=--static --extra-cflags=-m64 --extra-ldflags=-L/Users/ak/sffmpeg/build/lib --extra-ldflags=-m64 --extra-ldflags=-arch --extra-ldflags=x86_64 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --disable-libspeex --enable-libx264 --disable-libxvid --disable-librtmp
  libavutil      51. 39.100 / 51. 39.100
  libavcodec     54.  1.100 / 54.  1.100
  libavformat    54.  0.100 / 54.  0.100
  libavfilter     2. 62.100 /  2. 62.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mpeg, from '/mvl/412/Office.sd.mpg':
  Duration: 02:08:29.54, start: 0.357978, bitrate: 31158 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 32:27 DAR 16:9], 30000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
[buffer @ 0x101100600] w:720 h:480 pixfmt:yuv420p tb:1/1000000 sar:32/27 sws_param:
[yadif @ 0x1011023e0] mode:0 parity:-1 auto_enable:0
[scale @ 0x101101040] w:720 h:480 fmt:yuv420p -> w:720 h:576 fmt:yuv420p flags:0x4
[mpegts @ 0x101810220] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to 'tst.mpg':
  Metadata:
    encoder         : Lavf54.0.100
    Stream #0:0: Video: mpeg2video, yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=2-31, 4000 kb/s, 90k tbn, 25 tbc
    Stream #0:1: Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> mpeg2video)
  Stream #0:1 -> #0:1 (mp2 -> mp2)
Press [q] to stop, [?] for help
frame=192740 fps= 28 q=2.0 Lsize= 4281847kB time=02:08:29.56 bitrate=4549.8kbits/s dup=0 drop=38315    
video:3764423kB audio:180694kB global headers:0kB muxing overhead 8.535395%

It's frustrating that I can't give more info about what "rate too low" is actually supposed to mean. The client has a system set up where this is simply an error message and no one can give me any more info :/

The only thing I found was a drop at around 50 secs in:



It's the tiny white line at the left, where throughput drops to 3.5m. The resulting movie files looks totally normal at this location. From mucho googling I had the impression that it could maybe be a wrong setting for the  -bufsize 1000k. Is this on any way calculable or are they simply a bunch of legal settings?

The other thing would have been to set -muxrate to around 4000+128*1.05, which is just low enough to not produce error messages due to underruns. My impression was that this would fill up the stream with NULL packets.

But I haven't really tried that yet because turnaround is ~4 days and I thought maybe someone would have a general idea what might be wrong.

Thanks again, Anjo


Am 03.04.2012 um 10:16 schrieb Carl Eugen Hoyos:

> Anjo Krank <anjo <at> krank.net> writes:
> 
>> 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.
> 
> Constant frame size does not exist for MPEG-2.
> 
> If you need support here, please post a "real" command line 
> (one that can be copy-pasted into a terminal and works if the 
> input file exists) together with complete, uncut console output.
> 
> Did you try if it works with a program stream?
> 
> Carl Eugen
> 
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list