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

Video Playback Broken #63

Open
matsd88 opened this issue Nov 15, 2024 · 12 comments
Open

Video Playback Broken #63

matsd88 opened this issue Nov 15, 2024 · 12 comments

Comments

@matsd88
Copy link

matsd88 commented Nov 15, 2024

Please take a look at the attached screenshot and give feedback. Screenshot 2024-11-14 at 6 57 35 PM

@hileo
Copy link

hileo commented Nov 15, 2024

I have the same problem, especially with music videos, like this youtube video "V9PVRfjEBTI"

@matsd88
Copy link
Author

matsd88 commented Nov 15, 2024

The itag video 18 stopped returning

@hileo
Copy link

hileo commented Nov 15, 2024

The itag video 18 stopped returning

How to solve this problem? Thank you

@alexeichhorn
Copy link
Owner

For some videos, YouTube has increased protection. Looks like your videos are affected. This just means that it sometimes gets fewer streams back. I guess you still get streams back?
Generally, I wouldn't advise you to filter streams by itag and rather filter them by property. ITags come and go - very inconsistent on the YouTube side.

@hileo
Copy link

hileo commented Nov 15, 2024

For some videos, YouTube has increased protection. Looks like your videos are affected. This just means that it sometimes gets fewer streams back. I guess you still get streams back? Generally, I wouldn't advise you to filter streams by itag and rather filter them by property. ITags come and go - very inconsistent on the YouTube side.

This problem occurs in almost all music videos. Please help me solve it. Thank you.

@matsd88
Copy link
Author

matsd88 commented Nov 15, 2024

For some videos, YouTube has increased protection. Looks like your videos are affected. This just means that it sometimes gets fewer streams back. I guess you still get streams back?

Generally, I wouldn't advise you to filter streams by itag and rather filter them by property. ITags come and go - very inconsistent on the YouTube side.

Thanks, seems like all combined video/audio urls are not returning even when using .filterVideoAndAudio()
main yt-dlp project still returning those links, wonder if adjusting clients helps.

@alexeichhorn
Copy link
Owner

Does yt-dlp actually return streaming links or does it just download the videos? - which it does by downloading video and audio separately and then combining them afterwards.
In my experience, YouTube is slowly removing these combined streams - also in yt-dlp. That's why I started to find a solution by also combining the video and audio streams at playback time. You can checkout a working implementation in feature/player-item.

@meirinberg
Copy link

meirinberg commented Dec 4, 2024

I believe I am also experiencing this issue. It's happening on all of the videos I try. The streams returned are either audio-only or video-only. This was not a problem for me until this morning. I was able to combine the audio and video streams locally but it seems to take longer to load due to the added overhead of the merging process. Is there a more efficient method? I'd imagine that YouTube itself doesn't combine streams locally for playback to occur?

@alexeichhorn
Copy link
Owner

alexeichhorn commented Dec 5, 2024

@meirinberg I think YouTube slowly moves to separate streams. Depending on where you are located and which video you are watching, you experience this earlier or later.
But right now, it's true that it takes much longer if you want to merge it just-in-time. This is mostly due to the AVKit APIs that I'm using, which need to have many metadata preloaded before returning the actual AVPlayerItem.
Maybe I can figure out ways to make this more efficient and faster. Feel free to look at the code and experiment with it if you have experience with AVKit.

@meirinberg
Copy link

Thank you @alexeichhorn.

@hoangnam714
Copy link

hello @alexeichhorn your way is quite reasonable but I am facing a big problem, the video length is not accurate to reality if i use avplayer.currentItem.duration , the duration of both video and audio streams separately are doubled, is there any solution for this

@alexeichhorn
Copy link
Owner

alexeichhorn commented Dec 16, 2024

@hoangnam714 Is the video duration correctly reflected in the playback bar? Because I especially fixed this issue in commit f3126a6, but it might not apply to this property for some weird reason.

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

5 participants