How to save asf/asx/mms audio file to disk (previous suggestions don’t work)

audioffmpegstreamingvlc-media-playerwindows media player

I have been trying to save audio files like the one embedded in http://www.1242.com/ondemand/sugawara/130106sugawara.asx. The ASF file is mms://copper.jolf.jp/1242/sugawara/130106sugawara.asf. I am using Windows 7 and 10 and several different browsers.

In VLC, if I do Open Network Stream then Convert, it says "Streaming" for about a minute, but does nothing, and then says "Your input can't be opened … Check the log for details." The log says "access_mms error: no data received". I have tried Dump Raw Input and that fails too.

If I paste the mms…asf link into IE then the audio file streams in Windows Media Player, but the Save As option in the File menu is greyed out. If VLC is the browser's default plugin then it fails to stream the file.

I found some suggestions at How to rip an asx stream – preferably free but none of them work. Orbit Downloader and SDP both do nothing.

Maybe irrelevant: in Windows Media Player I was able to look at the properties of one of these audio files, and the Media Usage Rights tab said "This file is not protected".

EDITED TO ADD:

I would still like to find an answer to this question. Meanwhile after two months I have made a bit of progress myself.

I guessed that the website might be using RTSP and so I tried using openRTSP in Linux. The following command worked in the sense that it saved a file to my disk. This file (myFile) is 26MB and so I guess it might be the full 26-minute audio file. But I can't work out the file's format and I can't play it in VLC.

openRTSP -a -S 0 -K -n -t rtsp://copper.jolf.jp/1242/sugawara/130106sugawara.asf > myFile

Can anyone help??

Incidentally, with openRTSP it was necessary to use the -K option to keep the connection alive (see here), and for this option to work it was necessary to manually install the most up-to-date version of openRTSP (see here). The version available using apt-get in Ubuntu was no good.

Best Answer

At long last, I worked out how to do it using ffmpeg. The process was: open the http...asx file in a text-editor, copy the mms...asf URL, and replace mms with rtsp. Then pass the URL to ffmpeg:

ffmpeg -rtsp_transport tcp \
-i rtsp://copper.jolf.jp/1242/sugawara/130106sugawara.asf myFile.mp3

This downloads it and converts to an mp3. It works on Ubuntu 16.04 using ffmpeg version 2.8.11-0ubuntu0.16.04.1. Other platforms and versions are probably OK too.

Slowness

Each second of the file/stream takes one second to download, so it is very slow.

Near the end, ffmpeg pauses for several minutes and then continues and finishes properly. With the file/stream above, the downloading always takes 4 minutes and 12 seconds longer than the duration of the file. (Can anyone explain this or how to avoid it?)

I thought it might be possible to avoid the pause by using -stimeout 10000 ("set socket TCP I/O timeout in microseconds"), but that made no difference. You can do -t -27:00 ("stop writing the output after its duration reaches duration") but that doesn't solve the problem.

Here is a way to find the duration of the file without having to stream it:

ffprobe -rtsp_transport tcp \
rtsp://copper.jolf.jp/1242/sugawara/130106sugawara.asf

Other notes

For the reason why -rtsp_transport tcp is necessary, see here.

I recommend using -hide_banner to make the ffmpeg output shorter.

If you want to just save the file without converting, use -codec copy.

At some point I did these commands:

sudo add-apt-repository ppa:mc3man/gstffmpeg-keep 
sudo apt-get update 
sudo apt-get install gstreamer0.10-ffmpeg

But I don't know whether that was necessary. The advice I was following is here; see also here.

I tried libav, which is similar to ffmpeg and has many of the same options. But it was harder to use and doesn't work with the options above.

Why did other solutions not work?

First it was necessary to find the mms URL and replace mms with rtsp.

I think the reason VLC and other applications didn't work was that the file/stream uses a proprietary Windows Media Audio codec that is not available in those applications.

When you stream it in Windows Media Player, the properties say the audio codec is Windows Media Audio V8, but when you use ffmpeg it says it is using the wmav2 codec. It seems that the ffmpeg developers reverse-engineered version 2 and not version 8, but the two versions are compatible.