mpv-player / mpv

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

Certain video files refuse to run on hardware decoder #15128

Closed forthrin closed 4 hours ago

forthrin commented 5 hours ago

mpv Information

mpv version: git-2024-10-16-e404426-dirty
FFmpeg version: git-2024-10-05-099f88b

Reproduction Steps

$ mpv 1.mp4

(File is only a single video frame, which is all it takes to provoke the issue.)

Possibly related to #3318 and #559.

Expected Behavior

Hardware decoding should work.

If the file is broken:

  1. What specifically is broken? Was it encoded in an incorrect way?
  2. Is there any utility that can repair the file without recoding the entire video stream?

Actual Behavior

File falls back to software decoder. (This has happened for several other files over the years.)

$ mpv 1.mp4
mpv(41676,0x1fdda7240) malloc: nano zone abandoned due to inability to reserve vm space.
* Video  --vid=1  (h264 1920x1080 25 fps) [default]
[ffmpeg/video] h264: Failed setup for format videotoolbox_vld: hwaccel initialisation returned error.
[ffmpeg/video] h264: number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
[ffmpeg/video] h264: Failed setup for format videotoolbox_vld: hwaccel initialisation returned error.
[ffmpeg/video] h264: number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
[ffmpeg/video] h264: number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
VO: [libmpv] 1920x1080 yuv420p
V: 00.040 / 00.040 (100%)
Exiting... (End of file)

Log File

N/A

Sample Files

https://github.com/user-attachments/assets/b5fe10d9-2200-4875-b92a-4f62daa876dc

I carefully read all instruction and confirm that I did the following:

llyyr commented 4 hours ago

Can you reproduce with ffmpeg -hwaccel videotoolbox -i 1.mp4 -f null /dev/null?

Akemi commented 4 hours ago

this is an ffmpeg problem, if at all. please report it upstream.

akemi@Mac-Studio ~ % ffmpeg -hwaccel videotoolbox -i 378104527-b5fe10d9-2200-4875-b92a-4f62daa876dc.mp4 -f null -
ffmpeg version 7.0.2 Copyright (c) 2000-2024 the FFmpeg developers
  built with Apple clang version 15.0.0 (clang-1500.3.9.4)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.0.2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
[h264 @ 0x135704ee0] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/Akemi/Downloads/378104527-b5fe10d9-2200-4875-b92a-4f62daa876dc.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf61.9.100
  Duration: 00:00:00.04, start: 0.040000, bitrate: 7783 kb/s
  Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 7596 kb/s, 25 fps, 25 tbr, 16k tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
[h264 @ 0x135707480] Failed setup for format videotoolbox_vld: hwaccel initialisation returned error.
[h264 @ 0x1357102c0] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf61.1.100
  Stream #0:0(und): Video: wrapped_avframe, yuv420p(tv, bt709, top coded first (swapped)), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
        encoder         : Lavc61.3.100 wrapped_avframe
[out#0/null @ 0x600002a94000] video:0KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.545x    
forthrin commented 4 hours ago

Can you reproduce with ffmpeg -hwaccel videotoolbox -i 1.mp4 -f null /dev/null?

Thanks for chipping in. Same problem. Do you have any knowledge/forensics to attach to the upstream issue?

Akemi commented 3 hours ago

usually ffmpeg would like you to provide a test file, the ffmpeg command you used/tested with and the output of that command. but i believe that is what their issue tracker says when trying to open an issue.

forthrin commented 3 hours ago

Responses haven't been very friendly or helpful when posting issues earlier, so passing unless their values have changed.

Akemi commented 3 hours ago

Responses haven't been very friendly or helpful when posting issues earlier, so passing unless their values have changed.

sry to hear that, though i can relate. some years ago i was reporting every videotoolbox issue reported to mpv upstream. even posted fixes to their mailing list. though was mostly ignored for months or even years, or met with unfounded 'resistance'. i stopped doing this after some time. sry this was probably a bit too much rambling.

forthrin commented 1 hour ago

No, that's reassuring to hear. When even the team lead of the best video player is ignored, the best guess is (they think, at least) they are so on top of their own project they have no interest in outside intervention.

llyyr commented 22 minutes ago

they are so on top of their own project they have no interest in outside intervention.

Or they simply don't have the bandwidth available to provide support. (which is the case, most of the time)