Opened 17 months ago

Closed 17 months ago

Last modified 17 months ago

#10402 closed defect (fixed)

Seeking issues with HEVC_NVENC transcode in MP4 format & 23.976 FPS

Reported by: LarLei Owned by:
Priority: important Component: ffmpeg
Version: 6.0 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by LarLei)

Hello,

  1. What you were trying to accomplish:

Transcode from AVC to HEVC with NVENC.

  1. The problem you encountered:

The transcoded video has seeking issues. Specifically, it does not seek forward or backward correctly. And the video and audio do not synced correctly (the video is only a still image while the audio continues on).

This seems to be a regression because the seeking issues do not exist with ffmpeg version 2023-04-03-git-6941788d24-full_build-www.gyan.dev.

The seeking issues are confirmed to exist with:
ffmpeg version 2023-04-06-git-b564ad8eac-full_build-www.gyan.dev
ffmpeg version 2023-05-31-git-baa9fccf8d-full_build-www.gyan.dev

These seeking issues seem to only exist if the output is in MP4 format. If the output is MKV format (i.e. change the output file extension to .mkv) the there are no seeking issues.

These seeking issues seem to only exist if the input video is 23.976 FPS. 30 FPS and 60 FPS input videos do not exhibit seeking issues after transcoded.

FFplay and PotPlayer are used to verify the seeking functionality.

  1. The exact command line you were using:
    ffmpeg -report -benchmark -hwaccel cuda -i "lg-uhd-secret-garden-(www.demolandia.net).mkv" -c:v hevc_nvenc -fps_mode:v passthrough -pix_fmt p010le -rc:v vbr -cq:v 0 -b:v 23M -maxrate:v 23M -bufsize:v 23M -preset p5 -multipass 1 -bf:v 3 -b_ref_mode:v 2 -rc-lookahead:v 32 -refs:v 16 -map 0:v -map 0:a -map_metadata:g -1 -metadata:s:v creation_time="" -metadata:s:v handler_name="" -metadata:s:v vendor_id="" -metadata:s:a creation_time="" -metadata:s:a handler_name="" -metadata:s:a vendor_id="" -c:a copy -n "D:\Test\lg-uhd-secret-garden-(www.demolandia.net).NVENC10.mp4"
    
  1. The full, uncut console output provided by ffmpeg -v 9 -loglevel 99 -i followed by the name of your input file:
    D:\Test\2>ffmpeg -v 9 -loglevel 99 -i "lg-uhd-secret-garden-(www.demolandia.net).mkv"
    ffmpeg version 2023-05-31-git-baa9fccf8d-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
      built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
      configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
      libavutil      58. 12.100 / 58. 12.100
      libavcodec     60. 16.100 / 60. 16.100
      libavformat    60.  5.100 / 60.  5.100
      libavdevice    60.  2.100 / 60.  2.100
      libavfilter     9.  8.101 /  9.  8.101
      libswscale      7.  3.100 /  7.  3.100
      libswresample   4. 11.100 /  4. 11.100
      libpostproc    57.  2.100 / 57.  2.100
    Splitting the commandline.
    Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
    Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
    Reading option '-i' ... matched as input url with argument 'lg-uhd-secret-garden-(www.demolandia.net).mkv'.
    Finished splitting the commandline.
    Parsing a group of options: global .
    Applying option v (set logging level) with argument 9.
    Successfully parsed a group of options.
    Parsing a group of options: input url lg-uhd-secret-garden-(www.demolandia.net).mkv.
    Successfully parsed a group of options.
    Opening an input file: lg-uhd-secret-garden-(www.demolandia.net).mkv.
    [AVFormatContext @ 0000018a1f25f040] Opening 'lg-uhd-secret-garden-(www.demolandia.net).mkv' for reading
    [file @ 0000018a1f25f440] Setting default whitelist 'file,crypto,data'
    Probing matroska,webm score:100 size:2048
    [matroska,webm @ 0000018a1f25f040] Format matroska,webm probed with size=2048 and score=100
    st:0 removing common factor 1000000 from timebase
    st:1 removing common factor 1000000 from timebase
    [matroska,webm @ 0000018a1f25f040] Before avformat_find_stream_info() pos: 5584 bytes read:32768 seeks:0 nb_streams:2
    [h264 @ 0000018a1f2712c0] nal_unit_type: 7(SPS), nal_ref_idc: 3
    [h264 @ 0000018a1f2712c0] Decoding VUI
    [h264 @ 0000018a1f2712c0] nal_unit_type: 8(PPS), nal_ref_idc: 3
    For transform of length 128, inverse, mdct_float, flags: [aligned, out_of_place], found 3 matches:
        1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], factors[2]: [2, any], flags: [aligned, out_of_place, inv_only], prio: 544
        2: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: 96
        3: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: -130976
    For transform of length 64, inverse, fft_float, flags: [aligned, inplace, preshuf, asm_call], found 3 matches:
        1: fft_sr_asm_float_avx2 - type: fft_float, len: [64, 131072], factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], prio: 480
        2: fft_sr_asm_float_fma3 - type: fft_float, len: [64, 131072], factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], prio: 448
        3: fft_sr_asm_float_avx - type: fft_float, len: [64, 131072], factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], prio: 416
    Transform tree:
        mdct_inv_float_avx2 - type: mdct_float, len: 128, factors[2]: [2, any], flags: [aligned, out_of_place, inv_only]
            fft_sr_asm_float_avx2 - type: fft_float, len: 64, factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call]
    For transform of length 256, inverse, mdct_float, flags: [aligned, out_of_place], found 3 matches:
        1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], factors[2]: [2, any], flags: [aligned, out_of_place, inv_only], prio: 544
        2: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: 96
        3: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: -130976
    For transform of length 128, inverse, fft_float, flags: [aligned, inplace, preshuf, asm_call], found 3 matches:
        1: fft_sr_asm_float_avx2 - type: fft_float, len: [64, 131072], factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], prio: 480
        2: fft_sr_asm_float_fma3 - type: fft_float, len: [64, 131072], factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], prio: 448
        3: fft_sr_asm_float_avx - type: fft_float, len: [64, 131072], factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], prio: 416
    Transform tree:
        mdct_inv_float_avx2 - type: mdct_float, len: 256, factors[2]: [2, any], flags: [aligned, out_of_place, inv_only]
            fft_sr_asm_float_avx2 - type: fft_float, len: 128, factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call]
    [h264 @ 0000018a1f2712c0] nal_unit_type: 7(SPS), nal_ref_idc: 3
    [h264 @ 0000018a1f2712c0] Decoding VUI
    [h264 @ 0000018a1f2712c0] nal_unit_type: 8(PPS), nal_ref_idc: 3
    [h264 @ 0000018a1f2712c0] nal_unit_type: 6(SEI), nal_ref_idc: 0
    [h264 @ 0000018a1f2712c0] nal_unit_type: 5(IDR), nal_ref_idc: 3
    [h264 @ 0000018a1f2712c0] Format yuv420p chosen by get_format().
    [h264 @ 0000018a1f2712c0] Reinit context to 3840x2160, pix_fmt: yuv420p
    [h264 @ 0000018a1f2712c0] no picture
    [matroska,webm @ 0000018a1f25f040] All info found
    [matroska,webm @ 0000018a1f25f040] stream 0: start_time: 0.083 duration: NOPTS
    [matroska,webm @ 0000018a1f25f040] stream 1: start_time: 0.078 duration: NOPTS
    [matroska,webm @ 0000018a1f25f040] format: start_time: 0.078 duration: 184.69 (estimate from stream) bitrate=46840 kb/s
    [matroska,webm @ 0000018a1f25f040] After avformat_find_stream_info() pos: 2313654 bytes read:2339777 seeks:0 frames:13
    Input #0, matroska,webm, from 'lg-uhd-secret-garden-(www.demolandia.net).mkv':
      Metadata:
        encoder         : libebml v1.3.0 + libmatroska v1.4.1
        creation_time   : 2015-09-26T08:57:10.000000Z
      Duration: 00:03:04.69, start: 0.078000, bitrate: 46840 kb/s
      Stream #0:0(eng), 4, 1/1000: Video: h264 (High), 1 reference frame, yuv420p(tv, bt709, progressive, left), 3840x2160 [SAR 1:1 DAR 16:9], 0/1, 23.98 fps, 23.98 tbr, 1k tbn (default)
      Stream #0:1(eng), 9, 1/1000: Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s (default)
    Successfully opened the file.
    At least one output file must be specified
    [AVIOContext @ 0000018a1f25cec0] Statistics: 2339777 bytes read, 0 seeks
    
  1. Other information:

