[FFmpeg-user] Comments about audio sync invited

James Linder jam at tigger.ws
Tue Jul 9 13:41:43 CEST 2013


On 09/07/2013, at 3:44 PM, Carl Eugen Hoyos wrote:

> James Linder <jam <at> tigger.ws> writes:
> 
>> ffmpeg -f pulse -itsoffset 0.2 -i default -f v4l2 
>> -i /dev/video0 -vtag divx -s svga -r pal -q:v 5 
>> file.avi -s svga -f rawvideo - | 
>> ffplay -f rawvideo -i - -s svga
> 
> Complete, uncut console output missing.

dvr at dvr:~> ffmpeg -f pulse -i default -f video4linux2 -i /dev/video0 -vtag divx -s svga -q:v 5 /home/dvr/Tue.avi
ffmpeg version 1.0.6 Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr 11 2013 18:03:32 with gcc 4.7 (SUSE Linux)
  configuration: --shlibdir=/usr/lib64 --prefix=/usr --mandir=/usr/share/man --libdir=/usr/lib64 --enable-shared --disable-static --enable-debug --disable-stripping --extra-cflags='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fPIC -I/usr/include/gsm' --enable-gpl --enable-x11grab --enable-version3 --enable-pthreads --enable-avfilter --enable-libpulse --enable-libvpx --enable-libopus --enable-libass --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libxvid --enable-libx264 --enable-libschroedinger --enable-libgsm --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-postproc --enable-libdc1394 --enable-librtmp --enable-libfreetype --enable-avresample --enable-libtwolame --enable-libvo-aacenc
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 59.100 / 54. 59.100
  libavformat    54. 29.104 / 54. 29.104
  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
[pulse @ 0xc352a0] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, pulse, from 'default':
  Duration: N/A, start: 0.636342, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[video4linux2,v4l2 @ 0xc32520] Estimating duration from bitrate, this may be inaccurate
Input #1, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 1373359581.412447, bitrate: 23040 kb/s
    Stream #1:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240, 23040 kb/s, 25 tbr, 1000k tbn, 25 tbc
Output #0, avi, to '/home/dvr/Tue.avi':
  Metadata:
    ISFT            : Lavf54.29.104
    Stream #0:0: Video: mpeg4 (divx / 0x78766964), yuv420p, 800x600, q=2-31, 200 kb/s, 25 tbn, 25 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16
Stream mapping:
  Stream #1:0 -> #0:0 (rawvideo -> mpeg4)
  Stream #0:0 -> #0:1 (pcm_s16le -> libmp3lame)
Press [q] to stop, [?] for help
frame=    7 fps=0.0 q=5.0 size=     769kB time=00:00:01.17 bitrate=5354.8kbits/s
frame=   14 fps= 14 q=5.0 size=    1264kB time=00:00:01.17 bitrate=8805.9kbits/s
frame=   20 fps= 13 q=5.0 size=    1412kB time=00:00:02.16 bitrate=5354.8kbits/s
frame=   27 fps= 13 q=5.0 size=    1572kB time=00:00:02.16 bitrate=5963.2kbits/s
frame=   35 fps= 14 q=5.0 size=    2147kB time=00:00:03.12 bitrate=5637.6kbits/s
frame=   42 fps= 14 q=5.0 size=    2578kB time=00:00:03.16 bitrate=6683.8kbits/s
frame=   49 fps= 14 q=5.0 size=    2993kB time=00:00:03.93 bitrate=6228.6kbits/s
frame=   56 fps= 14 q=5.0 size=    3151kB time=00:00:04.16 bitrate=6204.8kbits/s
frame=   63 fps= 14 q=5.0 size=    3412kB time=00:00:04.94
[snip]
[avi @ 0x6ae480] st:0 PTS: 352982 DTS: 352982 < 353004 invalid, clipping
[avi @ 0x6ae480] st:0 PTS: 352983 DTS: 352983 < 353005 invalid, clipping
frame=210999 fps= 25 q=5.0 size= 1650925kB time=02:21:12.14 bitrate=1596.3kbits/st:0 PTS: 352984 DTS: 352984 < 353006 invalid, clipping
[avi @ 0x6ae480] st:0 PTS: 352985 DTS: 352985 < 353007 invalid, clipping
[avi @ 0x6ae480] st:0 PTS: 352986 DTS: 352986 < 353008 invalid, clipping
[avi @ 0x6ae480] st:0 PTS: 352987 DTS: 352987 < 353009 invalid, clipping
frame=210999 fps= 25 q=5.0 Lsize= 1652659kB time=02:21:12.24 bitrate=1598.0kbits/s    
video:1505976kB audio:132379kB subtitle:0 global headers:0kB muxing overhead 0.873043%
Received signal 2: terminating 

> Do I understand correctly that the output file out.avi 
> shows problems or did you only see problems in the 
> ffplay output?

Both live ffplay display and the file show the same pauses

> If this is about the output file, is the problem also 
> reproducible with ffmpeg alone (without the pipe to 
> ffplay)?

Hmmm without the ffplay display all looks good. Only tried for 2 hours but usually the problem has occurred by now.
Will do an overnight test.
But I do need a live stream for my users. I'll try (again, the first was a diaster) to build the git-head to get tee and try that with ffplay or even mplayer. I watch cpu usage at 50% odd.

> I never tested pulse but it was suggested repeatedly 
> not to use it, try alsa instead.

I did try with alsa but exactly same as with pulse.
Except for all the bad things about pulse, it is very nice. In particular I want an audio level meter for my users, pulse does that nicely alsa does not do so.

> Please understand that thread-hijacking is considered 
> rude here (as is top-posting), Carl Eugen

All my list mail is by digest, except ffmpeg-users so even though I thought the headers were clean, it was my flight-deck-finger-trouble. I'm sorry.

James


More information about the ffmpeg-user mailing list