#11458 closed defect (fixed)

Input file .mkv with -c:v copy option generates corrupted output when remuxing to raw HEVC container

Reported by: uttam_32472 Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Command to execute:
.\ffmpeg.exe -i .\The_World_in_HDR_in_4K_HDR10_16.7Mbs_3840x2160p59.mkv -vframes 1000 -c:v copy -f hevc out_initial_frames_corrupted.hevc

Input file available at: https://4kmedia.org/the-world-in-hdr-uhd-4k-demo/

Above command generates corrupted output file (out_initial_frames_corrupted.hevc).
It doesn't seem to be playable from vlc player. When trued using ffplay, it shows garbage content for some time in the beginning and later plays ok. ( .\ffplay.exe .\out_initial_frames_corrupted.hevc)

Change History (4)

comment:1 by Marth64, 18 months ago

This appears to occur with -ss too

Please paste full logs next time. I was able to reproduce it, here they are for now:

ffmpeg

$ ffmpeg -i The\ World\ In\ HDR\ 4K\ Demo.mkv -vframes 1000 -c:v copy -f hevc TEST.hevc
ffmpeg version N-118440-g8a6ad9eab2 Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 13 (Ubuntu 13.3.0-6ubuntu2~24.04)
  configuration: --enable-debug=3 --enable-ffplay --enable-gpl --enable-nonfree --enable-ffnvcodec --enable-vulkan --enable-libshaderc --enable-encoder=ffv1_vulkan --enable-libx264 --enable-libfdk_aac --enable-openssl --enable-version3 --enable-demuxer=dvdvideo --enable-libdvdread --enable-libdvdnav --samples=fate-suite/
  libavutil      59. 56.100 / 59. 56.100
  libavcodec     61. 33.100 / 61. 33.100
  libavformat    61.  9.106 / 61.  9.106
  libavdevice    61.  4.100 / 61.  4.100
  libavfilter    10.  9.100 / 10.  9.100
  libswscale      8. 13.100 /  8. 13.100
  libswresample   5.  4.100 /  5.  4.100
  libpostproc    58.  4.100 / 58.  4.100