The source file "lg-uhd-secret-garden-(www.demolandia.net).mkv" can be downloaded at (https://www.demolandia.net/downloads.html?id=96225464) by clicking on "Download the UHD LG - Garden File"

NVIDIA GeForce GTX 1660 Ti (laptop); Turing/7th Gen encoder; Driver 31.0.15.3203

Windows 10 Pro 64-Bit Version 22H2 (OS Build 19045.3031)
PotPlayer (64-Bit) Version 230523(1.7.21916)
FFplay version 2023-05-31-git-baa9fccf8d-full_build-www.gyan.dev

Will upload the transcoded video (lg-uhd-secret-garden-(www.demolandia.net).NVENC10.23.05.31.mp4) with the seeking issues to streams.videolan.org/upload/

Thank you,

Change History (3)

comment:1 by LarLei, 17 months ago

Description: modified (diff)
Resolution: fixed
Status: newclosed

This seeking issue/regression has been resolved as of ffmpeg version 2023-06-15-git-41229ef705-full_build-www.gyan.dev.

Since there has been no response to this ticket, there is no details as to what exactly caused the issue/regression and what was done to fix it.

Since the initial report, the graphic driver has been updated to 31.0.15.3623, but that did not seem to have any affect because even with the new driver, the seeking issue persisted with earlier ffmpeg version: 2023-06-11-git-09621fd7d9-full_build-www.gyan.dev and 2023-06-04-git-b1c3d81e71-full_build-www.gyan.dev.

comment:3 by LarLei, 17 months ago

This looks spot on based on the details and date range when it stopped and started working again. Thanks for sharing!

Note: See TracTickets for help on using tickets.