Opened 13 years ago

#964 new defect

Audio drift when recording from saa7134 tv device with mencoder using lavc

Reported by: davydm@… Owned by: reimar
Priority: normal Component: core
Version: HEAD Severity: major
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: Analyzed by developer:


Good day

I have written (long ago and far away) a simple server and gui front-end to record tv shows at pre-determined times from my saa7134 tv tuner card. Mencoder seemed like the obvious choice for the program to do the actual work of the process -- the recording. And a good choice it was (and still is).

The project is configurable for oac and ovc, and I originally used the lavc audio and video outputs because I seemed to get a consistant 2 second audio delay when trying to use my first choice -- xvid and mp3lame. So far so, good -- the code worked fine for quite some time, and then I stopped recording shows on a regular basis.

When I recently (about 2 weeks ago) restarted, I found that recorded avi's seemed to have an audio delay. I spent a lot of time trying to figure out what the exact delay wast, figuring I could just use -audio-delay; to my dismay, I've found that it's actually an audio drift -- and quite a serious one: a 30 second clip ends up with the audio about 10 seconds ahead of the video.

After banging my head against the wall for some time, I retried xvid/mp3lame, and found this combo to work fine again. This behaviour is exhibited with the following versions:
svn head
1.0-rc2 tarball from
1.0-rc2 package from Ubuntu.

The encoding line of interest is:
mencoder -tv device=/dev/video0:adevice=/dev/dsp1:driver=v4l2:channels=41-SABC1,37-SABC2,49-SABC3,43-eTV,45-MNET -o /media/dump/tvrec/RealTV-2007-12-16-06h25.00.avi -ffourcc DX50 -vf pp=lb,scale=1:1:presize=qpal -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:v4mv:aic:vbitrate=1000 -oac lavc -lavcopts acodec=mp3:abitrate=96 -endpos 0:40:00 tv://eTV

Changing the acodec to mp2 (the original way I had things even longer ago) also made no difference to the drift problem.

Now, for my specs, in the hope that the information will be useful:
OS: Ubuntu Linux 7.10
Platform: AMD Athlon 64 X2 3600+
Video device: Flyvideo 2000 (saa7134 chipset), using the oss sound output driver
Kernel version: 2.6.22-14-generic

Unfortunately, I can't seem to pin down the event which caused the change from a working lavc recording to a drifting one, because of the time gap between when I was regularly recording a daytime tv show and now. However, I have a sneaky suspicion that the change may have been when I upgraded from an Athlon 2400+ to the Athlon 64 X2 -- since that has happened in the not-too-distant past.

If there is any more information I can furnish, or any tests I can do, please don't hesitate to contact me.

Thanks for a great project.

Change History (0)

Note: See TracTickets for help on using tickets.