MartinEesmaa / VVCEasy

VVCEasy is that you don't have to compile or/and coding to encode VVC (known as Versatile Video Codec). Simple. Easy. Encode. Decode
https://martineesmaa.github.io/en/vvceasy
MIT License
160 stars 15 forks source link

【BUG】Why is the 15360x8640 resolution incorrectly displayed as 45495x45495? #52

Closed jiangzemin-xudamin closed 2 months ago

jiangzemin-xudamin commented 3 months ago

Hey Martin. Do you remember the previous issue about converting 16k videos? Now I found a bug:

When typing . \ffprobe_vvceasy -i 1.vvc command, at this point what it shows is normal;

屏幕截图 2024-07-01 220144

but if I directly encapsulate it into an mp4 file, and then type . \ffprobe_vvceasy -i 1.mp4, the content is wrong, from "15360x8640" to "45495x45495", and the MP4 file cannot be extracted into a vvc file.

屏幕截图 2024-07-01 220501

I even tried to use ffmpeg to directly convert the original video to mp4 with vvc encoding, but the result is also "45495x45495", I don't understand how to get this "45495"?

jiangzemin-xudamin commented 3 months ago

GitHub cannot upload vvc files directly, so I had to package it into a zip file 1.zip

MartinEesmaa commented 2 months ago

Hi, @jiangzemin-xudamin! Thanks for the file, it helps me! :)

Anyway, I tested your normal VVC file and it seems it claimed it's normal size, but when I mux into MP4 container from VVC video raw bitstream, I can verify that result picture size is invalid, weird... which could be libvvdec weird problem, not FFmpeg. Native FFmpeg VVC decoder reports okay fine with normal size using -strict -2.

Only MediaInfo and FFmpeg VVC native decoder reports fine than external VVC decoder feature. See the report of MediaInfo:

General
Complete name                            : 1.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 6.41 MiB
Duration                                 : 23 s 891 ms
Overall bit rate                         : 2 251 kb/s
Frame rate                               : 29.970 FPS

Video
ID                                       : 1
Format                                   : VVC
Codec ID                                 : vvc1
Codec ID/Info                            : Versatile Video Coding
Duration                                 : 23 s 891 ms
Source duration                          : 24 s 91 ms
Bit rate                                 : 2 229 kb/s
Width                                    : 15 360 pixels
Height                                   : 8 640 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (29970/1000) FPS
Bits/(Pixel*Frame)                       : 0.001
Stream size                              : 6.38 MiB (100%)
Source stream size                       : 6.40 MiB (100%)
Codec configuration box                  : vvcC

Also ffprobe report with loglevel debug (external VVC decoder):

[AVFormatContext @ 000002b313811140] Opening '1.mp4' for reading
[file @ 000002b313811400] Setting default whitelist 'file,crypto,data'
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] Processing st: 0, edit list 0 - media time: 240000, duration: 28669200
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] drop a frame at curr_cts: 0 @ 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] drop a frame at curr_cts: 40040 @ 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] drop a frame at curr_cts: 80081 @ 2
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] drop a frame at curr_cts: 120121 @ 3
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] drop a frame at curr_cts: 160162 @ 4
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] drop a frame at curr_cts: 200202 @ 5
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] rfps: 29.833333 0.016576
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] rfps: 29.916667 0.002509
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] rfps: 30.000000 0.000816
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] rfps: 60.000000 0.003265
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] rfps: 120.000000 0.013061
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] rfps: 29.970030 0.000000
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] rfps: 59.940060 0.000000
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] Before avformat_find_stream_info() pos: 6720840 bytes read:41488 seeks:1 nb_streams:1
[vvc_mp4toannexb @ 000002b3138629c0] bit_depth_minus8 2 chroma_format_idc 1
[vvc_mp4toannexb @ 000002b3138629c0] constant_frame_rate 1, ols_idx 0
[vvc_mp4toannexb @ 000002b3138629c0] general_profile_idc 1, general_tier_flag 0, general_level_idc 102, num_sublayers 6 num_bytes_constraint_info 1
[vvc_mp4toannexb @ 000002b3138629c0] ptl_multi_layer_enabled_flag 0, ptl_frame_only_constraint_flag 1
[vvc_mp4toannexb @ 000002b3138629c0] max_picture_width 15360, max_picture_height 8640, avg_frame_rate 0
[vvc_mp4toannexb @ 000002b3138629c0] nalu_type 15 cnt 1
[vvc_mp4toannexb @ 000002b3138629c0] nalu_type 16 cnt 1
[libvvdec @ 000002b313860e00] Version info: vvdec 2.3.0 ( threads 1)
[libvvdec @ 000002b313860e00] nalu_type 15 cnt 1
[libvvdec @ 000002b313860e00] nal_unit_type: 15(SPS_NUT), nuh_layer_id: 0, temporal_id: 0
[libvvdec @ 000002b313860e00] nalu_type 16 cnt 1
[libvvdec @ 000002b313860e00] nal_unit_type: 16(PPS_NUT), nuh_layer_id: 0, temporal_id: 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002b313811140] After avformat_find_stream_info() pos: 147095 bytes read:188539 seeks:2 frames:1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : 
  Duration: 00:00:23.89, start: 0.000000, bitrate: 2250 kb/s
  Stream #0:0[0x1](und), 1, 1/1200000: Video: vvc (libvvdec) (Main 10), 1 reference frame (vvc1 / 0x31637676), yuv420p10le(tv, left), 45495x45495, 0/1, 2228 kb/s, 29.97 fps, 29.97 tbr, 1200k tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
[libvvdec @ 000002b313860e00] [IMGUTILS @ 000000f761dff560] Picture size 45495x45495 is invalid
Could not open codec for input stream 0

The only problem is external FFmpeg VVC decoder (vvdec) which is bit weird too much resolution size :/.

You may need to submit the your file and also MP4 mux file to Fraunhofer VVdec on GitHub by creating issue: https://github.com/fraunhoferhhi/vvdec/issues

If that doesn't still solve the problem, you might need to contact FFmpeg developers by IRC chat (you can use example Kiwi IRC or Matrix.org).

Feel free to reply or ask question to me. Thank you! :)

Best regards,

jiangzemin-xudamin commented 2 months ago

@MartinEesmaa Thank you very much for your answer, I think maybe I should try the vvdec executable instead of your modified ffmpeg-vvc. I'm afraid that the developers of Fraunhofer VVdec may not intend to provide tech support for the modified version of ffmpeg.