[MPlayer-users] How can I stop mplayer from buffering my audio?

Stefan Thomas moon at justmoon.de
Thu Nov 8 05:54:57 CET 2007


I'm using this command to capture a stream from my Wii and display it:

mplayer tv:// -tv
driver=v4l2:width=720:height=404:input=1:device=/dev/video1:forceaudio:alsa:audiorate=48000:adevice=hw.2,0:immediatemode=0 

-ao alsa -vf crop=672:368:26:18 -nolirc -fs

Unfortunately I get about one second of latency, which for playing games
is a big problem.

I tried running the exact same command but with -nosound and voila - no
latency at all. So I ran it with verbose and found this:

Audio capture - buffer 293 blocks of 48000 bytes, skew average from 16 meas.
Using a ring buffer for maximum 1826 frames, 1013 MB total size.
[...]
Forced audio codec: mad
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)
[...]
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

How can I stop mplayer from buffering my audio?

Any help would be much appreciated! I tried -nocache, no effect and 
buffersize=0 gives me an error: The buffersize option must be >= 16: 0

Cheers,

Stefan

Full mplayer output:
MPlayer 1.0rc2-4.1.3-DFSG-free (C) 2000-2007 MPlayer Team
CPU: Intel(R) Pentium(R) D CPU 3.20GHz (Family: 15, Model: 4, Stepping: 4)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
get_path('codecs.conf') -> '/home/moon/.mplayer/codecs.conf'
Reading /home/moon/.mplayer/codecs.conf: Can't open
'/home/moon/.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 --codecsdir=/usr/lib/codecs --enable-xvmc
--enable-sdl --enable-ossaudio --enable-lirc --enable-gui
--enable-freetype --enable-menu --enable-largefiles
--disable-bitmap-font --disable-ggi --disable-xvid --language=all
--disable-xmms --disable-arts --disable-jack --disable-aa
--disable-libdv --target=i586-linux --enable-win32dll --enable-real
--enable-xanim --enable-runtime-cpudetection
--disable-libdvdcss-internal --enable-dvdread --disable-mencoder
--enable-tv-v4l2 --enable-xmga --enable-mga --enable-3dfx
--enable-tdfxfb --enable-fbdev
CommandLine: 'tv://' '-tv'
'driver=v4l2:width=720:height=404:input=1:device=/dev/video1:forceaudio:alsa:audiorate=48000:adevice=hw.2,0:immediatemode=0' 

'-ao' 'alsa' '-vf' 'crop=672:368:26:18' '-fs' '-v'
init_freetype
Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay
get_path('fonts') -> '/home/moon/.mplayer/fonts'
Using nanosleep() timing
get_path('input.conf') -> '/home/moon/.mplayer/input.conf'
Can't open input config file /home/moon/.mplayer/input.conf: No such
file or directory
Parsing input config file /etc/mplayer/input.conf
Input config file /etc/mplayer/input.conf parsed: 67 binds
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/moon/.mplayer/.conf'

Playing tv://.
get_path('sub/') -> '/home/moon/.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 at zpr.uni-koeln.de>
  comment: first try, more to come ;-)
Selected device: Yakumo MovieMixer
  Capabilites:  video capture  audio  read/write  streaming
  supported norms: 0 = PAL-BG;
  inputs: 0 = Television; 1 = Composite1; 2 = S-Video;
  Current input: 1
  Format YUYV   (16 bits, Packed YUY2): Packed YUY2
  Current format: YUYV
v4l2: set format: YVU420
v4l2: set input: 1
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
Selected norm : pal
v4l2: set norm: PAL-BG
v4l2: set width: 720
v4l2: set height: 404
Selected input hasn't got a tuner!
==> Found video stream: 0
v4l2: get format: YUYV
v4l2: get fps: 25.000000
v4l2: get width: 720
v4l2: get height: 404
Hardware PCM card 2 'USB Device 0xeb1a:0x2861' device 0 subdevice 0
Its setup is:
   stream       : CAPTURE
   access       : RW_INTERLEAVED
   format       : S16_LE
   subformat    : STD
   channels     : 2
   rate         : 44100
   exact rate   : 44100 (44100/1)
   msbits       : 16
   buffer_size  : 44100
   period_size  : 11025
   period_time  : 250000
   tick_time    : 4000
   tstamp_mode  : NONE
   period_step  : 1
   sleep_min    : 0
   avail_min    : 11025
   xfer_align   : 11025
   start_threshold  : 0
   stop_threshold   : 44100
   silence_threshold: 0
   silence_size : 0
   boundary     : 1445068800
