[Ffmpeg-devel] [bugs] grabbing v4l2 -> buffer underflow ; packet too large ; pcm_s16le vs mp2

Dieter freebsd
Thu Feb 23 19:10:04 CET 2006


[ beware, there are multiple issues here ]

With some assistance from Luca (thanks again) I now have
ffmpeg grabbing video from v4l2.  At least it *says* it is.

But CPU usage is 100% if outputting DV.  So I'm afraid it
will be dropping frames or such.

Added some -m flags to gcc and now it sometimes is
2-4% idle but still usually 100% busy.

And the resulting DV file is garbage.  The video is complete noise,
there is audio, but with a lot of noise.

Tried outputting mpeg instead, and got a bunch of complaints
about buffer underflow and packet too large:

FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
  configuration:  --prefix=/app --disable-bktr --disable-ffserver --disable-ffplay --disable-audio-beos --disable-v4l --enabl
e-memalign-hack --enable-gpl --disable-network --disable-strip --enable-a52 --extra-cflags=-DHAVE_LRINTF -mcpu=athlon-4 -msse
2 -msse3 
  libavutil version: 49.0.0
  libavcodec version: 51.7.0
  libavformat version: 50.3.0
  built on Feb 23 2006 13:53:26, gcc: 3.3.5 20050117 (prerelease) (SUSE Linux)
[video4linux2 @ 0x82d1518][4]Capabilities: 5010015
Device Init(720 480 842093913)
Device Init(720 480 1345466932)
Device Init(720 480 1448695129)
Frame Format: 1448695129
Number of buffers: 27
Input #0, video4linux2, from '':
  Duration: N/A, bitrate: N/A
  Stream #0.0, 1/1000000, 29.97 fps(r): Video: rawvideo, yuv422, 640x480, 1001/30000, 147308 kb/s
Input #1, audio_device, from '':
  Duration: N/A, bitrate: N/A
  Stream #1.0, 1/1000000: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
Output #0, mpeg, to '/video/2006_02_23_chan10ntsc_t1_1min_test_audioargs_2_ffmpeg.mpeg':
  Stream #0.0, 1/90000, 29.97 fps(c): Video: mpeg1video, yuv420p, 720x480, 1001/30000, q=2-31, 200 kb/s
  Stream #0.1, 1/90000: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #1.0 -> #0.1
Press [q] to stop encoding
[mpeg @ 0x82d1518]buffer underflow
[mpeg @ 0x82d1518]buffer underflow
[mpeg @ 0x82d1518]packet too large, ignoring buffer limits to mux it
[mpeg @ 0x82d1518]buffer underflow
[mpeg @ 0x82d1518]buffer underflow
[mpeg @ 0x82d1518]buffer underflow
[mpeg @ 0x82d1518]buffer underflow
[mpeg @ 0x82d1518]packet too large, ignoring buffer limits to mux it

[ ... ]

[mpeg @ 0x82d1518]buffer underflow
[mpeg @ 0x82d1518]packet too large, ignoring buffer limits to mux it
[mpeg @ 0x82d1518]buffer underflow
frame= 1800 q=31.0 Lsize=   53536kB time=60.0 bitrate=7308.1kbits/s dup=1331 drop=0    
video:20949kB audio:11252kB global headers:0kB muxing overhead 66.254733%


Then, when I try to convert it to DV:

./ffmpeg -async 100 -i /video_linux/2006_02_23_chan10ntsc_t1_1min_test_audioargs_2_ffmpeg.mpeg  -s 720x480 -r 29.97  -shift 1 /var/tmp/outfile.dv
FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
  configuration:  --prefix=/app --disable-bktr --disable-ffserver --disable-ffplay --disable-audio-beos --disable-v4l --enable-memalign-hack --enable-gpl --disable-network --disable-strip --enable-a52 --extra-cflags=-DHAVE_LRINTF 
  libavutil version: 49.0.0
  libavcodec version: 51.7.0
  libavformat version: 50.3.0
  built on Feb 23 2006 10:27:06, gcc: 3.4.4 [FreeBSD] 20050518
Input #0, mpeg, from '/video_linux/2006_02_23_chan10ntsc_t1_1min_test_audioargs_2_ffmpeg.mpeg':
  Duration: 00:00:59.8, start: 0.500000, bitrate: 7326 kb/s
  Stream #0.0[0x1e0], 29.97 fps(r): Video: mpeg1video, yuv420p, 720x480, 104857 kb/s
  Stream #0.1[0x1c0]: Audio: mp2, 416 kb/s
Output #0, dv, to '/var/tmp/outfile.dv':
  Stream #0.0, 29.97 fps(c): Video: dvvideo, yuv420p, 720x480, q=2-31, 200 kb/s
  Stream #0.1: Audio: pcm_s16le
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
[dv @ 0x69d080]sample rate not set
Could not write header for output file #0 (incorrect codec parameters ?)


So... ffmpeg says it is writing
	Stream #0.1, 1/90000: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
But when it reads the same file it says:
	Stream #0.1[0x1c0]: Audio: mp2, 416 kb/s

Which reminds me...

Dan Maas' "improved [PATCH] fix DV encoder VLC bit accounting"
fixed the problem I was seeing with
    AC EOB marker is absent
messages, (thanks, Dan) but I still get the yuv420p vs yuv411p
difference.  And now I see a similar problem with the audio.

So we have

	DV encoder VLC bit accounting  [ fixed but probably not checked in yet ]
	yuv420p vs yuv411p
	pcm_s16le vs mp2
	buffer underflow / packet too large





More information about the ffmpeg-devel mailing list