3 ms·
I wrote a pair of PHP scripts that let me subscribe to YouTube channels as podcast feeds, with enclosure URLs and all. One script parses the channel's RSS feed
by Gormo 2y ago
I wrote a pair of PHP scripts that let me subscribe to YouTube channels as podcast feeds, with enclosure URLs and all. One script parses the channel's RSS feed and inserts enclosure tags, with the target URLs pointing to the second script with the video ID as a parameter. The second script then wraps youtube-dl and redirects to the raw video URL obtained for that video ID by youtube-dl.
This worked great for years, but recently, YouTube stopped serving their `22` format for most videos, which coupled 720p video with the audio stream. Now, the best resolution you can get with audio and video interleaved is `18`, which contains only 360p video. So that's the best resolution obtainable this way for now, unless I add a whole layer to this to reconstruct an interleaved video from separate audio and video streams selected from the DASH manifest.
- throwanem 2y agoOn the off chance you don't already know about it, yt-dlp can do that interleaving for you. Still a headache to add to the pipeline, but less to invent at least.
- Gormo 2y agoMuch more than a headache, unfortunately: yt-dlp only remuxes the stream as a post-processing step after all streams have been downloaded. So this would take my nice on-demand stateless solution that just returns redirects to the raw video URLs from YouTube, and turn it into a stateful application that downloads and rehosts the video files on my own server. To accommodate that, I'd then need to create a configuration layer that determines which feeds to download and when, since I wouldn't necessarily want every video posted on every channel I subscribe to downloaded to my server in advance. So it turns the whole project into something quite different and much more complex. If there was something that could remux the streams and then pipe the output stream back out over HTTP, that would be more appropriate. Maybe I can work with bindings to FFMpeg to create something that would work here.