Page 1 of 1

convert WMV video to MP3 audio file via command line

Posted: 28 Jan 2014 02:43
by johnpank
I'm tying to use the following command to convert a WMV video to MP3 audio file and it is failing:
vlc -I dummy "f:\tmp\x.wmv" --sout=#transcode{acodec=mp3,vcodec=dummy}:standard{access=file,mux=raw,dst="F:\tmp\x.mp3"}

I found this command online and did not build it myself. It was supposedly working for WMA, AAC, OGG and M4A files. I am trying to convert the WMV file.

When I run it, another command window flashes briefly and disappears and I do not know how to see the error messages.

Can you suggest an alternative? Thanks for any help.

Re: convert WMV video to MP3 audio file via command line

Posted: 28 Jan 2014 23:33
by johnpank
I realize now that the command I was using is only for converting an audio file to another audio format. I found the wiki page on extracting the audio from a video file. I tried this command to just extract the audio, but still with no success:

vlc "f:\tmp\x.wmv" --no-sout-video --sout-audio --no-sout-rtp-sap --no-sout-standard-sap --ttl=1 --sout-keep --sout=#standard{access=file,mux=raw,dst="F:\tmp\xwmv.wma2"}

The WMV file contains a WVC1 video stream and a WMA2 stereo audio stream.

Any ideas on just extracting the audio? I'd prefer a command to convert directly to MP3, but if need be, I would do it in two steps.

Re: convert WMV video to MP3 audio file via command line

Posted: 29 Jan 2014 18:47
by bat999
The WMV file contains a WVC1 video stream and a WMA2 stereo audio stream.
Any ideas on just extracting the audio? I'd prefer a command to convert directly to MP3, but if need be, I would do it in two steps.
Hi
To convert to mp3 the command should be something like this:-

Code: Select all

vlc "f:\tmp\x.wmv" -I dummy -vvv --sout="#transcode{vcodec=none,acodec=mp3,ab=128,channels=2,samplerate=44100}:std{access=file,mux=dummy,dst='F:\tmp\x.mp3'}" vlc://quit
But maybe your version of VLC has been built without an mp3 encoder. :x

If mp3 fails, check that the command converts OK with ogg like this:-

Code: Select all

vlc "f:\tmp\x.wmv" -I dummy -vvv --sout="#transcode{vcodec=none,acodec=vorb,ab=128,channels=2,samplerate=44100}:std{access=file,mux=ogg,dst='F:\tmp\x.ogg'}" vlc://quit
To extract the wma2 audio track, use a command like this:-

Code: Select all

vlc "f:\tmp\x.wmv" -I dummy -vvv --sout="#transcode{vcodec=none}:std{access=file,mux=asf,dst='F:\tmp\x.wma'}" vlc://quit

Re: convert WMV video to MP3 audio file via command line

Posted: 30 Jan 2014 04:52
by johnpank
Thanks a lot, bat999! Your last two commands worked perfectly (to convert to OGG and to extract the WMA).
But the one to convert directly to MP3 did not work. I got the message box "Ooops VLC media player has crashed ...."
I can convert the OGG file directly to MP3 with no problem, using the following command, so I appear to have the right codecs.

Code: Select all

vlc "f:\tmp\x.ogg" --sout=#transcode{acodec=mp3,vcodec=dummy}:standard{access=file,mux=raw,dst="F:\tmp\x.mp3"}
But if I try to use this command to convert the WMA file to MP3, I also get the error "Ooops VLC media player has crashed ...."

I notice that that your command to convert to MP3 has "mux=dummy", whereas the one for OGG has "mux=ogg". Is this correct?

My debugging is made very difficult by the fact that each command that I enter pops up another command prompt to run it, which then disappears quickly when finished. Is there a way to have the VLC command execute in the command prompt window that I am running it in? I can't even see the output of "vlc --help", because of this behavior.

Re: convert WMV video to MP3 audio file via command line

Posted: 30 Jan 2014 15:50
by bat999
I notice that that your command to convert to MP3 has "mux=dummy", whereas the one for OGG has "mux=ogg". Is this correct?
Yes :)

If you're going to convert the wmv file to mp3 in 2 jumps, it's better to use wav instead of ogg.
Like this:-

Code: Select all

vlc "f:\tmp\x.wmv" -I dummy -vvv --sout="#transcode{vcodec=none,acodec=s16l,channels=2,samplerate=44100}:std{access=file,mux=wav,dst='F:\tmp\x.wav'}" vlc://quit
Then this:-

Code: Select all

vlc "f:\tmp\x.wav" -I dummy -vvv --sout="#transcode{vcodec=none,acodec=mp3,ab=128,channels=2,samplerate=44100}:std{access=file,mux=dummy,dst='F:\tmp\x.mp3'}" vlc://quit

Re: convert WMV video to MP3 audio file via command line

Posted: 30 Jan 2014 19:41
by johnpank
Bat999, thanks again! Those commands work just as you have them. It would be nice to have a single step but doing it in two steps is fine.

Edited Correction: I lose all the ID3 tags by converting to WAV in the two steps, so I do need to find out how to go from WMV to MP3 in one step.

Re: convert WMV video to MP3 audio file via command line

Posted: 13 Apr 2023 22:48
by senglory
To extract the wma2 audio track, use a command like this:-

Code: Select all

vlc "f:\tmp\x.wmv" -I dummy -vvv --sout="#transcode{vcodec=none}:std{access=file,mux=asf,dst='F:\tmp\x.wma'}" vlc://quit

Used this command with "vlc://quit" at the end - VLC just exits and produces a zero-length WMA file. What did I do wrong?

Re: convert WMV video to MP3 audio file via command line

Posted: 14 Apr 2023 09:51
by Lotesdelere
To extract the wma2 audio track, use a command like this:-

Code: Select all

vlc "f:\tmp\x.wmv" -I dummy -vvv --sout="#transcode{vcodec=none}:std{access=file,mux=asf,dst='F:\tmp\x.wma'}" vlc://quit

Used this command with "vlc://quit" at the end - VLC just exits and produces a zero-length WMA file. What did I do wrong?

Looks like you didn't specify any audio codec.

Re: convert WMV video to MP3 audio file via command line

Posted: 14 Apr 2023 10:39
by senglory


Looks like you didn't specify any audio codec.
Nope, if I use this cmd line

Code: Select all

vlc.exe "GPID.webm" -I dummy -vvv --sout="#transcode{vcodec=none,acodec=mp3,ab=128,channels=2,samplerate=44100}:std{access=file,mux=dummy,dst='C:\Users\sengl\Videos\GPID.mp3'}"
I get the MP3 file, but VLC still hang in memory for a while instead of quitting after finishing. But if I add vlc://quit, I get the MP3 file of zero size. What should I change in my cmd line to have VLC quitting upon finishing working on this conversion?

Re: convert WMV video to MP3 audio file via command line

Posted: 15 Apr 2023 10:26
by Lotesdelere
mux=raw

Re: convert WMV video to MP3 audio file via command line

Posted: 15 Apr 2023 11:40
by senglory
mux=raw
Thanks, works like a charm!

Re: convert WMV video to MP3 audio file via command line

Posted: 12 Jul 2023 22:25
by senglory
I'm getting back with converting to MP3. For most of WebM files my VLC with this command

Code: Select all

vlc.exe "1.webm" -I dummy -vvv --sout="#transcode{vcodec=none,acodec=mp3,ab=128,channels=2,samplerate=44100}:std{access=file,mux=raw,dst='C:\Users\user\Videos\1.mp3'}" vlc://quit
creates an MP3 file successfully. But from time to time I get a zero-length 1.mp3 file. What should I do to get a correctly converted WMV file here?