We can't do this with youtube-dl
alone, we can pair this
with ffmpeg to acomplish this task though. We use youtube-dl
and ffmpeg
to resolve the URL of the video, and then tell ffmpeg
to download the range itself.
So to take a sound byte from this podcast and use it to create my ringtone:
$ audio_url="$(youtube-dl --audio-format mp3 --get-url https://youtu.be/s8tJ-R28HX8 | grep mime=audio | head -n 1)"
$ ffmpeg -ss 02:00:02.10 -i "${audio_url}" -t 00:00:12 -c:a mp3 paul-ringtone.mp3