mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.73k stars 2.93k forks source link

mpv freezes when seeking forward #11441

Open youngunix opened 1 year ago

youngunix commented 1 year ago

Important Information

Provide following Information:

If you're not using git master or the latest release, update. Releases are listed here: https://github.com/mpv-player/mpv/releases

Reproduction steps

Try to reproduce your issue with --no-config first. If it isn't reproducible with --no-config try to first find out which option or script causes your issue. ^^^still having the issue even after trying the above suggestions.

Describe the reproduction steps as precise as possible. It's very likely that the bug you experience wasn't reproduced by the developer because the workflow differs from your own. ^^^I'm using yt-dlp 2023.03.04. To reproduce the issue; copy a youtube video's link, open terminal and type [mpv $youtube_link], once the video starts to play, then use the right arrow to seek forward (about 20sec) and the video freezes for a few minutes.

Expected behavior

mpv should not have an issue when trying to fast forward youtube videos.

Actual behavior

see above.

Log file

mpv.log

Sample files

Use this link to play a video on mpv: https://www.youtube.com/watch?v=4wWI1iv4KEE

Sample files needed to reproduce this issue can be uploaded to https://0x0.st/ or similar sites. (Only needed if the issue cannot be reproduced without it.) Do not use garbage like "cloud storage", especially not Google Drive.

solsticedhiver commented 1 year ago

Confirming. mpv 0.35.1

I am watching some .m3u8 streams, and seeking works on some while it fails on others; and even makes mpv crashes.

(...) AV: 00:22:20 / 00:45:30 (49%) A-V:  0.000 Cache: 0.0s
[ffmpeg] NULL: Invalid NAL unit size (-2076297873 > 1466).
[ffmpeg] NULL: missing picture in access unit with size 1470
[ffmpeg] NULL: Invalid NAL unit size (1907512311 > 12796).
[ffmpeg] NULL: missing picture in access unit with size 12800
[ffmpeg] NULL: Invalid NAL unit size (-367726629 > 4006).
[ffmpeg] NULL: missing picture in access unit with size 4010
[ffmpeg] NULL: Invalid NAL unit size (110354250 > 2232).
[ffmpeg] NULL: missing picture in access unit with size 2236
[ffmpeg] NULL: Invalid NAL unit size (2132592631 > 2142).
[ffmpeg] NULL: missing picture in access unit with size 2146
[ffmpeg] NULL: Invalid NAL unit size (-1289541211 > 13093).
[ffmpeg] NULL: missing picture in access unit with size 13097
[ffmpeg] NULL: Invalid NAL unit size (353979732 > 3975).
[ffmpeg] NULL: missing picture in access unit with size 3979
[ffmpeg] NULL: Invalid NAL unit size (-200769523 > 2059).
[ffmpeg] NULL: missing picture in access unit with size 2063
[ffmpeg] NULL: Invalid NAL unit size (-454134204 > 2282).
[ffmpeg] NULL: missing picture in access unit with size 2286
[ffmpeg] NULL: Invalid NAL unit size (-1470469763 > 16788).
[ffmpeg] NULL: missing picture in access unit with size 16792
[ffmpeg] NULL: Invalid NAL unit size (1022355695 > 2491).
[ffmpeg] NULL: missing picture in access unit with size 2495
[ffmpeg] NULL: Invalid NAL unit size (-2057856391 > 14722).
[ffmpeg] NULL: missing picture in access unit with size 14726
[ffmpeg] NULL: Invalid NAL unit size (303792154 > 3485).
[ffmpeg] NULL: missing picture in access unit with size 3489
[ffmpeg] NULL: Invalid NAL unit size (1911790718 > 1265).
[ffmpeg] NULL: missing picture in access unit with size 1269
[ffmpeg] NULL: Invalid NAL unit size (-359899896 > 1189).
[ffmpeg] NULL: missing picture in access unit with size 1193
[ffmpeg] NULL: Invalid NAL unit size (1471846230 > 14947).
[ffmpeg] NULL: missing picture in access unit with size 14951
[ffmpeg] NULL: Invalid NAL unit size (286020383 > 3919).
[ffmpeg] NULL: missing picture in access unit with size 3923
[ffmpeg] NULL: Invalid NAL unit size (1646380037 > 1555).
[ffmpeg] NULL: missing picture in access unit with size 1559
[ffmpeg] NULL: Invalid NAL unit size (874743857 > 1270).
[ffmpeg] NULL: missing picture in access unit with size 1274
[ffmpeg] NULL: Invalid NAL unit size (1127632928 > 13781).
[ffmpeg] NULL: missing picture in access unit with size 13785
[ffmpeg] NULL: Invalid NAL unit size (1181901554 > 2890).
[ffmpeg] NULL: missing picture in access unit with size 2894
[ffmpeg] NULL: Invalid NAL unit size (-1283735068 > 1927).
[ffmpeg] NULL: missing picture in access unit with size 1931
(...) AV: 00:22:20 / 00:45:30 (49%) A-V:  0.000 Cache: 0.0s

