ffvvc / FFmpeg

VVC Decoder for ffmpeg
Other
48 stars 12 forks source link

Failed to decode file using today's ffmpeg snapshot #181

Closed birdie-github closed 5 months ago

birdie-github commented 5 months ago
ffplay NovosobornayaSquare_1920x1080.mp4 
ffplay version N-113193-g59686eaf33 Copyright (c) 2003-2024 the FFmpeg developers
  built with gcc 13 (GCC)
  configuration: --disable-static --enable-nonfree --enable-avfilter --enable-shared --enable-gpl --enable-postproc --enable-pthreads --enable-libspeex --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libopus --enable-libopenjpeg --disable-debug --disable-doc --enable-libpulse --extra-cflags='-mtune=generic' --enable-version3 --enable-libvorbis --enable-libfdk-aac --enable-gnutls --enable-libfreetype --enable-libx265 --enable-libdav1d --libdir=/usr/local/lib64 --enable-lto --enable-pic
  libavutil      58. 36.100 / 58. 36.100
  libavcodec     60. 37.100 / 60. 37.100
  libavformat    60. 20.100 / 60. 20.100
  libavdevice    60.  4.100 / 60.  4.100
  libavfilter     9. 16.100 /  9. 16.100
  libswscale      7.  6.100 /  7.  6.100
  libswresample   4. 13.100 /  4. 13.100
  libpostproc    57.  4.100 / 57.  4.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ff618000c80] Could not find codec parameters for stream 0 (Video: none (vvc1 / 0x31637676), none, 1920x1080, 4007 kb/s): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'NovosobornayaSquare_1920x1080.mp4':
  Metadata:
    major_brand     : iso4
    minor_version   : 1
    compatible_brands: iso4
    creation_time   : 2023-09-28T14:25:08.000000Z
    encoder         : GPAC-2.3-DEV-rev550-gec2a3776-master
  Duration: 00:00:10.00, start: 0.000000, bitrate: 4014 kb/s
  Stream #0:0[0x1](und): Video: none (vvc1 / 0x31637676), none, 1920x1080, 4007 kb/s, 60 fps, 60 tbr, 60 tbn (default)
      Metadata:
        creation_time   : 2023-09-28T14:25:08.000000Z
        handler_name    : bin@GPAC2.3-DEV-rev550-gec2a3776-master
        vendor_id       : [0][0][0][0]
No decoder could be found for codec none
Failed to open file 'NovosobornayaSquare_1920x1080.mp4' or configure filtergraph

Using ffmpeg snapshot 59686eaf33.

Source file is taken here https://www.elecard.com/videos

ffmpeg with vvdec is playing this file just fine:

ffplay NovosobornayaSquare_1920x1080.mp4 
ffplay version 6.0.1 Copyright (c) 2003-2023 the FFmpeg developers
  built with gcc 13 (GCC)
  configuration: --disable-static --enable-nonfree --enable-avfilter --enable-shared --enable-gpl --enable-postproc --enable-pthreads --enable-libspeex --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libopus --enable-libopenjpeg --disable-debug --disable-doc --enable-libpulse --extra-cflags='-mtune=generic' --enable-version3 --enable-libvorbis --enable-libfdk-aac --enable-gnutls --enable-libfreetype --enable-libx265 --enable-libdav1d --enable-libvvdec --libdir=/usr/local/lib64 --enable-lto --enable-pic
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'NovosobornayaSquare_1920x1080.mp4':
  Metadata:
    major_brand     : iso4
    minor_version   : 1
    compatible_brands: iso4
    creation_time   : 2023-09-28T14:25:08.000000Z
    encoder         : GPAC-2.3-DEV-rev550-gec2a3776-master
  Duration: 00:00:10.00, start: 0.000000, bitrate: 4014 kb/s
  Stream #0:0[0x1](und): Video: vvc (Main 10) (vvc1 / 0x31637676), yuv420p(tv), 1920x1080, 4007 kb/s, 60 fps, 60 tbr, 60 tbn (default)
    Metadata:
      creation_time   : 2023-09-28T14:25:08.000000Z
      handler_name    : bin@GPAC2.3-DEV-rev550-gec2a3776-master
      vendor_id       : [0][0][0][0]
   1.01 M-V:  0.000 fd=   1 aq=    0KB vq=  523KB sq=    0B f=0/0 
nuomi2021 commented 5 months ago

Thank you for the report.Two things missed here:

  1. https://patchwork.ffmpeg.org/project/ffmpeg/patch/20231103095720.32426-3-thomas.ff@spin-digital.com/
  2. extradata data decoder. Hope I can fix it in 1~2 weeks.
birdie-github commented 5 months ago

Thanks a lot for your work!

Speaking of 1: are you saying this patchset is required and is not yet merged?

nuomi2021 commented 5 months ago

For 1, we do not need to change the original patch. I will ask the mp4 maintainer to review and merge the patch. For 2, I will try to implement it this weekend and send it to the mailing list for review.

Nomis101 commented 5 months ago

I'm seeing a similar thing. With the most current FFmpeg master, I can only open (ffplay) and convert (ffmpeg) a sample video called "NovosobornayaSquare_1920x1080.vvc" (I have forgotten the source). All other samples failed.

