Audio and video slowly drifting out of sync

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]<

 



On Thu, Mar 25, 2010 at 9:13 AM, TJ <one.timothy.jones at gmail.com> wrote:

> Hiya,
>
> When playing HD files encoded with h.264, video progressively goes out of
> sync
> with (lags behind) the audio. I tried it on 2 different computers. Here are
> the
> commands I used:
>
> mplayer -cache 8192 - < capture-00.flv
> mplayer -vo vdpau -vc ffh264vdpau -cache 8192 - < capture-00.flv
>
> Without VDPAU acceleration, CPU usage does not go above 50% (it's Core 2
> Duo
> 1.83GHz computer). With VDPAU CPU usage is below 10%. But still in both
> cases
> video slowly lags more and more behind the audio.
>
> If I add -framedrop option, it fixes the problem, but I see jerks once in a
> while. Without the option the video plays smoothly.
>
> I am using MPlayer SVN-r29796-4.3.4.
>
> The original files are encoded using ffmpeg with the following command:
>
> ffmpeg \
> -f rawvideo -s 1280x720 -pix_fmt uyvy422 -r 59.94 -i /dev/sdivideorx0 \
> -f s16le -ar 48000 -ac 2 -i /dev/sdiaudiorx0 \
> -vcodec libx264 -vpre custom -vb 4000000 -threads 0 \
> -acodec libfaac -ab 256k \
> -f flv - > capture-00.flv
>
> I know the original files are good, as I can play them on the mac with no
> glitches. I tried using different container (-f mpegts) but that didn't
> help.
>
> I was thinking maybe this has something to do with the monitor refresh rate
> being 60Hz while the video is 59.94Hz.
>
> Does anybody have any suggestions on what I can do to fix this?
>
> Thank you.
>
> -TJ
>
TJ,

this is certainly not a general symptom. I use the Hauppage HD PVR which
captures at 59.94 and must have compressed 100 shows by now (same
resolutions as you). I have noticed two things:

The stream is glitchy at some times but due to PTS mencoder manages to keep
it in sync. *Sometimes* (very rarely) it starts off with the wrong sync and
I compensate via multiplexer. However, that is never a drift. If you do
framerate conversion you may be asking for trouble, though, but your command
does not do this.

Here is what I use:

"C:\Bin\mencoder.exe" "E:\rip\Tudors - S03E03.TS.12.TS" -o
"D:\Enc_Out\Tudors - S03E03.TS.12.mkv"  -ovc x264 -x264encopts
threads=0:bframes=5:b-adapt=2:partitions=all:cabac:nopsnr:nossim:mixed_refs:frameref=6:weight_b:b_pyramid=normal:me=umh:merange=16:subme=6:analyse=all:8x8dct=1:trellis=1:psy-rd=1,1:no-fast-pskip=1:crf=23
-oac copy -vf crop=1264:704:8:10,scale=720:480 -fps 60000/1001

Note that I do this quite a bit differently. I also force the framerate
since the beginning of the clip at times shows a different frame rate
(25fps) due to some cutting and mencoder sometimes guesses wrong. You can,
of course, drop the cropping and scaling.


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux