20

I find the command line documentation a little overwhelming, given that I know almost nothing about codecs and the like...

So the following is exactly what I'm doing in VLC (1.1.11) and it would be great to know what the exact command line equivalent of this would be:

  • in Media -> Convert/Save
    • add a file and click on Convert/Save
    • add the name of the destination file
  • in Settings -> Profile
    • select "Audio - MP3"
  • click Start

3 Answers 3

33

Short answer

vlc -I dummy input.wav ":sout=#transcode{acodec=mpga,ab=192}:std{dst=output.mp3,access=file}" vlc://quit

This will transcode input.wav and save the result in output.mp3. ab=192 is the audio bitrate of the output file.

Long answer

If you want to find out the corresponding command line of a VLC conversion initiated from the GUI, you can do this:

  1. From a terminal/console, start vlc like this vlc -vv
  2. Start a conversion in the VLC GUI as normal.
  3. Scroll back in the console history and find the line starts with qt4 interface debug: Transcode MRL:
  4. The rest of that line contains the corresponding vlc command line parameter.

Note: My version of VLC is 2.1.0-git Rincewind and I'm on Linux...

5
  • Great Answer thanks a lot. Is it possible that some parts of the command (mpga,bitrate) from the short answer are dependent on the input-file (other than the name of course)? Since I do get a different result than when doing it within the Gui: your command -> ~60MB, GUI -> ~40MB. Actually I do it just to reindex an mp3-file so it's an mp3-to-mp3-"conversion", so your solution would work for me, but it could be interesting for people searching for this. I'm on windows tried to get the long answer to work in the command line and in cygwin but didn't get any output in the console. Feb 17, 2012 at 2:12
  • acodec and ab does not care about the input file. However, the input file must have an audio track for these to be effective. By default, the GUI transcodes to MP3 with 128 kb/s bitrate. With my command, you had 192 kb/s as bitrate. 60 / 40 = 192 / 128.
    – joctee
    Feb 17, 2012 at 9:21
  • What did you mean with reindexing an mp3-file?
    – joctee
    Feb 17, 2012 at 9:31
  • Awesome thanks for the explanation. What I mean with reindexing based on a users point of view is trying to solve the following: Arbitrary access of specific time points doesn't work with the original, e.g. I'm playing it in my MP3-Player try to repeat the last few seconds and it might actually go forward. You hear sth. at 45 minutes 30 seconds but when you manually fast-forward so that 45 min. 30sec is displayed it is at a completely different point. I don't have this with other mp3s only from a certain source and doing this conversion solves it. Feb 18, 2012 at 0:23
  • Jennifer: Feel free to accept my answer if you are satisfied with it. :)
    – joctee
    Jan 7, 2013 at 17:53
13

I tried following the other answer in windows, but I couldn't get the logging to work correctly on the command line, so here is what I did:

METHOD 1

I was able to use VLC's internal logging window to see it:

Open VLC, go to Tools -> Messages

Set Verbosity to 2 (Debug)

Then do your conversion, and everything will be logged in the messages window. Do a search for "sout=#transcode" or "qt4 debug" to find the line with the conversion settings.

Source

METHOD 2

Instead of looking at the log, you can view the profile directly. If you want to use custom settings, just create a new profile of the settings you want.

The profiles (custom and built in) are stored in an ini file, located at

%AppData%\vlc\vlc-qt-interface.ini

for me this is

C:\Users\chiliNUT\AppData\Roaming\vlc\vlc-qt-interface.ini

The profiles are located under the section called

[codecs-profiles]

Source

A sample from my file is:

[codecs-profiles]
1\Profile-Name=Video - VP80 + Vorbis (Webm)
1\Profile-Value="video_enable=yes;video_codec=VP80;vcodec_bitrate=2000;vcodec_framerate=0;vcodec_width=0;vcodec_height=0;audio_enable=yes;audio_codec=vorb;acodec_bitrate=128;acodec_channels=2;acodec_samplerate=44100;muxer_mux=webm"
2\Profile-Name=Video - H.264 + MP3 (TS)
2\Profile-Value="audio_enable=yes;audio_codec=mpga;acodec_bitrate=128;acodec_channels=2;acodec_samplerate=44100;video_enable=yes;video_codec=h264;vcodec_bitrate=800;vcodec_qp=0;vcodec_framerate=0;vcodec_width=0;vcodec_height=0;muxer_mux=ts"

...and there are 22 more. My custom profiles are at the bottom.

Using Windows 7 Ultimate SP1, VLC 2.1.3 Rincewind

2

While the above answers where useful in helping me arrive at an answer to the question, they did not work as perhaps because they do not work on Windows (10) or VLC has since been updated to accept different switches. In particular, I will expand upon joctee's answer

vlc -I dummy input.wav ":sout=#transcode{acodec=mpga,ab=192}:std{dst=output.mp3,access=file}" vlc://quit

Here -I dummy runs vlc without showing the GUI and vlc://quit closes vlc once the conversion is complete.

On Windows 10, running 3.0.12 I need to run the following command (simplified).

vlc input --sout="[TRANSCODECOMMAND"]

Where input is the input file name and output is sout capture from the debugger.

Full example, in my case to convert an MP3 to a WAVE file:

vlc _AI_NylStr_MonRibb_Sft-G2-0.mp3 --sout="#transcode{vcodec=none,acodec=s16l,ab=160,channels=2,samplerate=44100,scodec=none}:std{access=file,mux=wav,dst=_AI_NylStr_MonRibb_Sft-G2-0-44100k.wav}" vlc://quit

Additionally, to capture the "sout" command, in the VLC GUI go to Tools -> Messages and change Verbosity to 2 as descibed by chiliNUT and run the conversion in the GUI.

This gave the following debug output in the first 3 lines.

qt debug: MRL(s) passed to the Sout: 1
qt debug: MRL(s) passed to the Sout: file:///C:/Users/alexh/source/repos/WaveEditor/WaveEditor/bin/Debug/samples/_AI_NylStr_MonRibb_Sft-A2-0.mp3
qt debug: Transcode MRL: sout=#transcode{vcodec=none,acodec=s16l,ab=160,channels=2,samplerate=44100,scodec=none}:std{access=file{no-overwrite},mux=wav,dst='C:/Users/alexh/source/repos/WaveEditor/WaveEditor/bin/Debug/samples/_AI_NylStr_MonRibb_Sft-A2-0.wav'}

From that output copy everything from #transcode to the end of the line and pass it as the parameter to --sout[TranscodeParameter].

From the above example [TranscoderPameter]

#transcode{vcodec=none,acodec=s16l,ab=160,channels=2,samplerate=44100,scodec=none}:std{access=file{no-overwrite},mux=wav,dst='C:/Users/alexh/source/repos/WaveEditor/WaveEditor/bin/Debug/samples/_AI_NylStr_MonRibb_Sft-A2-0.wav'

So the full argument is:

--sout="#transcode{vcodec=none,acodec=s16l,ab=160,channels=2,samplerate=44100,scodec=none}:std{access=file,mux=wav,dst=_AI_NylStr_MonRibb_Sft-G2-0-44100k.wav}"

Note you can use relative path names if working in a different directory and run vlc using the full path to the executable.

"C:\Program Files\VideoLAN\VLC\vlc.exe" _AI_NylStr_MonRibb_Sft-G2-0.mp3 --sout="#transcode{vcodec=none,acodec=s16l,ab=160,channels=2,samplerate=44100,scodec=none}:std{access=file,mux=wav,dst=_AI_NylStr_MonRibb_Sft-G2-0-44100k.wav}" vlc://quit

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .