hellgauss
14th June 2026, 15:14
I do not know if it is a bug or simply I'm missing a flag. Extracting hevc stream from a .mkv repeats global headers even if they are present at each keyframe.
I'm using
ffmpeg version 2026-06-10-git-b29bdd3715-full_build-www.gyan.dev
on Windows 11
Unwanted behaviour reproduction:
rem prepare mkv source
ffmpeg -y -f lavfi -i testsrc -t 75 -pix_fmt yuv420p -c:v libx265 -preset ultrafast -f hevc test0.hevc
mkvmerge --deterministic 1 -o "test.mkv" test0.hevc
rem for reference
mkvextract test.mkv tracks 0:"test_reference.hevc"
rem the unwanted behaviour is here:
ffmpeg -y -i "test.mkv" -c:v copy "test_bug.hevc"
Notes:
- test0.hevc and test_reference.hevc are nearly identical. With a fast hex view it seems that the only difference is in the number of 0x00 at the beginning each NAL unit (two or three 0x00 bytes). They both have four extra NALs at each key frame (SPS+VPS+PPS+SEI).
- test_bug.hevc has eight extra NALs at each keyframe, since they are repeated
- Same workflow with x264 is ok.
I'm using
ffmpeg version 2026-06-10-git-b29bdd3715-full_build-www.gyan.dev
on Windows 11
Unwanted behaviour reproduction:
rem prepare mkv source
ffmpeg -y -f lavfi -i testsrc -t 75 -pix_fmt yuv420p -c:v libx265 -preset ultrafast -f hevc test0.hevc
mkvmerge --deterministic 1 -o "test.mkv" test0.hevc
rem for reference
mkvextract test.mkv tracks 0:"test_reference.hevc"
rem the unwanted behaviour is here:
ffmpeg -y -i "test.mkv" -c:v copy "test_bug.hevc"
Notes:
- test0.hevc and test_reference.hevc are nearly identical. With a fast hex view it seems that the only difference is in the number of 0x00 at the beginning each NAL unit (two or three 0x00 bytes). They both have four extra NALs at each key frame (SPS+VPS+PPS+SEI).
- test_bug.hevc has eight extra NALs at each keyframe, since they are repeated
- Same workflow with x264 is ok.