YouCast icon indicating copy to clipboard operation
YouCast copied to clipboard

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

Open qtlin opened this issue 3 years ago • 11 comments

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

qtlin avatar Oct 29 '21 02:10 qtlin

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

i3arnon avatar Nov 07 '21 13:11 i3arnon

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.

qtlin avatar Nov 19 '21 22:11 qtlin

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.

i3arnon avatar Nov 21 '21 11:11 i3arnon

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

qtlin avatar Nov 22 '21 03:11 qtlin

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 avatar Nov 27 '21 23:11 qtlin

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.

qtlin avatar Dec 14 '21 22:12 qtlin

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.

i3arnon avatar Dec 15 '21 12:12 i3arnon

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 avatar Dec 17 '21 22:12 qtlin

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 avatar Jan 09 '22 22:01 qtlin

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 avatar Jan 30 '22 22:01 qtlin

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

qtlin avatar Mar 20 '24 16:03 qtlin