Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
qtlin opened this issue Oct 29, 2021 · 11 comments

Comments

@qtlin
Copy link

qtlin commented Oct 29, 2021

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
Copy link
Owner

i3arnon commented Nov 7, 2021

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

@qtlin
Copy link
Author

qtlin commented Nov 19, 2021

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
Copy link
Owner

i3arnon commented Nov 21, 2021

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
Copy link
Author

qtlin commented Nov 22, 2021

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

@qtlin
Copy link
Author

qtlin commented Nov 27, 2021

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
Copy link
Author

qtlin commented Dec 14, 2021

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
Copy link
Owner

i3arnon commented Dec 15, 2021

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
Copy link
Author

qtlin commented Dec 17, 2021

Checking v2.21 on a video mentioned in #72 (comment)
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
Copy link
Author

qtlin commented Jan 9, 2022

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
Copy link
Author

qtlin commented Jan 30, 2022

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

resolution = int.Parse(encoding.Remove(encoding.Length - 1).Substring(startIndex: 4));
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

var resolution = 720;
Thank you.

@qtlin
Copy link
Author

qtlin commented Mar 20, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants