mplayer doesn't play some asf files
I use mplayer to record streaming audio and save the streams by:
mplayer -dumpstream http://server-address:[port] -dumpfile stream-1000.asf
I usually don't have any problems, but sometimes mplayer might get killed unexpectedly, or terminate the process due to network errors. In short, sometimes the asf files are not closed properly.
When I try to listen those incomplete asf files via mplayer, I get an error message complaining about unknown audio format so I suspect the problem is with the asf headers.
If I try to open the same asf files using amarok however, they play just fine. I'm wondering how I can force mplayer to fix the broken headers(if that's really the case), or ignore the errors and use a specific driver/decoder.
I'm pasting the error messages below. Thanks in advance.
what distro? If it is Debian try using mplayer and ffmepg from the debian-multimedia.org repo as the versions in the "official" repos are crippled due to licensing issues. Might want to try updating your mplayer as well.
MPlayer dev-SVN-r26940 looks rather old. Also check what video and audio codecs you have mplayr using.
Mine says MPlayer SVN-r31128 (C) 2000-2010 MPlayer Team
$ apt-cache policy mplayer
*** 2:1.0~rc3+svn20100503-0.0 0
500 http://www.debian-multimedia.org unstable/main Packages
my mplayer gui.conf
You have a number of initial complaints that have options to disable to not get those complaints. Which you could pass every time that you run mplayer or put into /etc/mplayer/mplayer.conf. Stuff like -nolirc and the likes. More or less cosmetic, but it can help make the application launch faster. At a minimum lower the stdout content to make it easier to find relevant information quicker.
$ mplayer -list-options | grep -i "^\ no"
-nolirc -nolircc -nojoystick
maybe even -vo null if you don't want to actually watch it at the point of capture. It seems to be trying to use -vo dfbmga or something and settling on something else. mplayer -vo help to list your options which could be dependent on where/how your version of mplayer was compiled.
You might try breaking -dumpstream into it's parts. -dumpaudio and -dumpvideo. Although I'm not sure how / if that'll work simultaneously. But with -dumpaudio you can specify -dumpfile which makes audio headers where there might otherwise be none. Or you might be able to edit the file in post to fix the issue.
$ mplayer <FILE> -dumpaudio -dumpfile something.raw
$ ffmpeg -i <FILE> -vn -acodec copy something.raw
$ sox -t raw --endian little -s -2 -c 2 -r 48000 something.raw something.wav
The parameters of which might vary depending on what format the source is. aplay is semi-good at helping you figure that out in a trial and error sort of way.
$ aplay -t wav -f S16_LE -c 2 -r 48000 something.raw
there's even a few shortcuts for common types
$ aplay -f cd something.raw
$ aplay -f dat something.raw
Although more about editing than what you're probably looking for. You might try a script with named pipes to use another encoder and just use mplayer as the decoder. If you're going to archive the stuff in a format other than what is broadcast it could save you a step in post. And might also be a workaround for when mplayer fails as the encoder will see the end of input and finish the file semi-properly. Semi only because the lengths of audio and video might not match. A bit cpu needy if you have an older computer, but most newer ones 3GHz + multiple cores should do fine. And there's a few codecs that don't require a lot of cpu horsepower (relatively). Although dumping straight to file is generally the cheapest in terms of system resources.
Thanks both for the replies. I tried to play the same files on my laptop (Ubuntu 10.04) with "MPlayer SVN-r1.0~rc3+svn20090426-4.4.3" and it worked. However, I do all of the recordings on my office PC (Debian), and I don't have root control so I can't update using the debian-multimedia.org repo.
I'm wondering how Amarok can play them, probably because it is using a different codec. Can I just locate those codecs and use them with mplayer by the --codecs-file option?
I ended up installing the nightly build from the official mplayer web page under a local directory I have write access. It was probably a codec issue due to some repos being crippled as craigevil pointed out.
-- Update 2--
I found the following post in the mplayer mailing list archives from five years ago very helpful:
In case it becomes unavailable, adding the "-aid 0" option solved the problem.
|All times are GMT -5. The time now is 02:38 AM.|