After applying the remaining patch from #182 the situation is as follows.

  1. Sample "NovosobornayaSquare_1920x1080.mp4" from https://www.elecard.com/videos Can be played (ffplay) and converted to h264 (-vcodec h264), but I get the warning: This device does not support the qmin option. Value ignored. It failed to convert to hevc (-vcodec hevc) with the error:

    [hevc_videotoolbox @ 0x7fc340007680] This device does not support the qmin option. Value ignored.
    [hevc_videotoolbox @ 0x7fc340007680] This device does not support the qmax option. Value ignored.
    [hevc_videotoolbox @ 0x7fc340007680] Error encoding frame: -12905
    [hevc_videotoolbox @ 0x7fc340007680] popping: -542398533
    [vost#0:0/hevc_videotoolbox @ 0x7fc340007240] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
    [vf#0:0 @ 0x7fc340007e80] Error sending frames to consumers: Generic error in an external library
    [vf#0:0 @ 0x7fc340007e80] Task finished with error code: -542398533 (Generic error in an external library)
    [vf#0:0 @ 0x7fc340007e80] Terminating thread with return code -542398533 (Generic error in an external library)
    [vost#0:0/hevc_videotoolbox @ 0x7fc340007240] Could not open encoder before EOF
    [vost#0:0/hevc_videotoolbox @ 0x7fc340007240] Task finished with error code: -22 (Invalid argument)
    [vost#0:0/hevc_videotoolbox @ 0x7fc340007240] Terminating thread with return code -22 (Invalid argument)
    [out#0/mp4 @ 0x7fc340005ac0] Nothing was written into output file, because at least one of its streams received no packets.
  2. Sample "foreman_cif_pal.266.mp4" from https://code.videolan.org/videolan/vlc/-/issues/27055 Can be played (ffplay) without issue. Converting to h264 failed with the error:

    [h264_videotoolbox @ 0x7fde1072efc0] Error: cannot create compression session: -12903
    [h264_videotoolbox @ 0x7fde1072efc0] Try -allow_sw 1. The hardware encoder may be busy, or not supported.
    [vost#0:0/h264_videotoolbox @ 0x7fde1072ebc0] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
    [vf#0:0 @ 0x7fde1072f7c0] Error sending frames to consumers: Generic error in an external library
    [vf#0:0 @ 0x7fde1072f7c0] Task finished with error code: -542398533 (Generic error in an external library)
    [vf#0:0 @ 0x7fde1072f7c0] Terminating thread with return code -542398533 (Generic error in an external library)
    [vost#0:0/h264_videotoolbox @ 0x7fde1072ebc0] Could not open encoder before EOF
    [vost#0:0/h264_videotoolbox @ 0x7fde1072ebc0] Task finished with error code: -22 (Invalid argument)
    [vost#0:0/h264_videotoolbox @ 0x7fde1072ebc0] Terminating thread with return code -22 (Invalid argument)
    [out#0/mp4 @ 0x7fde107300c0] Nothing was written into output file, because at least one of its streams received no packets.
  3. Sample "Arknights - Reimei Zensou - 01 [VVC_1080p_AAC].mp4" from https://drive.google.com/drive/folders/1JK1-k2_EfcgvQgQDzWRmBw7VgQLBaNI4 Gives the following error several times when played with ffmpeg and the picture is just black and green:

    [vvc @ 0x7fafaaf51c80] Intra Block Copy is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
    [vvc @ 0x7fafaaf51c80] frame    33, P(  0,   2) failed with -1163346256
  4. Sample "Kage no Jitsuryokusha ni Naritakute! - 10 VVenC_1080p_fast_qpa1_qp26.mp4" from https://drive.google.com/drive/folders/1JK1-k2_EfcgvQgQDzWRmBw7VgQLBaNI4 Can be played without any issue. Converting to h264 gives the error:

[vist#0:0/vvc @ 0x7fa6cd006240] Error submitting packet to decoder: Not yet implemented in FFmpeg, patches welcome
[vvc @ 0x7fa6cd030e40] Intra Block Copy is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[vvc @ 0x7fa6cd030e40] frame   353, P(  0,   2) failed with -1163346256
[vist#0:0/vvc @ 0x7fa6cd006240] Error submitting packet to decoder: Not yet implemented in FFmpeg, patches welcome
[vvc @ 0x7fa6cd030e40] Intra Block Copy is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[vvc @ 0x7fa6cd030e40] frame   378, P( 14,  10) failed with -1163346256
nuomi2021 commented 5 months ago

@Nomis101 , Thank you for the report

For 1, 2, it's not related to vvc. Maybe your hardware encoder issues, you can try with h264 as input or software encoder "./ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v libx265 test.mp4" "./ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v libx264 test.mp4"

for 3, 4, intra block copy is not supported yet. Please follow https://github.com/ffvvc/FFmpeg/pull/169

birdie-github commented 5 months ago

https://github.com/ffvvc/FFmpeg/pull/182 fixes it, thanks a ton!

nuomi2021 commented 5 months ago

@birdie-github mp4 and ts fix upstreamed. please have a try https://github.com/FFmpeg/FFmpeg/commit/db6e360afb81ec67d460f8d4d65a6dbead80136c

Nomis101 commented 5 months ago

Cool, works perfectly now with all my samples above (apart from #169). Thank you all so much for your work!