- Install
youtube-dl
via Homebrew. Don't have Homebrew? Follow the easy one-step instructions here) - Install
ffmpeg
via Homebrew. - Execute the following command to determine available formats to download as:
youtube-dl -F [link to video]
- Select format type and execute:
youtube-dl -f [format] [link to video]
- You now have a downloaded (and automatically-converted-to standard-m4a rip)
- For an MP3 version execute:
ffmpeg -i [input].m4a -acodec libmp3lame -ab [bit rate] [output].mp3
- Done
Note: If your M4A file isn't converted from DASH automatically (this is why you need to install ffmpeg
) then execute the following to convert:
ffmpeg -i [input].m4a -vn -c:a copy [output].m4a
- The command is:
youtube-dl -F [link to video]
- So we substitute
[link to video]
withhttps://www.youtube.com/watch?v=vm_oV72tufE
- The result is
youtube-dl -F https://www.youtube.com/watch?v=vm_oV72tufE
Execute the above command and record the number next to the format you want, in this case 141
for 257k DASH audio only.
tsujp @babo 0/ Desktop % youtube-dl -F https://www.youtube.com/watch?v=vm_oV72tufE
[youtube] vm_oV72tufE: Downloading webpage
[youtube] vm_oV72tufE: Extracting video information
[youtube] vm_oV72tufE: Downloading DASH manifest
[info] Available formats for vm_oV72tufE:
format code extension resolution note
171 webm audio only DASH audio 120k , audio@128k (44100Hz), 3.01MiB
140 m4a audio only DASH audio 131k , m4a_dash container, aac @128k (44100Hz), 3.68MiB
141 m4a audio only DASH audio 257k , m4a_dash container, aac @256k (44100Hz), 7.30MiB
160 mp4 256x144 DASH video 110k , 12fps, video only, 3.13MiB
278 webm 256x144 DASH video 114k , webm container, VP9, 12fps, video only, 2.75MiB
133 mp4 426x240 DASH video 248k , 24fps, video only, 7.03MiB
242 webm 426x240 DASH video 274k , 24fps, video only, 6.79MiB
243 webm 640x360 DASH video 494k , 24fps, video only, 12.51MiB
134 mp4 640x360 DASH video 611k , 24fps, video only, 16.86MiB
244 webm 854x480 DASH video 911k , 24fps, video only, 22.45MiB
135 mp4 854x480 DASH video 1119k , 24fps, video only, 30.91MiB
247 webm 1280x720 DASH video 1838k , 24fps, video only, 44.62MiB
136 mp4 1280x720 DASH video 2234k , 24fps, video only, 61.71MiB
248 webm 1920x1080 DASH video 3295k , 24fps, video only, 79.19MiB
137 mp4 1920x1080 DASH video 4233k , 24fps, video only, 115.81MiB
17 3gp 176x144
36 3gp 320x240
5 flv 400x240
43 webm 640x360
18 mp4 640x360
22 mp4 1280x720 (best)
The command for this step is the same except for the lower case f; -F
becomes -f
and the special number after the lower case f is closed with the same YouTube url as before.
The command becomes:
youtube-dl -f 141 https://www.youtube.com/watch?v=vm_oV72tufE
ffmpeg
will automatically convert this from DASH m4a to standard-m4a for us, the output should resemble this:
tsujp @babo 0/ Desktop % youtube-dl -f 141 https://www.youtube.com/watch?v=vm_oV72tufE
[youtube] vm_oV72tufE: Downloading webpage
[youtube] vm_oV72tufE: Extracting video information
[youtube] vm_oV72tufE: Downloading DASH manifest
[download] Destination: 박재범 JAY PARK - ON IT (Feat.DJ WEGUN) Prod.by GRAY-vm_oV72tufE.m4a
[download] 100% of 7.30MiB in 00:05
[ffmpeg] Correcting container in "박재범 JAY PARK - ON IT (Feat.DJ WEGUN) Prod.by GRAY-vm_oV72tufE.m4a"
Note: The last line there is the automatic conversion.
You're almost done! For the MP3 version just plug in the name of the input file (the .m4a
you downloaded) and the ouput name you want.
In my case:
ffmpeg -i [input].m4a -acodec libmp3lame -ab [bit rate] [output].mp3
becomes
ffmpeg -i input.m4a -acodec libmp3lame -ab 256k output.mp3
The two reasons behind this:
-
I used
input.m4a
andoutput.mp3
as actual file names to keep things simple. -
Remember at the start when we selected
141
? You can see on the same row it tells us the quality of the audio:@256k (44100Hz)
. MP3 comes sampled at a few common bit-rates,320
,256
, and128
. In this case it matches (to 256) so we simply select that. There's no point encoding320
if that information never existed in the first place.- If the quality was say..
@290
or above I'd select 320.
- If the quality was say..