Input #0, matroska,webm, from 'The World In HDR 4K Demo.mkv':
  Metadata:
    title           : The World in HDR in 4K - Demo-UHD3D.com
    encoder         : libebml v1.3.4 + libmatroska v1.4.5
    creation_time   : 2017-04-24T13:38:07.000000Z
  Duration: 00:02:34.57, start: 0.000000, bitrate: 16726 kb/s
  Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 1k tbn (default)
    Metadata:
      BPS             : 16613443
      BPS-eng         : 16613443
      DURATION        : 00:02:34.555000000
      DURATION-eng    : 00:02:34.555000000
      NUMBER_OF_FRAMES: 9264
      NUMBER_OF_FRAMES-eng: 9264
      NUMBER_OF_BYTES : 320961351
      NUMBER_OF_BYTES-eng: 320961351
      _STATISTICS_WRITING_APP: mkvmerge v11.0.0 ('Alive') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v11.0.0 ('Alive') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2017-04-24 13:38:07
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-04-24 13:38:07
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:1(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default)
    Metadata:
      BPS             : 109558
      BPS-eng         : 109558
      DURATION        : 00:02:34.569000000
      DURATION-eng    : 00:02:34.569000000
      NUMBER_OF_FRAMES: 7450
      NUMBER_OF_FRAMES-eng: 7450
      NUMBER_OF_BYTES : 2116797
      NUMBER_OF_BYTES-eng: 2116797
      _STATISTICS_WRITING_APP: mkvmerge v11.0.0 ('Alive') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v11.0.0 ('Alive') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2017-04-24 13:38:07
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-04-24 13:38:07
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Output #0, hevc, to 'TEST.hevc':
  Metadata:
    title           : The World in HDR in 4K - Demo-UHD3D.com
    encoder         : Lavf61.9.106
  Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 59.94 fps, 59.94 tbr, 1k tbn (default)
    Metadata:
      BPS             : 16613443
      BPS-eng         : 16613443
      DURATION        : 00:02:34.555000000
      DURATION-eng    : 00:02:34.555000000
      NUMBER_OF_FRAMES: 9264
      NUMBER_OF_FRAMES-eng: 9264
      NUMBER_OF_BYTES : 320961351
      NUMBER_OF_BYTES-eng: 320961351
      _STATISTICS_WRITING_APP: mkvmerge v11.0.0 ('Alive') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v11.0.0 ('Alive') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2017-04-24 13:38:07
      _STATISTICS_WRITING_DATE_UTC-eng: 2017-04-24 13:38:07
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Press [q] to stop, [?] for help
[out#0/hevc @ 0x59e1f50e2580] video:41477KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:2KiB muxing overhead: 0.026092%
frame= 1000 fps=0.0 q=-1.0 Lsize=   41488KiB time=00:00:16.78 bitrate=20250.6kbits/s speed= 629x 

ffplay

ffplay TEST.hevc 
ffplay version N-118440-g8a6ad9eab2 Copyright (c) 2003-2025 the FFmpeg developers
  built with gcc 13 (Ubuntu 13.3.0-6ubuntu2~24.04)
  configuration: --enable-debug=3 --enable-ffplay --enable-gpl --enable-nonfree --enable-ffnvcodec --enable-vulkan --enable-libshaderc --enable-encoder=ffv1_vulkan --enable-libx264 --enable-libfdk_aac --enable-openssl --enable-version3 --enable-demuxer=dvdvideo --enable-libdvdread --enable-libdvdnav --samples=fate-suite/
  libavutil      59. 56.100 / 59. 56.100
  libavcodec     61. 33.100 / 61. 33.100
  libavformat    61.  9.106 / 61.  9.106
  libavdevice    61.  4.100 / 61.  4.100
  libavfilter    10.  9.100 / 10.  9.100
  libswscale      8. 13.100 /  8. 13.100
  libswresample   5.  4.100 /  5.  4.100
  libpostproc    58.  4.100 / 58.  4.100
Input #0, hevc, from 'TEST.hevc':  0KB vq=    0KB sq=    0B 
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 25 fps, 59.94 tbr, 1200k tbn
[hevc @ 0x76f96048df40] Invalid collocated_ref_idx: 7.   0B 
[hevc @ 0x76f96048df40] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f9600063c0] Could not find ref with POC 4
[hevc @ 0x76f96046b940] Could not find ref with POC 4    0B 
[hevc @ 0x76f9605f2fc0] Could not find ref with POC 4    0B 
[hevc @ 0x76f9605f2fc0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9606b1380] Could not find ref with POC 4    0B 
[hevc @ 0x76f96076f7c0] Could not find ref with POC 4    0B 
[hevc @ 0x76f96076f7c0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f96082dcc0] Could not find ref with POC 4    0B 
[hevc @ 0x76f96082dcc0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9608ec1c0] Could not find ref with POC 4    0B 
[hevc @ 0x76f9609aa6c0] Could not find ref with POC 4    0B 
[hevc @ 0x76f960b36780] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960f0dc40] CABAC_MAX_BIN : 7
[hevc @ 0x76f960f0dc40] The cu_qp_delta 1094995529 is outside the valid range [-32, 31].
[hevc @ 0x76f960f0dc40] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960fcc140] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f96048df40] The cu_qp_delta 67 is outside the valid range [-32, 31].
[hevc @ 0x76f96048df40] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f96082dcc0] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f9608ec1c0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960a68bc0] Skipping invalid undecodable NALU: 1sq=    0B 
[hevc @ 0x76f960b36780] The cu_qp_delta 128 is outside the valid range [-32, 31].
[hevc @ 0x76f960b36780] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960e4f780] CABAC_MAX_BIN : 7    0KB vq= 1140KB sq=    0B 
[hevc @ 0x76f960e4f780] The cu_qp_delta -1094995529 is outside the valid range [-32, 31].
[hevc @ 0x76f960e4f780] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960f0dc40] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960fcc140] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9600063c0] Skipping invalid undecodable NALU: 1sq=    0B 
[hevc @ 0x76f96046b940] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9605f2fc0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f96082dcc0] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f9608ec1c0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960a68bc0] The cu_qp_delta -131 is outside the valid range [-32, 31].
[hevc @ 0x76f960a68bc0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960b270c0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960b36780] The cu_qp_delta -87 is outside the valid range [-32, 31].
[hevc @ 0x76f960b36780] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960f0dc40] Skipping invalid undecodable NALU: 1sq=    0B 
[hevc @ 0x76f960fcc140] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f96076f7c0] Skipping invalid undecodable NALU: 1sq=    0B 
[hevc @ 0x76f960a68bc0] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f960e4f780] Skipping invalid undecodable NALU: 1sq=    0B 
[hevc @ 0x76f960fcc140] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9600063c0] The cu_qp_delta 48 is outside the valid range [-32, 31].
[hevc @ 0x76f9600063c0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f96046b940] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9605f2fc0] The cu_qp_delta 71 is outside the valid range [-32, 31].
[hevc @ 0x76f9605f2fc0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f96076f7c0] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f96082dcc0] The cu_qp_delta 34 is outside the valid range [-32, 31].
[hevc @ 0x76f96082dcc0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9608ec1c0] The cu_qp_delta 32 is outside the valid range [-32, 31].
[hevc @ 0x76f9608ec1c0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960f0dc40] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f96046b940] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f9605f2fc0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9608ec1c0] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f9609aa6c0] The cu_qp_delta 33 is outside the valid range [-32, 31].
[hevc @ 0x76f9609aa6c0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960a68bc0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960b270c0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960b36780] The cu_qp_delta -100 is outside the valid range [-32, 31].
[hevc @ 0x76f960b36780] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960e4f780] The cu_qp_delta -64 is outside the valid range [-32, 31].
[hevc @ 0x76f960e4f780] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f96048df40] The cu_qp_delta 119 is outside the valid range [-32, 31].
[hevc @ 0x76f96048df40] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f9605f2fc0] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f96082dcc0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9608ec1c0] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f960a68bc0] The cu_qp_delta -41 is outside the valid range [-32, 31].
[hevc @ 0x76f960a68bc0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960b270c0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960e4f780] The cu_qp_delta -81 is outside the valid range [-32, 31].
[hevc @ 0x76f960e4f780] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960fcc140] Skipping invalid undecodable NALU: 1sq=    0B 
[hevc @ 0x76f960241940] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9600063c0] The cu_qp_delta 46 is outside the valid range [-32, 31].
[hevc @ 0x76f9600063c0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f9606b1380] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f960b36780] Skipping invalid undecodable NALU: 1sq=    0B 
[hevc @ 0x76f960f0dc40] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960fcc140] The cu_qp_delta 68 is outside the valid range [-32, 31].
[hevc @ 0x76f960fcc140] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960241940] CABAC_MAX_BIN : 7    0KB vq= 1234KB sq=    0B 
[hevc @ 0x76f960241940] The cu_qp_delta 1094995529 is outside the valid range [-32, 31].
[hevc @ 0x76f960241940] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f96048df40] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9600063c0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9606b1380] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f9608ec1c0] The cu_qp_delta 37 is outside the valid range [-32, 31].
[hevc @ 0x76f9608ec1c0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f9609aa6c0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960a68bc0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960e4f780] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f960f0dc40] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f96076f7c0] The cu_qp_delta -85 is outside the valid range [-32, 31].
[hevc @ 0x76f96076f7c0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960b270c0] The cu_qp_delta 35 is outside the valid range [-32, 31].
[hevc @ 0x76f960b270c0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960a68bc0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960b36780] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960f0dc40] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f9605f2fc0] Skipping invalid undecodable NALU: 1sq=    0B 
[hevc @ 0x76f9606b1380] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9609aa6c0] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f960a68bc0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960e4f780] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f960f0dc40] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960241940] The cu_qp_delta -52 is outside the valid range [-32, 31].
[hevc @ 0x76f960241940] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960fcc140] CABAC_MAX_BIN : 7
[hevc @ 0x76f960fcc140] The cu_qp_delta -1094995529 is outside the valid range [-32, 31].
[hevc @ 0x76f960fcc140] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f96048df40] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f96046b940] The cu_qp_delta 54 is outside the valid range [-32, 31].
[hevc @ 0x76f96046b940] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f9605f2fc0] The cu_qp_delta 67 is outside the valid range [-32, 31].
[hevc @ 0x76f9605f2fc0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f9606b1380] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f9608ec1c0] The cu_qp_delta 64 is outside the valid range [-32, 31].
[hevc @ 0x76f9608ec1c0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960b36780] Skipping invalid undecodable NALU: 1sq=    0B 
[hevc @ 0x76f960fcc140] CABAC_MAX_BIN : 7    0KB vq= 1715KB sq=    0B 
[hevc @ 0x76f960fcc140] The cu_qp_delta -1094995529 is outside the valid range [-32, 31].
[hevc @ 0x76f960fcc140] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960241940] The cu_qp_delta -50 is outside the valid range [-32, 31].
[hevc @ 0x76f960241940] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f9600063c0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9606b1380] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f96076f7c0] The cu_qp_delta 93 is outside the valid range [-32, 31].
[hevc @ 0x76f96076f7c0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960e4f780] CABAC_MAX_BIN : 7    0KB vq= 1690KB sq=    0B 
[hevc @ 0x76f960e4f780] The cu_qp_delta -1094995529 is outside the valid range [-32, 31].
[hevc @ 0x76f960e4f780] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960241940] Skipping invalid undecodable NALU: 1sq=    0B 
[hevc @ 0x76f9605f2fc0] The cu_qp_delta -58 is outside the valid range [-32, 31].
[hevc @ 0x76f9605f2fc0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f9606b1380] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960a68bc0] CABAC_MAX_BIN : 7    0KB vq= 1668KB sq=    0B 
[hevc @ 0x76f960a68bc0] The cu_qp_delta -1094995529 is outside the valid range [-32, 31].
[hevc @ 0x76f960a68bc0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f960b270c0] The cu_qp_delta 127 is outside the valid range [-32, 31].
[hevc @ 0x76f960b270c0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960b36780] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960fcc140] CABAC_MAX_BIN : 7    0KB vq= 1645KB sq=    0B 
[hevc @ 0x76f960fcc140] The cu_qp_delta 1094995529 is outside the valid range [-32, 31].
[hevc @ 0x76f960fcc140] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f96048df40] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f96082dcc0] The cu_qp_delta 32 is outside the valid range [-32, 31].
[hevc @ 0x76f96082dcc0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f9608ec1c0] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f960e4f780] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f960f0dc40] Skipping invalid undecodable NALU: 0sq=    0B 
[hevc @ 0x76f960241940] Skipping invalid undecodable NALU: 1
[hevc @ 0x76f96048df40] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9600063c0] The cu_qp_delta 62 is outside the valid range [-32, 31].
[hevc @ 0x76f9600063c0] Skipping invalid undecodable NALU: 0
[hevc @ 0x76f9606b1380] Skipping invalid undecodable NALU: 0
-7686143364043.65 M-V:  1.992 fd= 114 aq=    0KB vq= 1210KB sq=    0B 
[quit]

comment:2 by Marth64, 18 months ago

Priority: importantnormal
Summary: Input file .mkv with -c:v copy option generates corrupted outputInput file .mkv with -c:v copy option generates corrupted output when remuxing to raw HEVC container

comment:3 by James, 18 months ago

Component: undeterminedavcodec
Status: newopen

comment:4 by James, 18 months ago

Analyzed by developer: set
Reproduced by developer: set
Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.