i3arnon / YouCast

Turn YouTube Channels into Subscribable Podcasts.
http://youcast.i3arnon.com/
GNU General Public License v2.0
251 stars 34 forks source link

Some videos ignore encoding= option for an unknown reason causing larger download size. #72

Open qtlin opened 3 years ago

qtlin commented 3 years ago

Sample video: xaerlUIavxo actual download size reported by yt-dlp format 18 266.91MiB format 22 392.82MiB actual download size reported by curl via YouCast encoding=MP4_320 392M encoding=MP4_720 392M no encoding 392M

i3arnon commented 2 years ago

That's the stream YouCast gets from YouTube (via YoutubeExplode): image

qtlin commented 2 years ago

I don't know what provided screen tells users but actual download via youcast from above sample video is still 392M as of right now:

$ curl -L -o dummy 'http://my-youcast:22703/FeedService/Video.mp4?videoId=xaerlUIavxo&encoding=MP4_360'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  1  392M    1 4933k    0     0  81657      0  1:24:04  0:01:01  1:23:03 88544

other download tool size matches the screen you provided.

$ python2.7 /usr/local/bin/youtube-dl -f 18 'https://youtube.com/watch?v=xaerlUIavxo'
[download]   0.8% of 266.91MiB at 84.00KiB/s ETA 53:49

File acquired via YouCast is 47% larger.

i3arnon commented 2 years ago

I don't know what provided screen tells

It shows the description of the stream YoutubeExplode returns from YouTube. Where the quality is 360p and the size is 266MB.

qtlin commented 2 years ago

Despite YoutubeExplode, youtube-dl and yt-dlp all report and download 266MB this particular video actual download via YouCast 360p is 47% larger.

qtlin commented 2 years ago

I found several more examples. yt-dlp downloads format 22 in 14 seconds: [download] 100% of 422.66MiB in 00:14 However, both curl and podcast player show download ETA about two hours for the same 422MiB of video: 2 422M 2 9283k 0 0 62231 0 1:58:41 0:02:32 1:56:09 62147

qtlin commented 2 years ago

Any updates on possible causes? I have more sample videos with the same behavior. Comparing video download URL with one used by youtube-dl and yt-dlp I see significant differences.

i3arnon commented 2 years ago

Any updates on possible causes?

As I said, these are the streams YoutubeExplode returns from YouTube. I don't see what can be done about it.

qtlin commented 2 years ago

Checking v2.21 on a video mentioned in https://github.com/i3arnon/YouCast/issues/72#issue-1039107230 Speed throttling is gone but size is still 392M for both 360 and 720 formats. Could anyone check download size by using just YoutubeExplode?

qtlin commented 2 years ago

I did more testing and looks like MP4_360 option is ignored. Download URL always lists itag=22 regardless. Tag 22 corresponds 720 format. Here is another random video I tried SKNCTXEYi48. The simplest way to reproduce it is to use curl -v or wget on download video URL, e.g.: wget 'http://youcast-host:22703/FeedService/Video.mp4?videoId=SKNCTXEYi48&encoding=MP4_360' and observe final download URL with itag=22 instead of itag=18

qtlin commented 2 years ago

I don't know what provided screen tells users but actual download via youcast from above sample video is still 392M as of right now:

$ curl -L -o dummy 'http://my-youcast:22703/FeedService/Video.mp4?videoId=xaerlUIavxo&encoding=MP4_360'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  1  392M    1 4933k    0     0  81657      0  1:24:04  0:01:01  1:23:03 88544

other download tool size matches the screen you provided.

$ python2.7 /usr/local/bin/youtube-dl -f 18 'https://youtube.com/watch?v=xaerlUIavxo'
[download]   0.8% of 266.91MiB at 84.00KiB/s ETA 53:49

File acquired via YouCast is 47% larger.

I found the problem. Nobody noticed that a p is missing after 360. Code on https://github.com/i3arnon/YouCast/blob/fbdd11b3e9325771fc82a9e670293f5fc4fe919d/src/Service/YoutubeFeed.cs#L146 expect a char after resolution.

If anyone is looking for saving a bandwidth, resolution MP4_144p is also valid. Lastly I would like to see a 360 instead of 720 as a default resolution on line https://github.com/i3arnon/YouCast/blob/fbdd11b3e9325771fc82a9e670293f5fc4fe919d/src/Service/YoutubeFeed.cs#L143 Thank you.

qtlin commented 7 months ago

Hi @i3arnon any chance you can set default video resolution to 360 and close this request?