Remove video / Extract audio from Ogg Theora Video to Ogg Vorbis

2

1

I have some songs that are in .ogg format but they also contain video (which just shows the album cover the whole song, if played in a video player). How can I losslessly remove the video part of the files? The audio format is already Vorbis encoded with Lavc56.60.100 libvorbis. Hopefully the solution doesn't include re-encoding the file with ffmpeg/avconv..

ZN13

Posted 2017-06-13T20:19:19.357

Reputation: 392

Answers

3

Oh, apparently there's a tool for this called oggz-rip, I believe the package name is either liboggz or oggz-tools depending on your distro.

To extract audio from a .ogv file you just:

oggz-rip -c vorbis input_video.ogv > output_audio.ogg

Or if you just want video and no audio:

oggz-rip -c theora input_video.ogv > output_video.ogv

(alternatively, the command could be oggzrip rather than oggz-rip, depending on your distro.)

ZN13

Posted 2017-06-13T20:19:19.357

Reputation: 392

3

If you want to use FFmpeg (for example, if you use it regularly and don't want to have countless single-use-applications on your computer), you can use it without re-encoding:

ffmpeg -i input_video.ogv -vn -c:a copy output_audio.ogg

(-vn: no video. -c:a copy: just copy the audio-stream.) Source1

ffmpeg -i input_video.ogv -an -c:v copy output_audio.ogv

(-an: no audio. -c:v copy: just copy the video-stream.) Source1

Or, instad of -vn / -an, you can also specify the streams to copy with -map:

ffmpeg -i input_video.ogv -map 0:0 -c:a copy output_audio.ogg

(Only map first stream (of first input-file) to output) Source2

Note that you can find out the stream number (and its content) via FFmpeg:

ffmpeg -i input_video.ogv -hide_banner

(-hide_banner is not necessary, but the output will be easier on the eye as it doesn't show you the build-infos of FFmpeg.)

flolilo

Posted 2017-06-13T20:19:19.357

Reputation: 1 976

+1 for adding an ffmpeg answer, can you confirm it doesnt re-encode? – ZN13 – 2017-06-13T20:52:48.170

2

Source1 states that "copy [...] indicate[s] that the stream is not to be re-encoded." I use FFmpeg regularly with different file-formats and never saw copy re-encode something - I checked that via CPU- and disk-stats (~ 0% CPU-use and ~ 100% disk-use in comparison to "regular" (re-)encodings) and comparing the outputs directly (eg following http://dericed.com/2012/display-video-difference-with-ffmpegs-overlay-filter/ : ffmpeg -y -i fileA.mov -i fileB.mov -filter_complex '[1:v]format=yuva444p,lut=c3=128,negate[video2withAlpha],[0:v][video2withAlpha]overlay[out]' -map [out] fileA-B.mov)

– flolilo – 2017-06-13T21:35:49.613