lutris / ffmpeg-nvenc

Build script for FFmpeg with nvenc support
GNU General Public License v3.0
141 stars 47 forks source link

24p DVD defaulting output to 30p framerate #15

Closed fubar-1 closed 7 years ago

fubar-1 commented 7 years ago

I ran into an audio sync problem with staxrip that traced back to nvenc (3.23 (r667)).

Input file was originally bitstream-encoded to .iso using dvdfab 6, later converted .iso was to .mkv using MakeMKV and plays fine (good audio sync) in mpc-hc, etc: ------------------------ MediaInfo Source File ------------------------ G:\DVD\2012\2012.mkv General Complete name : G:\DVD\2012\2012.mkv Format : Matroska Format version : Version 2 File size : 4.78 GiB Duration : 2 h 37 min Overall bit rate mode : Variable Overall bit rate : 4 334 kb/s Encoded date : UTC 2017-10-29 19:24:15 Writing application : MakeMKV v1.10.7 win(x64-release) Writing library : libmakemkv v1.10.7 (1.3.3/1.4.4) win(x64-release)

Video ID : 1 ID in the original source medium : 224 (0xE0) Format : MPEG Video Format version : Version 2 Format profile : Main@Main Format settings : CustomMatrix / BVOP Format, BVOP : Yes Format, Matrix : Custom Format, GOP : Variable Codec ID : V_MPEG2 Codec ID/Info : MPEG 1 or 2 Video Duration : 2 h 37 min Bit rate mode : Variable Bit rate : 3 881 kb/s Maximum bit rate : 9 800 kb/s Width : 720 pixels Height : 480 pixels Display aspect ratio : 16:9 Frame rate mode : Variable Frame rate : 23.976 (23976/1000) FPS Original frame rate : 23.976 (24000/1001) FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Scan order : 2:3 Pulldown Compression mode : Lossy Bits/(Pixel*Frame) : 0.468 Time code of first frame : 01:00:00;15 Time code source : Group of pictures header Stream size : 4.28 GiB (90%) Language : English Default : No Forced : No Original source medium : DVD-Video

Audio ID : 2 ID in the original source medium : 189 (0xBD)128 (0x80) Format : AC-3 Format/Info : Audio Coding 3 Format, Endianness : Big Codec ID : A_AC3 Duration : 2 h 37 min Bit rate mode : Constant Bit rate : 448 kb/s Channel(s) : 6 channels Channel positions : Front: L C R, Side: L R, LFE Sampling rate : 48.0 kHz Frame rate : 31.250 FPS (1536 SPF) Bit depth : 16 bits Compression mode : Lossy Stream size : 506 MiB (10%) Title : Surround 5.1 Language : English Service kind : Complete Main Default : Yes Forced : No Original source medium : DVD-Video

Command line is: NVEncC64.exe --vbrhq 3979 --codec h265 --preset quality --level 5.1 --output-depth 10 --weightp --gop-len 90 --lookahead 32 --qp-init 1 --qp-max 27 --qp-min 24 --vbr-quality 26 --aq --sar 40:33 --vpp-edgelevel -i G:\DVD\2012\2012.mkv -o D:\Temp\StaxRip\2012_temp\2012_new_out.h265

Console output is:

Temporal AQ unsupported. NVEncC (x64) 3.23 (r667) by rigaya, Sep 26 2017 20:51:36 (VC 1900/Win/avx2) OS Version Windows 10 x64 (14393) CPU Intel Core i7-7700K @ 4.20GHz [TB: 4.70GHz] (4C/8T) GPU #0: GeForce GTX 1080 (20 EU) @ 1860 MHz (378.78) NVENC / CUDA NVENC API 8.0, CUDA 8.0, schedule mode: auto Input Buffers CUDA, 36 frames Input Info avcuvid: MPEG2, 720x480, 30000/1001 fps Vpp Filters cspconv(nv12 -> yv12(16bit)) edgelevel: strength 5.0, threshold 20.0, black 0.0, white 0.0 cspconv(yv12(16bit) -> p010) Output Info H.265/HEVC main10 @ Level auto 720x480p 97:80 29.970fps (30000/1001fps) Encoder Preset quality Rate Control VBRHQ Bitrate 3979 kbps (Max: 38400 kbps) Target Quality 26.00 Initial QP I:1 P:1 B:1 QP range I:24-27 P:24-27 B:24-27 VBV buf size auto Lookahead on, 32 frames, Adaptive I, B Insert GOP length 90 frames B frames 0 frames Ref frames 3 frames, LTR: off AQ on CU max / min auto / auto Others mv:auto encoded 227030 frames, 972.17 fps, 792.21 kbps, 715.39 MB encode time 0:03:53, CPU: 6.2, GPU: 19.1, VE: 50.8, GPUClock: 100MHz, VEClock: 119MHz frame type IDR 2523 frame type I 2523, total size 24.70 MB frame type P 224507, total size 690.70 MB

Bug is the framerate detected by nvenc is 30p when mediainfo reports 24p. This issue reproduces in other (all) 24p files.

Adding --fps 23.976 to the command line changes input & output framerates to 24p and fixes the audio-sync problem.

Thanks for sharing nvenc, its a great tool.

strycore commented 7 years ago

Did you find the cause of this? It seems unrelated to the script itself but maybe we missed a compile flag or something.