#11683(avcodec:new): Error encoding to H265 (H264 is ok)
#11683: Error encoding to H265 (H264 is ok) -------------------------------------+------------------------------------- Reporter: rgr | Type: defect Status: new | Priority: important Component: avcodec | Version: 7.1 Keywords: h265 | Blocked By: encoding | Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Summary of the bug: The encoded MP4/H265 file doesn't play correctly and is 2 frames shorter. When I change the codec to H264, everything works fine. ffmpeg reports 465 frames encoded: encoded 465 frames in 46.29s (10.05 fps), 8883.04 kb/s, Avg QP:25.39 [aac @ 000001c87a123040] Qavg: 881.112 In VirtualDub with the latest ffmpeg libraries, the last frames are displayed in random order. Seek-by-frame often causes jumps to the wrong frame (each frame has a label with its number). Magix Vegas only reads 463 frames. After changing the codec in the ffmpeg command to libx264, all problems disappear. https://gcdnb.pbrd.co/images/ZSD7tRo9KuG7.png?o=1 How to reproduce: {{{ % ffmpeg -avisynth_flags +all -i "2025_04_10 20_44_52 (PXL_20250410_204452830).avs" -c:v libx265 -preset slow -crf 19 -pix_fmt yuv420p -c:a aac -b:a 192k "2025_04_10 20_44_52 (PXL_20250410_204452830)(H265).mp4" ffmpeg version 2025-07-23-git-829680f96a-full_build-www.gyan.dev built on 2025-07-23 }}} Files: https://files.fm/u/jq3yzf4za7 (output H265 included) -- Ticket URL: <https://trac.ffmpeg.org/ticket/11683> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11683: Error encoding to H265 (H264 is ok) ---------------------------------------+----------------------------------- Reporter: rgr | Owner: (none) Type: defect | Status: new Priority: important | Component: avcodec Version: 7.1 | Resolution: Keywords: h265 encoding | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ---------------------------------------+----------------------------------- Comment (by rgr): Changing the codec to AV1 also eliminates the problem. -- Ticket URL: <https://trac.ffmpeg.org/ticket/11683#comment:1> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11683: Error encoding to H265 (H264 is ok) ---------------------------------------+----------------------------------- Reporter: rgr | Owner: (none) Type: defect | Status: new Priority: important | Component: avcodec Version: 7.1 | Resolution: Keywords: h265 encoding | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ---------------------------------------+----------------------------------- Comment (by rgr): You don't even need to download my files, just any ffmpeg/libx265 encoded one is enough. -- Ticket URL: <https://trac.ffmpeg.org/ticket/11683#comment:2> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11683: "libx265" generated videos abnormal frames parsing? --------------------------------------+----------------------------------- Reporter: rgr | Owner: (none) Type: defect | Status: new Priority: important | Component: avcodec Version: 7.1 | Resolution: Keywords: libx265 OGOP | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 1 | --------------------------------------+----------------------------------- Changes (by MasterQuestionable): * analyzed: 0 => 1 * cc: MasterQuestionable (added) * keywords: h265 encoding => libx265 OGOP * summary: Error encoding to H265 (H264 is ok) => "libx265" generated videos abnormal frames parsing? Comment: ͏ I guess the cause might be OGOP (Open GOP). ͏ What are the interpreted encoding configs (returned by "libx265")? ͏ (or "Encoding settings" of MediaInfo) ͏ Should: ͏ `ffmpeg -y -v debug -hide_banner -nostdin -nostats -f lavfi -i "testsrc2=1920x1080:30:d=15" -c:v libx265 -preset slow -crf 19 "Out.mkv"` ͏ ; reproduce then? ͏ To explicitly disable OGOP, add: `-x265-params "open-gop=0"` ͏ More tools for output analysis: ͏ `ffprobe -v warning -hide_banner -threads 0 -show_entries "frame" -select_streams v:0 -of "xml" "Out.mkv" -o "Out.mkv.xml"` ͏ https://media-analyzer.pro/app ͏ https://hintfo.com/ -- Ticket URL: <https://trac.ffmpeg.org/ticket/11683#comment:3> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11683: "libx265" generated videos abnormal frames parsing? --------------------------------------+----------------------------------- Reporter: rgr | Owner: (none) Type: defect | Status: new Priority: important | Component: avcodec Version: 7.1 | Resolution: Keywords: libx265 OGOP | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 1 | --------------------------------------+----------------------------------- Comment (by rgr): {{{ General Complete name : C:\Users\Właściciel\Desktop\projekty video\2025-2\2025-05-24 (Odra - Dni Odry)\2025_05_24 08_54_22 (merged, edited, enhanced).mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/iso2/mp41) File size : 1.88 GiB Duration : 9 min 42 s Overall bit rate : 27.7 Mb/s Frame rate : 59.940 FPS Writing application : Voukoder (VEGAS) Video ID : 1 Format : HEVC Format/Info : High Efficiency Video Coding Format profile : Main@L4.1@Main Codec ID : hev1 Codec ID/Info : High Efficiency Video Coding Duration : 9 min 42 s Bit rate : 27.4 Mb/s Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 59.940 (60000/1001) FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.221 Stream size : 1.86 GiB (99%) Writing library : x265 unknown:[Windows][MSVC 1937][64 bit] 8bit+10bit+12bit Encoding settings : cpuid=1111039 / frame-threads=4 / numa- pools=16 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1920x1080 / interlace=0 / total-frames=0 / level- idc=0 / high-tier=1 / uhd-bd=0 / ref=4 / no-allow-non-conformance / no- repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal- layers / open-gop / min-keyint=25 / keyint=250 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=25 / lookahead-slices=4 / scenecut=40 / hist-scenecut=0 / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr- inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=3 / limit-refs=3 / limit-modes / me=3 / subme=3 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=4 / selective-sao=4 / no- early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=19.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no- strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=1 / transfer=11 / colormatrix=1 / chromaloc=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=255 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt- rps / scenecut-bias=0.05 / hist-threshold=0.03 / no-opt-cu-delta-qp / no- aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load- reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine- mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass- dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no- dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp- adaptation-range=1.00 / scenecut-aware-qp=0conformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass Color range : Limited Color primaries : BT.709 Transfer characteristics : xvYCC Matrix coefficients : BT.709 Codec configuration box : hvcC Audio ID : 2 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Codec ID : mp4a-40-2 Duration : 9 min 42 s Source duration : 9 min 42 s Bit rate mode : Constant Nominal bit rate : 261 kb/s Maximum bit rate : 261 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 48.0 kHz Frame rate : 46.875 FPS (1024 SPF) Compression mode : Lossy Source stream size : 18.1 MiB (1%) Default : Yes Alternate group : 1 }}} -- Ticket URL: <https://trac.ffmpeg.org/ticket/11683#comment:4> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11683: "libx265" generated videos abnormal frames parsing? --------------------------------------+----------------------------------- Reporter: rgr | Owner: (none) Type: defect | Status: new Priority: important | Component: avcodec Version: 7.1 | Resolution: Keywords: libx265 OGOP | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 1 | --------------------------------------+----------------------------------- Comment (by rgr): If I save to "out.mkv," there's no problem. If I save to "out.mp4," the problem persists. Logs: https://files.fm/u/5n9f59syke -- Ticket URL: <https://trac.ffmpeg.org/ticket/11683#comment:5> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11683: "libx265" generated videos abnormal frames parsing? -------------------------------------+------------------------------------- Reporter: rgr | Owner: (none) Type: defect | Status: new Priority: important | Component: avformat Version: 7.1 | Resolution: Keywords: libx265 | Blocked By: OGOP mp4 | Blocking: | Reproduced by developer: 0 Analyzed by developer: 1 | -------------------------------------+------------------------------------- Changes (by MasterQuestionable): * component: avcodec => avformat * keywords: libx265 OGOP => libx265 OGOP mp4 Comment: ͏ Would below reproduce? ͏ `ffmpeg -y -v debug -hide_banner -nostdin -nostats -f lavfi -i "testsrc2=320x240:25:d=20" -c:v libx265 -preset slow -crf 19 -x265-params "open-gop=0" "Out.mp4"` ͏ `ffmpeg -y -v debug -hide_banner -nostdin -nostats -f lavfi -i "testsrc2=320x240:25:d=20" -c:v libx265 -preset slow -crf 19 -use_editlist 0 "Out.mp4"` ͏ . ͏ Does it affect ".mov" too? ͏ Need not to post here unspecific logs. ͏ Selected observations shall help more. ͏ And if viable: add attachments to the Trac directly. -- Ticket URL: <https://trac.ffmpeg.org/ticket/11683#comment:6> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11683: "libx265" generated videos abnormal frames parsing? -------------------------------------+------------------------------------- Reporter: rgr | Owner: (none) Type: defect | Status: new Priority: important | Component: avformat Version: 7.1 | Resolution: Keywords: libx265 | Blocked By: OGOP mp4 | Blocking: | Reproduced by developer: 0 Analyzed by developer: 1 | -------------------------------------+------------------------------------- Comment (by rgr): VirtualDub: x265-params "open-gop=0" == no problems, all OK -crf 19 -use_editlist 0 == 1 frame off here and there Vegas (H265 legacy driver): x265-params "open-gop=0" == cuts out the first two frames, so it only sees 498 frames -crf 19 -use_editlist 0 == no problems Vegas (H265 normal driver) + Premiere + Resolve: no problems with both files It seems I was checking in two programs that are causing different problems :/. It's strange, because VirtualDub uses the ffmpeg libraries. I've reported the problem. Thanks for the reply, everything seems to be fine. -- Ticket URL: <https://trac.ffmpeg.org/ticket/11683#comment:7> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11683: "libx265" generated videos abnormal frames parsing? -------------------------------------+------------------------------------- Reporter: rgr | Owner: (none) Type: defect | Status: closed Priority: important | Component: avformat Version: 7.1 | Resolution: wontfix Keywords: mp4 libx265 | Blocked By: OGOP | Blocking: | Reproduced by developer: 0 Analyzed by developer: 1 | -------------------------------------+------------------------------------- Changes (by MasterQuestionable): * keywords: libx265 OGOP mp4 => mp4 libx265 OGOP * resolution: => wontfix * status: new => closed Comment: ͏ What about using both? ͏ `-x265-params "open-gop=0" -use_editlist 0` ͏ This is fundamentally core definition issues of MP4 and H.265. ͏ Beyond what FFmpeg could fix. -- Ticket URL: <https://trac.ffmpeg.org/ticket/11683#comment:8> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11683: "libx265" generated videos abnormal frames parsing? -------------------------------------+------------------------------------- Reporter: rgr | Owner: (none) Type: defect | Status: closed Priority: important | Component: avformat Version: 7.1 | Resolution: wontfix Keywords: mp4 libx265 | Blocked By: OGOP | Blocking: | Reproduced by developer: 0 Analyzed by developer: 1 | -------------------------------------+------------------------------------- Comment (by rgr): Yes, that also works correctly. What is the root cause of such problems (just out of curiosity)? Is it better to use AV1 (for MP4 containers)? -- Ticket URL: <https://trac.ffmpeg.org/ticket/11683#comment:9> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11683: "libx265" generated videos abnormal frames parsing? -------------------------------------+------------------------------------- Reporter: rgr | Owner: (none) Type: defect | Status: closed Priority: important | Component: avformat Version: 7.1 | Resolution: wontfix Keywords: mp4 libx265 | Blocked By: OGOP | Blocking: | Reproduced by developer: 0 Analyzed by developer: 1 | -------------------------------------+------------------------------------- Comment (by MasterQuestionable): ͏ That's an issue of great complexity. ͏ None of the contemporary codecs/containers, are adequately designed toward the theoretical optimality: ͏ Some of them had alike mal-designs, that're causing various absurd issues. ͏ AV1 or not doesn't seem like the core determiner. ͏ Practical workaround: ͏ |*| Don't use OGOP as the concept is buggy. ͏ |*| Avoid MP4 editlist whenever applicable. -- Ticket URL: <https://trac.ffmpeg.org/ticket/11683#comment:10> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
participants (1)
-
FFmpeg