Opened 9 years ago

Last modified 8 years ago

#1622 new defect

A/V Sync with HVR-850

Reported by: saturley709739@… Owned by: reimar
Priority: normal Component: streaming
Version: 1.0rc2 Severity: normal
Keywords: Cc: reimar
Blocked By: Blocking:
Reproduced by developer: Analyzed by developer:

Description

I'm having an odd problem with mplayer.

I have a USB Stick Hauppauge WinTV-HVR-850, the Model 1200 version that is very similar to the HVR-950Q. It uses the uses xc5000/au8522/au0828 kernel modules.

On my desktop, I try the following invocation to play analog cable from the USB stick:

mplayer tv:// -tv norm=NTSC-M:chanlist=us-cable:alsa:adevice=hw.1,0:immediatemode=0 -aspect 4:3

I need the alsa:adevice=hw.1,0 to select the sound from the usb stick, since it shows up as a second sound card. The immediatemode=0 is also necessary to get sound.

I get a message saying:

"Video buffer shorter than 3 times audio frame duration.
You will probably experience heavy framedrops."

This is 100% correct, I get heavy frame drops.

So I try variations on buffer size, like

mplayer tv:// -tv norm=NTSC-M:chanlist=us-cable:alsa:adevice=hw.1,0:immediatemode=0:buffersize=1024 -aspect 4:3

These make the warning go away, but not the framedrops. Eventually, I get the message:


Your system is too SLOW to play this!

Jacking up the buffer size (to say, 1024) improves things somewhat, but the A/V sync is terrible. The CPU on this box is an Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz, and running this doesn't come close to pegging the CPU. I've also tried variations of the autosync option, the -ao sdl, and everything else that mplayer suggests.

I have an Asus 1000HE netbook (Atom N280 @1.66GHz) that can run the video flawlessly, I don't even need the buffersize option. Both machines are running 2.6.32 with the latest drivers from http://www.linuxtv.org/.

Aside from the CPU, the only significant difference I can think of between the two machines is that the desktop has a PCI-based C-Media Electronics Inc CM8738 based sound card, using the snd_cmipci driver. This could be a bug in the sound driver, but the bleeding-edge version of tvtime (the devs just added alsa support) works fine.


System Information

Distribution:

Debian Testing + Debs from debian-multimedia.org

Kernel:

Linux carbon 2.6.32-carbon-1 #1 SMP Sat Jan 9 17:39:19 EST 2010 i686 GNU/Linux

libc version:

-rwxr-xr-x 1 root root 1331496 2009-11-24 05:49 /lib/libc-2.10.2.so
lrwxrwxrwx 1 root root 14 2009-12-05 13:57 /lib/libc.so.6 -> libc-2.10.2.so

gcc and ld versions:
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.4-6' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.3.4 (Debian 4.3.4-6)

GNU ld (GNU Binutils for Debian) 2.20

binutils version:

