mpv icon indicating copy to clipboard operation
mpv copied to clipboard

vo/lavc youtube encoding failed when --start specified

Open witaway opened this issue 1 year ago • 4 comments

Important Information

  • MPV 0.38.0 from Flatpak
  • Fedora 40
  • NVidia GTX 1650 Ti (mobile), nouveau
  • AMD Ryzenâ„¢ 5 4600H with Radeonâ„¢ Graphics × 12

Reproduction steps

I tried to download a part of youtube video and convert it into webp (so I could get a little snapshot for Anki). After a little research I found out that command causing the problem is:

mpv 'https://www.youtube.com/watch?v=Pv0iVoSZzN8' --start=100.875 --end=103.632 --loop-file=no --keep-open=no --ovc=libwebp --of=webp --ofopts-add=loop=0 --audio=no --no-sub --no-ocopy-metadata --ovcopts-add=lossless=0 --ovcopts-add=compression_level=6 --ovcopts-add=quality=25 --vf-add=scale=-2:200:flags=lanczos --vf-add=fps=10 -o='/home/witaway/Downloads/video123.webp'

  • When I removed both --start and --end options, command executed successfully and returned big webp with content of the full video.

  • When I removed only --start option, with any --end option command still works as expected

  • Maximum working --start is different for different videos, for example for video given above it's about ~3.8 seconds.

It feels like ytdl cannot download the video in the case, but I'm not really sure :/

Logs (set --log-file=/dev/stdout):

io mpv Mpv mpv https.txt

witaway avatar May 08 '24 21:05 witaway

This is actually a known issue in ffmpeg, and you can find a solution here.

lcksk avatar May 20 '24 13:05 lcksk

@lcksk Big thank you! I guessed it wasn't the MPV.

Do I understand correctly that in order for this functionality to start working in MPV, I need to patch Ffmpeg in my system?

It looks confusing that the Issue has not been fixed, although it is 6 years old and there are proposed patches

witaway avatar May 20 '24 21:05 witaway

@lcksk Big thank you! I guessed it wasn't the MPV.

Do I understand correctly that in order for this functionality to start working in MPV, I need to patch Ffmpeg in my system?

yeah

It looks confusing that the Issue has not been fixed, although it is 6 years old and there are proposed patches

The patch might need to be rebased, but the good news is that it does indeed resolve the current issue.I suspect that the issue might be unresolved because the patch author might have left, hence the bug remains pending.

lcksk avatar May 21 '24 00:05 lcksk

@lcksk May it be reasonable to add a short note in MPV docs --start section about the Issue? Buggy ffmpeg version and link to Issue/Patch (without any warranties)

It'd resolve some false expectations and prevent appearing new same issues here, because looks like bug is common enough

witaway avatar May 21 '24 10:05 witaway