Download audio (wav) from YouTube videos

PHOTO EMBED

Thu Aug 25 2022 17:29:51 GMT+0000 (UTC)

Saved by @edubrigham #ffmpeg #audio #wav #convert

from IPython.display import YouTubeVideo


YOUTUBE_ID = 'xxxxxxxxxxxx'
YouTubeVideo(YOUTUBE_ID)

!rm -rf *.wav
!youtube-dl --extract-audio --audio-format wav --output "downloaded.%(ext)s" https://www.youtube.com/watch\?v\={YOUTUBE_ID}
!ffmpeg -loglevel panic -y -i downloaded.wav -acodec pcm_s16le -ac 1 -ar 16000 {project_name}/test.wav
content_copyCOPY