GNU assembler (GNU Binutils for Debian) 2.20
Copyright 2009 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `i486-linux-gnu'.

CPU

model name : Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz

Video Card:

Nvidia GeForce? 7950 GT
Nvidia Driver Version: 190.42

Sound Card:

C-Media Electronics Inc CM8738 + Alsa (in-kernel drivers)


Mplayer Output

MPlayer SVN-r30075 (C) 2000-2009 MPlayer Team
CPU vendor name: GenuineIntel? max cpuid level: 10
CPU: Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz (Family: 6, Model: 15, Stepping: 6)
extended cpuid-level: 8
extended cache-info: 268468288
Detected cache-line size is 64 bytes
Testing OS support for SSE... yes.
Tests of OS support for SSE passed.
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNowExt: 0 SSE: 1 SSE2: 1 SSSE3: 1
Compiled with runtime CPU detection.
get_path('codecs.conf') -> '/home/peter/.mplayer/codecs.conf'
Reading /home/peter/.mplayer/codecs.conf: Can't open '/home/peter/.mplayer/codecs.conf': No such file or directory
Reading /etc/mplayer/codecs.conf: Can't open '/etc/mplayer/codecs.conf': No such file or directory
Using built-in default codecs.conf.
Configuration: --prefix=/usr --confdir=/etc/mplayer --datadir=/usr/share/mplayer --enable-xmga --enable-mga --enable-joystick --disable-tremor-internal --enable-libopencore_amrnb --enable-libopencore_amrwb --disable-openal --disable-faad-internal --disable-liba52-internal --language=all --enable-largefiles --enable-menu --disable-libdvdcss-internal --enable-radio --enable-radio-capture --enable-xvmc --with-xvmclib=XvMCW --enable-win32dll --enable-tdfxfb --enable-s3fb --enable-zr --realcodecsdir=/usr/lib/codecs --xanimcodecsdir=/usr/lib/codecs --enable-gui --enable-runtime-cpudetection
CommandLine?: '-v' 'tv://' '-tv' 'norm=NTSC-M:chanlist=us-cable:alsa:adevice=hw.1,0:immediatemode=0:buffersize=1024' '-aspect' '4:3'
init_freetype
Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay?
get_path('fonts') -> '/home/peter/.mplayer/fonts'
Using nanosleep() timing
get_path('input.conf') -> '/home/peter/.mplayer/input.conf'
Can't open input config file /home/peter/.mplayer/input.conf: No such file or directory
Parsing input config file /etc/mplayer/input.conf
Input config file /etc/mplayer/input.conf parsed: 90 binds
Opening joystick device /dev/input/js0
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick
Setting up LIRC support...
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
get_path('.conf') -> '/home/peter/.mplayer/.conf'

Playing tv://.
get_path('sub/') -> '/home/peter/.mplayer/sub/'
STREAM: [tv] tv://
STREAM: Description: TV Input
STREAM: Author: Benjamin Zores, Albeu
STREAM: Comment:
TV file format detected.
Selected driver: v4l2

name: Video 4 Linux 2 input
author: Martin Olschewski <olschewski@…>
comment: first try, more to come ;-)

Selected device: Hauppauge HVR850

Tuner cap: STEREO LANG1 LANG2
Tuner rxs: MONO
Capabilites: video capture tuner audio read/write streaming
supported norms: 0 = NTSC-M;
inputs: 0 = Television; 1 = Composite; 2 = S-Video;
Current input: 0
Format UYVY (16 bits, Packed YUV2): Packed UYVY
Current format: UYVY

v4l2: current audio mode is : STEREO
v4l2: set format: YVU420
v4l2: ioctl set format failed: Invalid argument
v4l2: set format: YUV420
v4l2: ioctl set format failed: Invalid argument
v4l2: set format: UYVY
v4l2: set input: 0
Selected norm : NTSC-M
v4l2: set norm: NTSC-M
Selected channel list: us-cable (including 133 channels)
Current frequency: 6836 (427.250)
==> Found video stream: 0
v4l2: get format: UYVY
v4l2: get fps: 29.970030
v4l2: get width: 720
v4l2: get height: 480
Hardware PCM card 1 'USB Device 0x2040:0x7240' device 0 subdevice 0
Its setup is:

stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 48000
period_size : 12000
period_time : 250000
tstamp_mode : NONE
period_step : 1
avail_min : 12000
period_event : 0
start_threshold : 0
stop_threshold : 48000
silence_threshold: 0
silence_size : 0
boundary : 1572864000
appl_ptr : 0
hw_ptr : 0

v4l2: set audio samplerate: 44100
Hardware PCM card 1 'USB Device 0x2040:0x7240' device 0 subdevice 0
Its setup is:

stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 48000
period_size : 12000
period_time : 250000
tstamp_mode : NONE
period_step : 1
avail_min : 12000
period_event : 0
start_threshold : 0
stop_threshold : 48000
silence_threshold: 0
silence_size : 0
boundary : 1572864000
appl_ptr : 0
hw_ptr : 0

v4l2: get audio format: 9
==> Found audio stream: 0
v4l2: get audio samplerate: 48000
v4l2: get audio samplesize: 2
v4l2: get audio channels: 2

TV audio: 2 channels, 16 bits, 48000 Hz

Audio capture - buffer 256 blocks of 48000 bytes, skew average from 16 meas.
Using a ring buffer for maximum 1553 frames, 1023 MB total size.
v4l2: set Brightness: 128 [0, 255]
v4l2: set Hue: 0 [-32768, 32768]
v4l2: set Saturation: 128 [0, 255]
v4l2: set Contrast: 121 [0, 255]
[V] filefmt:9 fourcc:0x59565955 size:720x480 fps:29.970 ftime:=0.0334
get_path('sub/') -> '/home/peter/.mplayer/sub/'
X11 opening display: :0.0
vo: X11 color mask: FFFFFF (R:FF0000 G:FF00 B:FF)
vo: X11 running at 1600x1200 with depth 24 and 32 bpp (":0.0" => local display)
[x11] Detected wm supports NetWM.
[x11] Detected wm supports FULLSCREEN state.
[x11] Detected wm supports ABOVE state.
[x11] Detected wm supports BELOW state.
[x11] Current fstype setting honours FULLSCREEN ABOVE BELOW X atoms
[VO_XV] Using Xv Adapter #0 (NV17 Video Texture)
[xv common] Drawing no colorkey.
[xv common] Maximum source image dimensions: 2046x2046
==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
VDec: vo config request - 720 x 480 (preferred colorspace: Packed UYVY)
Trying filter chain: vo
VDec: using Packed UYVY as output csp (no 0)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO Config (720x480->720x540,flags=0,'MPlayer',0x59565955)
VO: [xv] 720x480 => 720x540 Packed UYVY
VO: Description: X11/Xv
VO: Author: Gerd Knorr <kraxel@…> and others
Xvideo image format: 0x32595559 (YUY2) packed
Xvideo image format: 0x32315659 (YV12) planar
Xvideo image format: 0x59565955 (UYVY) packed
Xvideo image format: 0x30323449 (I420) planar
using Xvideo port 355 for hw scaling
Selected video codec: [rawuyvy] vfm: raw (RAW UYVY)
==========================================================================
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
dec_audio: Allocating 2048 + 65536 = 67584 bytes for output buffer.
AUDIO: 48000 Hz, 2 ch, s16le, 1536.0 kbit/100.00% (ratio: 192000->192000)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...
[libaf] Adding filter dummy
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[dummy] Was reinitialized: 48000Hz/2ch/s16le
Trying preferred audio driver 'alsa', options '[none]'
alsa-init: requested format: 48000 Hz, 2 channels, 9
alsa-init: using ALSA 1.0.21a
alsa-init: setup for 1/2 channel(s)
alsa-init: using device default
alsa-init: pcm opened in blocking mode
alsa-init: got buffersize=65536
alsa-init: got period size 1024
alsa: 48000 Hz/2 channels/4 bpf/65536 bytes buffer/Signed 16 bit Little Endian
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
AO: Description: ALSA-0.9.x-1.x audio output
AO: Author: Alex Beregszaszi, Zsolt Barat <joy@…>
AO: Comment: under developement
Building audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[dummy] Was reinitialized: 48000Hz/2ch/s16le
Starting playback...
Increasing filtered audio buffer size from 0 to 65536
v4l2: going to capture
* [vo] Exporting mp_image_t, 720x480x16bpp YUV packed, 691200 bytes
Unicode font: 255 glyphs.
Unicode font: 255 glyphs.
A: 0.4 V: 0.0 A-V: 0.386 ct: 0.000


Your system is too SLOW to play this!

Possible reasons, problems, workarounds:

  • Most common: broken/buggy _audio_ driver
    • Try -ao sdl or use the OSS emulation of ALSA.
    • Experiment with different values for -autosync, 30 is a good start.
  • Slow video output
    • Try a different -vo driver (-vo help for a list) or try -framedrop!
  • Slow CPU
    • Don't try to play a big DVD/DivX on a slow CPU! Try some of the lavdopts, e.g. -vfm ffmpeg -lavdopts lowres=1:fast:skiploopfilter=all.
  • Broken file
    • Try various combinations of -nobps -ni -forceidx -mc 0.
  • Slow media (NFS/SMB mounts, DVD, VCD etc)
    • Try -cache 8192.
  • Are you using -cache to play a non-interleaved AVI file?
    • Try -nocache.

Read DOCS/HTML/en/video.html for tuning/speedup tips.
If none of this helps you, read DOCS/HTML/en/bugreports.html.

Change History (7)

comment:1 Changed 9 years ago by reimar

The output looks more like it just doesn't get any video from V4L for a long time.
It's possible it will just crash, but as a first step I'd suggest trying -novideo, -nosound, -ao null, -vo null etc.

comment:2 Changed 9 years ago by reimar

  • Cc Reimar.Doeffinger@… added

comment:3 Changed 9 years ago by saturley709739@…

(In reply to comment #1)

The output looks more like it just doesn't get any video from V4L for a long
time.
It's possible it will just crash, but as a first step I'd suggest trying
-novideo, -nosound, -ao null, -vo null etc.

Using -novideo has no effect (I still get video, and the above warning message).

Using -nosound kills the sound, and results in smoother video playback, and no warnings.

Using -ao null kills the sound, but produces very uneven video playback (frames/second looks to be changing). No warning message is produced.

Using -vo null kills the video, gives good sound, but the "your system is too SLOW to play this!" warning appears again.

Trying to be clever and run two different instances of mplayer from two different xterms results in a "device or resource busy...exit".

I can run mplayer without sound, and then run "arecord -D hw:1,0 -f dat | aplay" in a separate xterm with reasonable results, but my end goal is to run mencoder.

comment:4 Changed 9 years ago by reimar

If in the end you want to use mencoder, have you tried using mencoder?
For MPlayer you could also try -benchmark.
I don't yet have an idea what kind of issue would cause -nosound be ok but -ao null bad...

comment:5 Changed 9 years ago by saturley709739@…

(In reply to comment #3)

Thanks for the suggestion. I tried:

mencoder -v tv:// -tv norm=NTSC-M:chanlist=us-cable:channel=58:alsa:adevice=hw.1,0:buffersize=1024 -oac mp3lame -lameopts cbr:br=64 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=900 -o hvr-950_alsa.avi

Got a lot of this in the console

Pos: 10.1s 342f ( 0%) 30fps Trem: 0min 0mb A-V:0.000 [880:64] A/Vms 11/2 D/B/S 65/105/105
Skipping frame!
Pos: 10.1s 343f ( 0%) 30fps Trem: 0min 0mb A-V:0.000 [880:64] A/Vms 11/2 D/B/S 65/106/106
Skipping frame!
Pos: 10.1s 345f ( 0%) 30fps Trem: 0min 0mb A-V:0.000 [880:64] A/Vms 11/2 D/B/S 65/107/107
Skipping frame!

The output, hvr-950_alsa.avi, has the same a-v sync problems as when I
watch the stream in mplayer. I used a channel with a scrolling
information bar at the bottom, so the playback problems are really
obvious. In addition to the a/v sync, it looks like the video
playback with the sound enabled on my system is changing speed.

Incidentally, if I forgo the sound with this command line:

mencoder -v tv:// -tv norm=NTSC-M:chanlist=us-cable:channel=58:buffersize=1024 -oac mp3lame -lameopts cbr:br=64 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=900 -o hvr-950_no_alsa.avi

The video captured is fine.

Since the HVR-950 is USB based, it's easy to move around. Just for
fun I tried this on my atom-based notebook:

mencoder -v tv:// -tv norm=NTSC-M:chanlist=us-cable:channel=58:alsa:adevice=hw.1,0:buffersize=1024 -oac mp3lame -lameopts cbr:br=64 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=900 -o hvr-950_alsa_atom_notebook.avi

It bangs on the cpu pretty hard, and drops the odd frame, but the
resulting avi file looks fine.

I've uploaded all three files to
ftp://upload.mplayerhq.hu/MPlayer/incoming/ in case anyone wants to
take a look.

I also tried the -benchmark option, but it didn't reveal anything
helpful, here's the snippet from the end of the output:

Starting playback...
Increasing filtered audio buffer size from 0 to 65536
v4l2: going to capture
* [vo] Exporting mp_image_t, 720x480x16bpp YUV packed, 691200 bytes
Unicode font: 255 glyphs.
Unicode font: 255 glyphs.
Uninit audio filters... 0.000 ct: 0.250 437/437 0% 1% 0.1% 61 0
[libaf] Removing filter dummy
Uninit audio: pcm
Uninit video: raw
v4l2: 476 frames successfully processed, 1 frames dropped.
v4l2: up to 38 video frames buffered.
alsa-uninit: pcm closed
vo: uninit ...

comment:6 Changed 8 years ago by saturley709739@…

Everyone,

Elsewhere on the mplayer-users mailing list, there is a discussion thread entitled "Digitizing VHS tapes with mencoder". Someone has encountered a similar issue, and suggested pulling the latest source snapshot, and redefining MAX_SKEW_DELTA in tvi_v4l2.c to 0.02.

I tried this, pulling a copy of the source on April 24, 2010. This fixed my a/v sync issue, everything now seems to work perfectly.

comment:7 Changed 8 years ago by compn

  • Owner changed from r_togni@… to reimar
Note: See TracTickets for help on using tickets.