Jun 04

Convert YouTube videos to mp4 (m4a) audio-only without transcoding

Category: Linux   — Published by goeszen on June 4, 2012 at 3:07 pm

Most formats on YouTube already contain AAC audio. Thus it is possible to convert the videos you downloaded from YouTube (for example with the YouTube Video Download GreaseMonkey Plug-In) to audio-only files without transcoding (!) the audio once again (=preserving quality).

$ ffmpeg -i "<input file>" -vn -acodec copy -metadata title="<Title>" -metadata artist="<Artist>" -metadata comment="Ripped from YouTube video http://www.youtube.com/watch?v=<some id>" <output>.m4a

The above command extracts audio-only (video= none, -vn) and copies everything into an mp4 container, as ffmpeg currently can only set metadata on mp4 but not on aac directly.

The command also adds the metadata fields so your player shows the title and artist nicely.

Leave a Reply

=