4 ms·
Is it downloading the whole Youtube video just to pull out the audio? Why not just download the audio to begin with?
by sp332 9y ago
Is it downloading the whole Youtube video just to pull out the audio? Why not just download the audio to begin with?
- rhizome 9y agoBecause it's in the video container.
- mmozeiko 9y agoMost YT videos use DASH protocol to serve you video and audio separately. That's because you can use same audio stream with different resolution videos. "youtube-dl" script can download just the audio file, without downloading video data.
- archgoon 9y agoWhat is the API to download only the audio from a youtube video? How would you do your proposed solution?
- sp332 9y agoLet's take a video I recently linked in another HN comment. https://www.youtube.com/watch?v=r_fxB6yrDVo https://www.youtube.com/watch?v=r_fxB6yrDVo If I run youtube-dl -F https://www.youtube.com/watch?v=r_fxB6yrDVo https://www.youtube.com/watch?v=r_fxB6yrDVo then I get a bunch of options marked "audio only DASH audio", e.g. 251 webm audio only DASH audio 143k , opus @160k, 78.96MiB Then if I run youtube-dl -f 251 -g https://www.youtube.com/watch?v=r_fxB6yrDVo https://www.youtube.com/watch?v=r_fxB6yrDVo then I get this horrible URL: https://r1---sn-hxugvj5nu-cvnl.googlevideo.com/videoplayback?mt=1525288098&id=o-ALmpxTJqwTvmb1rI2j8vr7ERIAmvRiXKDCroWbudn5ly&mn=sn-hxugvj5nu-cvnl%2Csn-ab5l6n6s&mm=31%2C29&ms=au%2Crdu&ei=Kw3qWriXMuaZ8gTP1Z6gBA&keepalive=yes&mv=m&source=youtube&pl=19&dur=5792.761&lmt=1497010473974174&ip=65.175.128.10&requiressl=yes&clen=82794463&mime=audio%2Fwebm&c=WEB&initcwndbps=1348750&fexp=23724337&ipbits=0&fvip=1&itag=251&expire=1525309835&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&gir=yes&key=yt6&signature=08A1A700F7ADB15AB3444DE412054B0A05FEFD35.5A67EC47A23953CB6F9230A30CF3D66D138525F4&ratebypass=yes https://r1---sn-hxugvj5nu-cvnl.googlevideo.com/videoplayback... However if I wget "[horrible_url]" -O audio, it still takes forever to download, so I guess rate-limiting might be the issue. But if download time is the problem, you could have one server that just downloads the data slowly to S3 and then kicks off the lambda job on the completed file.