[FFmpeg-user] buffer problems with dvd encoding

Jim Shupert jshupert at pps-inc.com
Thu Oct 3 00:41:46 CEST 2013


friends
I am having a difficulty with a dvd encode
I am coming from a 10bit uncompressed avi

I have tried setting -bufsize 4096k  which I know is high.
I think -bufsize 1835k is more standard

it will start ok

  ffmpeg -y -i /media/data/cap/soc_1.avi -vf "yadif" -vcodec mpeg2video
-pix_fmt yuv420p -acodec mp2 -target ntsc-dvd -sample_fmt flt -minrate
1000k -maxrate 6000k -bufsize 4096k -aspect 4:3
/media/SSD-015/SofC/SofC2.mpg
ffmpeg version git-2012-09-24-fd63c2f Copyright (c) 2000-2012 the FFmpeg
developers
   built on Sep 24 2012 14:09:13 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
   configuration: --enable-gpl --enable-libfaac --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
--enable-version3 --enable-x11grab
   libavutil      51. 73.101 / 51. 73.101
   libavcodec     54. 58.100 / 54. 58.100
   libavformat    54. 28.101 / 54. 28.101
   libavdevice    54.  2.101 / 54.  2.101
   libavfilter     3. 17.100 /  3. 17.100
   libswscale      2.  1.101 /  2.  1.101
   libswresample   0. 15.100 /  0. 15.100
   libpostproc    52.  0.100 / 52.  0.100
[avi @ 0x24d7240] non-interleaved AVI
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, avi, from '/media/data/cap/soc_1.avi':
   Duration: 00:01:40.26, start: 0.000000, bitrate: 226520 kb/s
     Stream #0:0: Video: v210 (v210 / 0x30313276), yuv422p10le, 720x486,
29.97 tbr, 29.97 tbn, 29.97 tbc
     Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz,
stereo, s16, 1536 kb/s
[mpeg2video @ 0x24ff600] Warning min_rate > 0 but min_rate != max_rate
isn't recommended!
[mpeg2video @ 0x24ff600] impossible bitrate constraints, this will fail
Output #0, dvd, to '/media/SSD-015/SofC/SofC2.mpg':
   Metadata:
     encoder         : Lavf54.28.101
     Stream #0:0: Video: mpeg2video, yuv420p, 720x480 [SAR 8:9 DAR 4:3],
q=2-31, 6000 kb/s, 90k tbn, 29.97 tbc
     Stream #0:1: Audio: ac3, 48000 Hz, stereo, flt, 448 kb/s
Stream mapping:
   Stream #0:0 -> #0:0 (v210 -> mpeg2video)
   Stream #0:1 -> #0:1 (pcm_s16le -> ac3)
Press [q] to stop, [?] for help
frame=   25 fps=0.0 q=2.0 size=     188kB time=00:00:00.85
bitrate=1793.6kbits/sframe=   51 fps= 50 q=2.0 size=     382kB
time=00:00:01.72 bitrate=1816.6kbits/sframe=   76 fps= 49 q=2.0 size=
814kB time=00:00:02.52 bitrate=2643.3kbits/sframe=   98 fps= 48 q=2.0
size=    1538kB time=00:00:03.25 bitrate=3866.4kbits/sframe=  122 fps= 47
q=2.0 size=    2358kB time=00:00:04.09 bitrate=4722.1kbits/sframe=  146
fps= 47 q=2.2 size=    3060kB time=00:00:04.89 bitrate=5125.6kbits/sframe=
  167 fps= 47 q=2.5 Lsize=    3680kB time=00:00:05.56 bitrate=5419.4kbits/s

  but "hit a bad spot"

[dvd @ 0x31febc0] buffer underflow i=1 bufi=328 size=1792
[dvd @ 0x31febc0] buffer underflow i=1 bufi=551 size=1792
[dvd @ 0x31febc0] buffer underflow i=1 bufi=774 size=1792
[dvd @ 0x31febc0] buffer underflow i=1 bufi=997 size=1792
[dvd @ 0x31febc0] buffer underflow i=1 bufi=1220 size=1792
[dvd @ 0x31febc0] buffer underflow i=1 bufi=1443 size=1792

lots & lots of that - and then the audio is out of sync

it also alwyas happens at the same spot in the file
( ~ 1:26 deep in a 1:40 file )

also a transcode into a mp4 is OK

here are some things I have tried
ffmpeg -y -i /media/data/cap/soc_1.avi -vf "yadif" -vcodec mpeg2video
-pix_fmt yuv420p -acodec mp2 -target ntsc-dvd -sample_fmt flt -minrate
1000k -bufsize 4096k -aspect 4:3 /media/SSD-015/SofC/SofC.mpg

ffmpeg -y -i /media/data/cap/soc_1.avi -vf "yadif" -vcodec mpeg2video
-pix_fmt yuv420p -acodec mp2 -target ntsc-dvd -sample_fmt flt -minrate
1000k -maxrate 6000k -bufsize 4096k -aspect 4:3
/media/SSD-015/SofC/SofC2.mpg


ffmpeg -y -i /media/data/cap/soc_1.avi -vf "yadif" -f dvd -vcodec
mpeg2video -pix_fmt yuv420p -acodec mp2 -target ntsc-dvd -sample_fmt flt
-b:v 6110k -minrate 2000k -maxrate 8000k -aspect 4:3
/media/SSD-015/SofC/SofC4.mpg


ffmpeg -y -i /media/data/cap/soc_1.avi -f dvd -vcodec mpeg2video -pix_fmt
yuv420p -b:v 7000k -minrate 1000k -maxrate 8000k -bufsize 1835k -acodec
ac3 -b:a 192K -aspect 4:3  /media/SSD-015/SofC/SofC9.mpg

==================
also the below  did NOT err with a buffer underun

ffmpeg -y -i /media/data/cap/soc_1.avi -vcodec mpeg2video -pix_fmt yuv420p
-b:v 7000k -acodec ac3 -b:a 192K -aspect 4:3
/media/SSD-015/SofC/SofC10.mpg
nor does
ffmpeg -y -i /media/data/cap/soc_1.avi /media/SSD-015/SofC/S1.mpg

a simple mpg1

===================

so the difference is no -target ntsc-dvd

MY Q is what are the "details" of -target ntsc-dvd

and or what combo of minrate maxrate datarate bufsize vbv - might resolve
this problem

again it seems to be

-target ntsc-dvd and mpg2video

Thanks

jS



More information about the ffmpeg-user mailing list