Option -endpos fails with stream sources
Hello, I'm new to this list and joined since I cannot find out the source of the following problem. I already searched extensively through the list archives and other sources and tried mplayer versions up to 1.0_rc2_p24929 without success (on Gentoo Linux). I want to decode an audio stream and write it to a file. Nothing magic. This works: mplayer -vc null -vo null -ao pcm:file=file.wav http://sky:28401 This doesn't: mplayer -vc null -vo null -ao pcm:file=file.wav -endpos 10 http://sky:28401 (sky is my local streaming server.) While the first runs and writes file.wav until I manually quit mplayer (or the stream finishes), the second always looks like this: ************ snip radio@einstein ~ $ mplayer -vc null -vo null -ao pcm:file=file.wav -endpos 10 http://sky:28401 MPlayer dev-SVN-rUNKNOWN-4.1.2 (C) 2000-2007 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 Compiled for x86 CPU with extensions: MMX MMX2 SSE Playing http://sky:28401. Resolving sky for AF_INET... Connecting to server sky[192.168.20.44]: 28401... Cache size set to 320 KBytes Cache fill: 12.50% (40960 bytes) Win32 LoadLibrary failed to load: avisynth.dll, /usr/lib/win32/avisynth.dll, /usr/local/lib/win32/avisynth.dll TS file format detected. NO VIDEO! AUDIO MPA(pid=111) NO SUBS (yet)! PROGRAM N. 28401 Stream not seekable! ========================================================================== Opening audio decoder: [mp3lib] MPEG layer-2, layer-3 AUDIO: 48000 Hz, 2 ch, s16le, 320.0 kbit/20.83% (ratio: 40000->192000) Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3) ========================================================================== [AO PCM] File: file.wav (WAVE) PCM: Samplerate: 48000Hz Channels: Stereo 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] 48000Hz 2ch s16le (2 bytes per sample) Video: no video Starting playback... A:85962.7 (23:52:42.7) of -0.3 (unknown) ??,?% 0% Exiting... (End of file) radio@einstein ~ $ ls -l file.wav -rw-r--r-- 1 radio audio 65580 2007-12-13 17:01 file.wav ************ snap It doesn't matter if you specify 10 seconds or an hour (01:00:00) with -endpos, same result each time. I'd simply like mplayer to decode the stream and write the file for a defined time period, and then exit. Thanks for any help! Maik
Hello, On Fri, Dec 14, 2007 at 04:02:55PM +0100, Maik Musall wrote: [...]
This doesn't: mplayer -vc null -vo null -ao pcm:file=file.wav -endpos 10 http://sky:28401
Actually it does, just not as you expect:
Video: no video Starting playback... A:85962.7 (23:52:42.7) of -0.3 (unknown) ??,?% 0%
You told MPlayer to stop at 10 seconds, but the stream is already at 85962.7 seconds. Try starting MPlayer on that stream, note the number after A:, add maybe 60 and see if an mplayer started with that as -endpos stops at the "expected" time. [...]
I'd simply like mplayer to decode the stream and write the file for a defined time period, and then exit.
Try something like this in a script: mplayer -noconsolecontrols <other options and URL> & PID=$! sleep 10 kill $PID sleep 3 kill -9 $PID Greetings, Reimar Döffinger
Hello Reimar, On Fri, Dec 14, 2007 at 06:24:16PM +0100, Reimar Döffinger wrote:
Video: no video Starting playback... A:85962.7 (23:52:42.7) of -0.3 (unknown) ??,?% 0%
You told MPlayer to stop at 10 seconds, but the stream is already at 85962.7 seconds. Try starting MPlayer on that stream, note the number after A:, add maybe 60 and see if an mplayer started with that as -endpos stops at the "expected" time.
Yes, you're right, that works. Unfortunately, I don't know the stream position before starting mplayer. Something like a possible syntax "-endpos +10" would be nice.
[...]
I'd simply like mplayer to decode the stream and write the file for a defined time period, and then exit.
Try something like this in a script:
mplayer -noconsolecontrols <other options and URL> & PID=$! sleep 10 kill $PID sleep 3 kill -9 $PID
Yes, that's my current approach, but it makes everything a bit more complicated than I'd like it to be. Thanks anyway. Maik
participants (2)
-
Maik Musall -
Reimar Döffinger