A little while ago, I wanted to extract an audio track from a WebM video grabbed on Youtube (NB: jDownloader is a great piece of software to download Youtube videos, apart from the fact that it literally take ages to load). The audio track of most (or maybe even all, I believe WebM is a modified Matroska with support for just VP8 and Vorbis?) WebM videos is in Vorbis, so of course I wanted to extract it into an Ogg container (without re-encoding it in the process).
To do this, I used mkvextract, which is part of MKVToolNix. Unfortunately, no GUI is provided to do what we want (however, with the mkvmerge GUI you can create MKA audio files). But the command line is very simple:
mkvextract tracks [yourWebmFile.webm] 2:[yourOggFile.ogg]
Let’s explain it more in details:
mkvextract
is the program we use. Of course, this is considering that you browsed with the command line to the folder where MKVToolNix is installedtracks
is the instruction we want it to perform (as listed inmkvextract --help
)- then of course, the input file
"2"
means we extract track 2. If your original file has one video and one audio track, the audio track you want will probably be track 2, but that’s not a guarantee. If it’s not, just try other numbers- finally, a column and the output file
thanks for helpful post! btw, video track is 0 and audio is 1 ;]
Hm, I have to admit I only ever tried this on one single file. Probably track number depends on the file, actually. Thanks for the info!
Haha about jDownloader taking for-f**king ever to load. I wish it was a bit lighter, with less features. (I don’t think the automatic link parsing is really necessary, so I just disable that)
#!/bin/bash
# webm-to-ogg; script to extract vorbis from .webm file
# usage: webm-to-ogg TheMovieFile.webm
# requires MKVToolNix
in=$1
track=$(mkvmerge --identify "$in" |grep A_VORBIS)
# example: Track ID 1: audio (A_VORBIS)
track=$(echo "$track" |sed 's/^Track\ ID\ //')
track=$(echo "$track" |sed 's/:.*//')
out=$(echo "$in" |sed 's/\.webm$/\.ogg/')
mkvextract tracks "$in" "$track:$out"
In this line…
track=$(mkvmerge –identify β$inβ |grep A_VORBIS)
…there are supposted to be two dashes before “identify”
Yeah, WordPress tends to mess up dashes… I’ll add a code tag, should fix things up. Thanks for the neat script π