Exiting... (End of file)
Dudemanguy commented 1 year ago

Can't reproduce. Is this still an issue with 0.36?

rhendric commented 1 year ago

Not the OP, but I still see this on 0.36. I'm on yt-dlp 2023.07.06.

It's more an issue with some videos than others; the reported link doesn't present a problem, but this one does: https://www.youtube.com/watch?v=v4YhsooE5xY

llyyr commented 1 year ago

This may be fixed by https://ffmpeg.org/pipermail/ffmpeg-devel/2023-August/313273.html if the issue only exists with hls streams

rhendric commented 1 year ago

I built ffmpeg with that patch and am still seeing the issue on mpv 0.36.

youngunix commented 1 year ago

Yes, this is still happening but not with all videos, but maybe that's due to either they are short or below 1080 resolution.

Here is the output of mpv -v if it helps (pasting it here looks terrible and all mashed up, so here is a link to it).

https://github.com/youngunix/uploads/blob/main/img/mpv_output.log

sudoshindo commented 10 months ago

Did you guys stop having this issue? Still happening on my end. If I ever jump/seek forward the audio keeps playing but the video completely freezes.

youngunix commented 10 months ago

Did you guys stop having this issue? Still happening on my end. If I ever jump/seek forward the audio keeps playing but the video completely freezes.

Yes, it's still happening on my system. I suspect it's a connection latency caused by ffmpeg.

Mezmathics commented 9 months ago

Did you guys stop having this issue? Still happening on my end. If I ever jump/seek forward the audio keeps playing but the video completely freezes.

Yes, it's still happening on my system. I suspect it's a connection latency caused by ffmpeg.

After reading this thread and also noticing for myself that this is an issue with some videos than others, I noticed it actually depends not so much on the videos but the format yt-dlp picks up. even if you have specific configuration there are many options that satisfy that configuration that yt-dlp can pick up. For example if you specify

--ytdl-format="bestvideo[ext=mp4][height<=?1080]+bestaudio[ext=m4a]"

there are several formats that yt-dlp can pick from that satisfy this and some of them have this issues while others don't. For each video, you can check the full list of available formats with

yt-dlp -F [YOUTUBE LINK]

each format has an associated id and it shows all other information such as extension and if it's video or audio

With YouTube currently, every video that I tried that had this issue was resolved by first making sure I set

--script-opts-append=ytdl_hook-try_ytdl_first=yes

I picked id 137 for the video which is one of the mp4 1080p formats if it's available and id 140 for audio which seems to be m4a. on all the videos I checked that have a minimum 1080p resolution, these ids were available for yt-dlp to use. So I added in my mpv.conf file

--script-opts-append=ytdl_hook-try_ytdl_first=yes

[youtube]
profile-cond=path:find('youtu%.?be')
--ytdl-format="137+140" 

which sets --ytdl-format="137+140" only for videos containing "youtube" or "youtu.be" in their path and the formats specified are available. If not it gets ignored. So far this has worked for me

sudoshindo commented 9 months ago

@Mezmathics can you share what your current full mpv.conf looks like?

youngunix commented 9 months ago

I set the height to 720 and it seems to remediate the issue. As I suspected, the buffer either has a limit when steaming videos >=1080 or Youtube (CDN) are throttling their upload speed. The 720 quality is not bad, but for some, it might be a bummer. Unfortunately, we have to live with it for now until someone finds a fix.

sudoshindo commented 9 months ago

@youngunix share your conf?

youngunix commented 9 months ago

@youngunix share your conf?

Are you having issues too or you just need a sample 'mpv.conf'?

sudoshindo commented 9 months ago

I have the same issue, otherwise I wouldn't be in this thread.

youngunix commented 9 months ago

I have the same issue, otherwise I wouldn't be in this thread.

Next time lead with that, don't just drop in and demand info. This is not the proper way of engaging in technical discussions (or any other ones for that matter).

sudoshindo commented 9 months ago

i don't see you in the top contributor graph for this repo

youngunix commented 9 months ago

i don't see you in the top contributor graph for this repo

You insinuate that you are a "contributor," yet you contributed nothing to this discussion. Instead, you polluted it with your toxic personality.

Little kid, go watch some cartoons.

zunjack commented 3 weeks ago

Is this unfixable? Please only devs reply, thanks.