Converting with the Sout Chain
Outcome: you have converted a video to a different format and pulled the sound out of one as an MP3 — both results probed and measured — and you can read a sout chain the way chapter 2 promised: as a sentence.
Everything here is chapter 2's one
idea put to work. To convert, VLC
plays the file not to a screen but
into a --sout chain whose last link
writes a new file. The command shape is
always:
cvlc -I dummy INPUT --sout 'CHAIN' vlc://quit
-I dummy keeps it windowless;
vlc://quit is a final playlist item
that makes the player stop when the
real work ends instead of sitting open.
The worked conversion: MP4 to WebM
The lab's input, from chapter 4:
parade.mp4, H.264 video 640×360 with
AAC stereo audio, 12.0 seconds,
950,997 bytes. The goal: a smaller
WebM for a web page — VP8 video at half
size, Vorbis audio. The chain:
cvlc -I dummy parade.mp4 \
--sout '#transcode{vcodec=VP80,vb=700,scale=0.5,acodec=vorbis,ab=96}:std{access=file,mux=webm,dst=parade.webm}' \
vlc://quit
Read it as chapter 2 taught: transcode
the video to codec VP80 at 700
kilobits, scaled to 0.5; the audio to
Vorbis at 96; then the standard output
writes it to a file, wrapped (mux) as
WebM. Every word of that vocabulary is
the transcode module's own — cvlc -p
transcode prints the full list
(transcript t09), including the
encoders this build offers.
And the proof is a probe of what came
out, not the command finishing
(transcript t03):
| Before | After | |
|---|---|---|
| Container | MP4 | WebM |
| Video | H.264, 640×360 | VP8, 320×180 |
| Audio | AAC stereo | Vorbis stereo, 44.1 kHz |
| Duration | 12.000 s | 11.906 s |
| Size | 950,997 bytes | 1,074,499 bytes |
Two honest readings. The duration is
0.09 seconds shorter — the last frames
against the encoder's rounding; a
conversion that promises you the exact
same length is rounded somewhere, and
probing shows where. And the file got
bigger despite being half the size:
VP8 at a 700-kilobit target spends
more bits than the H.264 original
used in total — about 630 kilobits a
second, audio included — on a test
pattern full of hard edges. Bitrate targets are
ceilings the encoder aims near, not
sizes it promises, and vb is the
number to lower when the goal is a
smaller file rather than a different
format. The run also printed complaints
about PulseAudio and D-Bus failing to
connect — chapter 13 explains why those
lines are furniture, not failures: the
conversion ran the full 12 seconds and
the probe is the verdict.
Pulling the sound out: audio extraction
The same sentence with the video told to keep none of itself:
cvlc -I dummy parade.mp4 \
--sout '#transcode{vcodec=none,acodec=mp3,ab=128}:std{access=file,mux=raw,dst=parade-audio.mp3}' \
vlc://quit
Result, probed (transcript t04): an
MP3, stereo at 44.1 kHz, 128 kilobits
as ordered, 11.97 seconds, 191,550
bytes — the fixture's tone, alone. This
is the move for a video whose value is
its sound: a lecture, a meeting, a
concert clip.
Two findings came with it, both left in the transcript because readers will meet them:
- The error that isn't. The run
printed
cannot find video encoder (module:any fourcc:none),cannot create video chainand evenbuffer deadlock prevented— and then wrote a complete, correct MP3. Telling the transcode no video codec at all makes the video chain fail loudly and pointlessly before the audio chain proceeds. The output file, probed, is the verdict; chapter 13 says more. - Your tags do not come along. The
input carried title and artist
metadata (
Fixture Parade,VLC Lab— probe int04); the MP3 carries none. This route copies no tags. If the destination needs its title and artist, a tagging tool writes them afterwards — the ffmpeg guide in this series covers writing metadata directly, and its stream-copy extraction is also the better tool when the audio is already in the format you want and no re-encoding is needed at all.
Converting in the window
The graphical route exists and is the same machinery: Media → Convert/Save, add the file, Convert, choose a profile (the built-in ones are named for their targets — Video – H.264 + MP3 (MP4) and kin), set the destination, Start. The profiles are sout chains wearing names; the window writes nothing you could not write by hand after this chapter, and the chain stays the scriptable form — the one chapter 11 turns into a folder-at-a-time recipe.