madiele / vod2pod-rss

Vod2Pod-RSS converts a YouTube or Twitch channel into a podcast with ease. It creates a podcast RSS that can be listened to directly inside any podcast client. VODs are transcoded to MP3 on the fly and no server storage is needed!
MIT License
235 stars 6 forks source link

slow download speed #72

Open mfolnovic opened 1 year ago

mfolnovic commented 1 year ago

app version: 1.0.0


issue description: When i either download through browser, through podcast addict or if I copy/paste ffmpeg command and run it locally, the download speed is ~35KB/s. My internet speed is 1000/500 (Mbit/s).

Is there a configuration I'm missing?

Thanks for really useful product!

2023-05-12T04:52:36.239Z INFO  [app] app version 1.0.0
2023-05-12T04:52:36.274Z INFO  [app] starting server at http://0.0.0.0:8080
2023-05-12T04:52:36.274Z INFO  [actix_server::builder] starting 4 workers
2023-05-12T04:52:36.274Z INFO  [actix_server::server] Actix runtime found; starting in Actix runtime
2023-05-12T04:52:43.117Z INFO  [app] processing transcode at 192k for https://www.youtube.com/watch?v=BMr7Bz8eGus
2023-05-12T04:52:43.117Z INFO  [vod2pod_rss::transcoder] detected youtube url, need to find the stream url if not in cache
2023-05-12T04:52:46.076Z INFO  [vod2pod_rss::transcoder] generated ffmpeg command:
ffmpeg -ss 0 -i https://rr4---sn-8p2oxu-15bs.googlevideo.com/videoplayback/... -acodec libmp3lame -ab 192k -f mp3 -bufsize 5760 -maxrate 5760k -timeout 300 -hide_banner -loglevel error pipe:stdout
2023-05-12T04:52:46.080Z INFO  [vod2pod_rss::transcoder] streaming to client
madiele commented 1 year ago

I tried measuring the output of the raw ffmpeg command and yes, it seems to never go beyond 40KB/s, I'll have to check if there is some kind of option I'm missing for ffmpeg or that is just how fast you can go, I'll let you know if I found a fix

madiele commented 1 year ago

seems to be youtube that is throttling, if you check in the yt-dlp github you'll see some mentions of it, we'll have to wait for a new yt-dlp version to come out with the fix. In the mean time it will be slow...

I suggest you watch the repo for new releases to get notified when an update comes out, I will also update all the dependencies, can't say if that will work but there is a chance.

Sorry I could not help.

madiele commented 1 year ago

I just added automatic pull requests with depend-a-bot when yt-dlp gets updated so that when they release a new version I get notified and i can make a new image quickly that hopefully fixes the issue✌️

madiele commented 1 year ago

The beta image now has a new yt-dlp version, check if that has improved something

Just add :beta to the end of the image section of the docker-compose file

mfolnovic commented 1 year ago

While I'm running :latest, it works (although slow).

When I update to :beta and try to download a podcast, I get an error in response "Exec format error (os error 8)".

Logs:

2023-06-25T14:44:34.280Z INFO  [app] app version 1.0.3-beta-5a25fe9
2023-06-25T14:44:34.298Z INFO  [app] detected version change (1.0.2 != 1.0.3-beta-5a25fe9) flushing redis DB
2023-06-25T14:44:34.299Z INFO  [app] starting server at http://0.0.0.0:8080
2023-06-25T14:44:34.299Z INFO  [actix_server::builder] starting 4 workers
2023-06-25T14:44:34.299Z INFO  [actix_server::server] Actix runtime found; starting in Actix runtime
2023-06-25T14:44:39.717Z INFO  [app] processing transcode at 192k for https://www.youtube.com/watch?v=X2RdwmPqBvQ
2023-06-25T14:44:39.718Z INFO  [vod2pod_rss::transcoder] detected youtube url, need to find the stream url if not in cache

If it helps, I'm running this on unraid.

madiele commented 1 year ago

seems like a new bug, I'll see if I can fix it

madiele commented 1 year ago

@mfolnovic should be fixed now

jclendineng commented 3 months ago

Can we re-open this? There are options we can use in yt-dlp to tweak the speeds, can we add yt-dlp options through here or would we need to compile ourselves with the options?

https://github.com/yt-dlp/yt-dlp/issues/10443 has some useful options that seem to fix the slowness issues.

--throttled-rate 500K -R infinite --socket-timeout 1 or similar options

madiele commented 3 months ago

Interesting, I'll reopen sure ✌️

As for when I'll find the time to look into this, no clue, but an option to add extra args to yt-dlp is not a bad idea and should be easy to add, if anyone wants to take a shot at it look at contributing.md for a guide on how to setup the dev environment, I'm open to PRs

primeapple commented 2 days ago

While I couldn't change the DL Speed, I had some success with changing the size of the downloaded audio.

Setting the following environment variable:

      - YOUTUBE_YT_DLP_GET_URL_EXTRA_ARGS=["-f", "bestaudio[format_note~=original]/bestaudio", "-S", "+size"]

This allows to sort by the smallest filesize available by YT. This is only the -S part. The other is to prefer the original language in case there are multiple language audiotracks available.

Maybe it helps someone.