[MPlayer-users] Problem with -ao pcm:file option

Matthew Kwan mkwan at vivatel.com.au
Thu May 14 05:03:00 CEST 2009


Hi.

We're trying to build an application on a Fedora 7 Linux platform that
takes a webcam feed and streams it to mobile devices. Our first attempt
was a custom application using the ffmpeg libraries, but the ffmpeg
codecs couldn't handle the ASF stream.

We then tried mplayer, and it played the audio/video flawlessly. But we've
had trouble hooking mplayer into our streaming app.

Our first thought was to use mplayer's codecs, but mplayer doesn't
install its libraries separately, so there's no way to link to them.

We then tried using FIFOs to capture the decoded audio and video, using
mplayer -ao pcm:file=audio-fifo -vo yuv4mpeg:file=video-fifo

The behaviour we're seeing is that it connects and buffers correctly,
but that it passes through the audio and video in bursts. It does nothing
for about four seconds, then writes all the accumulated audio and video
in one hit, waits another four seconds, and so on. That's no good for us.

If we use -nosound the video streams smoothly, but we need audio for this
application. The pcm:fast and -autosync options make no difference.
We even read from the audio FIFO read at the correct rate so mplayer's
audio write process should block periodically.

Is there any way to fix this problem?

As a last resort we could re-write ao_pcm.c to check if writing would
block and delay accordingly, but that's not desirable. Our server runs
off RPMs, and compiling and maintaining a custom version of mplayer
adds a lot of support overheads.

Is there a way to make audio and video stream smoothly to an external
application using the existing executable?

Below are the mplayer diagnostics from the stream we're using.

Regards,


mkwan



MPlayer 1.0rc1-4.1.2 (C) 2000-2006 MPlayer Team
CPU: Intel Celeron 2/Pentium III Coppermine,Geyserville (Family: 6, Model: 8,
Stepping: 6)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 0
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick
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.

Playing http://XXX.XX.192.14/img/video.asf.
Resolving XXX.XX.192.14 for AF_INET6...
Couldn't resolve name for AF_INET6: XXX.XX.192.14
Connecting to server XXX.XX.192.14[XXX.XX.192.14]: 80...
Cache size set to 320 KBytes
Cache fill: 15.00% (49152 bytes)
ASF file format detected.
VIDEO:  [M4S2]  320x240  24bpp  1000.000 fps    0.0 kbps ( 0.0 kbyte/s)
Using (default) progressive frame
mode.==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
==========================================================================
Opening audio decoder: [acm] Win32/ACM decoders
Loading codec DLL: 'scg726.acm'
Win32 LoadLibrary failed to load: scg726.acm, /usr/lib/codecs/scg726.acm,
/usr/lib/win32/scg726.acm, /usr/local/lib/win32/scg726.acm
Can't open library scg726.acm
ACM_Decoder: Unappropriate audio format
Could not load/initialize Win32/ACM audio codec (missing DLL file?).
ADecoder preinit failed :(
ADecoder init failed :(
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 8000 Hz, 1 ch, s16le, 16.0 kbit/12.50% (ratio: 2000->16000)
Selected audio codec: [ffg726] afm: ffmpeg (Sharp G.726 Audio)
==========================================================================
[AO PCM] File: foo.wav (WAVE)
PCM: Samplerate: 8000Hz Channels: Mono Format s16le
[AO PCM] Info: Faster dumping is achieved with -vc null -vo null -ao pcm:fast
[AO PCM] Info: To write WAVE files use -ao pcm:waveheader (default).
AO: [pcm] 8000Hz 1ch s16le (2 bytes per sample)
Starting playback...
VDec: vo config request - 320 x 240 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO: [yuv4mpeg] 320x240 => 320x240 Planar YV12
A:  12.3 V:   7.5 A-V:  4.780 ct: -0.625  51/ 51  1%  1% 152.8% 50 0 1%

           ************************************************
           **** 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.

A:  20.5 V:  16.9 A-V:  3.552 ct: -1.253 109/109  1%  1% 104.1% 97 0 1%
Exiting... (Quit)



More information about the MPlayer-users mailing list