v4l2: set audio samplerate: 48000
Hardware PCM card 2 'USB Device 0xeb1a:0x2861' 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
   tick_time    : 4000
   tstamp_mode  : NONE
   period_step  : 1
   sleep_min    : 0
   avail_min    : 12000
   xfer_align   : 12000
   start_threshold  : 0
   stop_threshold   : 48000
   silence_threshold: 0
   silence_size : 0
   boundary     : 1572864000
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 293 blocks of 48000 bytes, skew average from 16 meas.
Using a ring buffer for maximum 1826 frames, 1013 MB total size.
v4l2: set Brightness: 128 [0, 255]
v4l2: set Hue: 0 [-128, 127]
v4l2: set Saturation: 128 [0, 255]
v4l2: set Contrast: 128 [0, 255]
[V] filefmt:9  fourcc:0x32595559  size:720x404  fps:25.00  ftime:=0.0400
get_path('sub/') -> '/home/moon/.mplayer/sub/'
X11 opening display: :0.0
vo: X11 color mask:  FFFFFF  (R:FF0000 G:FF00 B:FF)
vo: X11 running at 2560x1600 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
xscreensaver_disable: Could not find XScreenSaver window.
[xv common] Drawing no colorkey.
[xv common] Maximum source image dimensions: 4096x4096
Opening video filter: [crop w=672 h=368 x=26 y=18]
Crop: 672 x 368, 26 ; 18
==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
VDec: vo config request - 720 x 404 (preferred colorspace: Packed YUY2)
Trying filter chain: crop vo
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
SwScale params: -1 x -1 (-1=no scaling)
Trying filter chain: scale crop vo
VDec: using Packed YUY2 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
VO Config (720x404->720x404,flags=1,'MPlayer',0x32595559)
SwScaler: reducing / aligning filtersize 1 -> 4
SwScaler: reducing / aligning filtersize 1 -> 4
SwScaler: reducing / aligning filtersize 1 -> 1
SwScaler: reducing / aligning filtersize 9 -> 8
[swscaler @ 0x88ce4b0]SwScaler: BICUBIC scaler, from yuyv422 to yuv420p
using MMX2
[swscaler @ 0x88ce4b0]SwScaler: using 4-tap MMX scaler for horizontal
luminance scaling
[swscaler @ 0x88ce4b0]SwScaler: using 4-tap MMX scaler for horizontal
chrominance scaling
[swscaler @ 0x88ce4b0]SwScaler: using 1-tap MMX "scaler" for vertical
scaling (YV12 like)
[swscaler @ 0x88ce4b0]SwScaler: 720x404 -> 720x404
REQ: flags=0x437  req=0x0
REQ: flags=0x437  req=0x400
VO: [xv] 672x368 => 672x368 Planar YV12  [fs]
VO: Description: X11/Xv
VO: Author: Gerd Knorr <kraxel at goldbach.in-berlin.de> and others
Xvideo image format: 0x32315659 (YV12) planar
Xvideo image format: 0x30323449 (I420) planar
using Xvideo port 131 for hw scaling
[xv-fs] dx: 0 dy: 99 dw: 2560 dh: 1402
[xv] dx: 0 dy: 99 dw: 2560 dh: 1402
Selected video codec: [rawyuy2] vfm: raw (RAW YUY2)
==========================================================================
==========================================================================
Forced audio codec: mad
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
alsa-init: requested format: 48000 Hz, 2 channels, 9
alsa-init: using ALSA 1.0.14a
alsa-init: setup for 1/2 channel(s)
alsa-init: using device default
alsa-init: pcm opened in blocking mode
alsa-init: chunksize set to 1024
alsa-init: fragcount=16
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 at streamminister.de>
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...
v4l2: going to capture
*** [scale] Exporting mp_image_t, 720x404x16bpp YUV packed, 581760 bytes
*** [crop] Allocating mp_image_t, 720x404x12bpp YUV planar, 436320 bytes
*** [vo] Exporting mp_image_t, 672x368x12bpp YUV planar, 370944 bytes
get_path('subfont.ttf') -> '/home/moon/.mplayer/subfont.ttf'
Unicode font: 255 glyphs.
[xv] dx: 0 dy: 0 dw: 2560 dh: 1600
[xv-fs] dx: 0 dy: 99 dw: 2560 dh: 1402
Uninit audio filters... 0.118 ct:  0.000   2/  2  0%  1%  0.1% 0 0
[libaf] Removing filter dummy
Uninit audio: pcm
Uninit video: raw
v4l2: 14 frames successfully processed, 0 frames dropped.
v4l2: up to 11 video frames buffered.
alsa-uninit: pcm closed
vo: uninit ...

Exiting... (Quit)




More information about the MPlayer-users mailing list