If one downloads videos from YouTube using youtube-dl, they get .mp4 files which are a ISO Media, MPEG v4 system, version 2.

Can these files be converted to audio-only, ideally with no quality loss?
The goal is to save space by throwing out the unneeded visual part.


You can convert to audio only formats using youtube-dl itself, although it still downloads the video and then converts it.

To do this, use -x or --extract-audio to the command, for example:

youtube-dl -x 'http://www.youtube.com/watch?v=0iyeUcFKRv4&feature=c4-overview&list=UU1KPy3cAAj0i0RIFC_SzjMg'
  • "youtube-dl -f bestaudio <url>" also works – nwgat Feb 22 '16 at 21:23

You can convert existing downloaded files using ffmpeg from the command-line

ffmpeg -i "input file.mp4" -acodec copy "output file.aac"

The "acodec copy" part is the bit that doesn't change the audio stream.


enter image description here

YouTube Center is excellent user script, which works accross browsers, doesn't involve bloating your OS with ton of Youtube downloaders unless you're a strictly 320 kbps person for your audio files. Besides, you have Handbrake at your disposal which involves bit of a manual work but will do exactly what you want. :)


A command line alternative to download and immediately convert to a desired format is to send a file downloaded with cclive Install cclive to avconv with the cclive option --exec.


  1. Download video, then extract the audio track to keep the original encoding:

    cclive -f best <videolink> --exec "avconv -i '%n' -acodec copy <name>.<extension>"
    • needs <extension> to be in the same format as the source audio format (e.g. aac)
  2. Download video, then convert audio to mp3 (or any other supported audio codec):

    cclive -f best <videolink> --exec "avconv -i '%n' -acodec lbmp3lame -b:a 256k <name>.mp3"
    • will download and convert to 256 kb/s mp3.
  3. Download video, copy audio, and delete video:

    cclive -f best <videolink> --exec "avconv -i '%n' -acodec copy <name>.aac" --exec "rm '%n'"
    • will delete the downloaded video after audio extraction.

We are quite versatile to convert to any audio codec avconv can encode, and this will also work on download sites other than YouTube.

Note for cclive >= 0.7.12 in Ubuntu >= 13.10:
Option -f was replaced by option -s. Give option -s best for best available encoding, -s <ID> for any other encoding as can be listed with cclive -S <URL>.


youtube-dl --help explains how:

  Post-processing Options:
    -x, --extract-audio              convert video files to audio-only
                                     files (requires ffmpeg or avconv and
                                     ffprobe or avprobe)
    --audio-format FORMAT            "best", "aac", "vorbis", "mp3", "m4a",
                                     "opus", or "wav"; best by default
    --audio-quality QUALITY          ffmpeg/avconv audio quality
                                     specification, insert a value between
                                     0 (better) and 9 (worse) for VBR or a
                                     specific bitrate like 128K (default 5)

Also look at my answer here which describes how to download just the audio instead of first downloading the video+audio and then discarding the video which is just wasteful.

Not the answer you're looking for? Browse other questions tagged or ask your own question.