How can I make the following conversion in VLC from the commandline?

13

4

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

Jennifer Owens

Posted 2012-02-10T20:36:16.017

Reputation: 231

Answers

22

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...

joctee

Posted 2012-02-10T20:36:16.017

Reputation: 321

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. – Jennifer Owens – 2012-02-17T02:12:06.637

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 – 2012-02-17T09:21:45.003

What did you mean with reindexing an mp3-file? – joctee – 2012-02-17T09:31:56.393

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. – Jennifer Owens – 2012-02-18T00:23:00.107

Jennifer: Feel free to accept my answer if you are satisfied with it. :) – joctee – 2013-01-07T17:53:27.743

9

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

chiliNUT

Posted 2012-02-10T20:36:16.017

Reputation: 610