rigaya / VCEEnc

VCEによる高速エンコードの性能実験

Home Page:https://rigaya34589.blog.fc2.com/blog-category-12.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

--fps <int> flag doesn't properly set rendering FPS of resulting video

DimkaTsv opened this issue · comments

I tried to upscale video to 8k, but as my system only supports HW decode of 8k30 FPS, i needed to downsample source from 60 FPS to 30 FPS
For that i used --fps flag, and i will give it that it technically worked... It set source FPS to 30, as well as resulting video FPS to 30. Granted i cannot check if video became slowed down or not, granted it shouldn't have been as their length is same.
Anyways... To the bug itself
Despite properly masking input as 30 FPS from 60, and setting resulting video to 30 FPS in mediainfo as well, when i play such video, it actually tries to be played at 60FPS for some reason, which cause HW encoder overflow and hence HUGE performance degradation.

As i only have 6750XT, i could only find it on HEVC (and likely HEVC10) profiles. But i cannot check AV1, so i will assume there is same issue with it.

Also, it seems like it actually rendered at 60 FPS, just shows in mediadata that it is 30 for some reason... But players actually try to play it at 60.
Used command:
F:\Renders>C:\Users----\Desktop\Utilites\VCE_Encoder\VCEEncC_8.12_x64\VCEEncC64.exe -i F:\Renders\fast_sample.mkv -o "fast_sample_test.mkv" --output-res 7680x4320 --fps 30 --codec hevc --profile main --tier high --level 6.2 --ref 4 --vbr 20000 --max-bitrate 40000 --colorrange auto --colormatrix auto --colorprim auto --transfer auto --chromaloc auto --max-cll copy --master-display copy --atc-sei auto --vbaq --audio-copy

Log data (VPS0 and SPS0 come from source, which is Adrenaline screen recording... They are gone after transcoding):

F:\Renders>C:\Users\DimkaTsv\Desktop\Utilites\VCE_Encoder\VCEEncC_8.12_x64\\VCEEncC64.exe -i F:\Renders\fast_sample.mkv -o "fast_sample_test.mkv" --output-res 7680x4320 --fps 30 --codec hevc --profile main --tier high --level 6.2 --ref 4 --vbr 20000 --max-bitrate 40000 --colorrange auto --colormatrix auto --colorprim auto --transfer auto --chromaloc auto --max-cll copy --master-display copy --atc-sei auto --vbaq --audio-copy
--------------------------------------------------------------------------------
fast_sample_test.mkv
--------------------------------------------------------------------------------
avvce/avsw: Unknown input option: framerate=30/1, ignored.
[hevc @ 000001cef32c1bc0] VPS 0 does not exist
[hevc @ 000001cef32c1bc0] SPS 0 does not exist.
[hevc @ 000001cef32b7940] VPS 0 does not exist
[hevc @ 000001cef339b6c0] VPS 0 does not exist
VCEEnc (x64) 8.12 (r1466) by rigaya, May  4 2023 07:34:56 (VC 1934/Win)
OS:            Windows 11 x64 (22621) [UTF-8]
CPU:           AMD Ryzen 7 5800X3D 8-Core Processor [4.44GHz] (8C/16T)
GPU:           AMD Radeon RX 6750 XT [31.0.14057.5006]
AMF:           Runtime 1.4.29 / SDK 1.4.29
Input Info:    avvce: H.265/HEVC, 3840x2160, 30/1 fps
VPP            HQscaler: 3840x2160 -> 7680x4320, bicubic, sharpness 0.0
Output:        H.265/HEVC  main @ Level 6.2 (high tier)
               7680x4320p 0:0 30.000fps (30/1fps)
               avwriter: hevc, aac => matroska
Quality:       balanced
VBR:           20000 kbps
Max bitrate:   40000 kbps
QP:            Min: 0:0, Max: 51:51
VBV Bufsize:   20000 kbps
Bframes:       0 frames
Pre Analysis:  off
Ref frames:    4 frames
LTR frames:    0 frames
Motion Est:    Q-pel
Slices:        1
GOP Len:       300 frames
VUI:              matrix:bt709,colorprim:bt709,transfer:bt709,range:limited,chromaloc:left
Others:        skipframe:on deblock vbaq

encoded 454 frames, 25.19 fps, 19486.47 kbps, 35.15 MB
encode time 0:00:18, CPU: 0.1%, GPU: 8.9%, VE: 97.5%
frame type IDR   2
frame type I     2,  avgQP  32.50,  total size   1.08 MB
frame type P   452,  avgQP  32.91,  total size  34.08 MB

Resulting video mediainfo

General
Unique ID                      : 231721281932482718263229988174116617165 (0xAE53E5439673E11C4749F26DFB3EFBCD)
Complete name                  : F:\Renders\fast_sample_test.mkv
Format                         : Matroska
Format version                 : Version 4
File size                      : 35.3 MiB
Duration                       : 7 s 567 ms
Overall bit rate               : 39.2 Mb/s
Frame rate                     : 30.000 FPS
Writing application            : VCEEnc (x64) 8.12
Writing library                : Lavf59.37.100
ErrorDetectionType             : Per level 1

Video
ID                             : 1
Format                         : HEVC
Format/Info                    : High Efficiency Video Coding
Format profile                 : Main@L6.2@High
Codec ID                       : V_MPEGH/ISO/HEVC
Duration                       : 7 s 567 ms
Width                          : 7 680 pixels
Height                         : 4 320 pixels
Display aspect ratio           : 16:9
Frame rate mode                : Constant
Frame rate                     : 30.000 FPS
Color space                    : YUV
Chroma subsampling             : 4:2:0 (Type 0)
Bit depth                      : 8 bits
Default                        : Yes
Forced                         : No
Color range                    : Limited
Color primaries                : BT.709
Transfer characteristics       : BT.709
Matrix coefficients            : BT.709

Audio
ID                             : 2
Format                         : AAC LC
Format/Info                    : Advanced Audio Codec Low Complexity
Codec ID                       : A_AAC-2
Duration                       : 7 s 466 ms
Channel(s)                     : 2 channels
Channel layout                 : L R
Sampling rate                  : 48.0 kHz
Frame rate                     : 46.875 FPS (1024 SPF)
Compression mode               : Lossy
Delay relative to video        : 15 ms
Title                          : Stereo
Default                        : Yes
Forced                         : No

And resulting performance degradation caused by incorrectly encoded framerate
On fullscreen player such video just have lower FPS (about 54 instead of 60) so latency constantly climbs up.
image

On windowed player though, it causes complete mess of a stutters instead
image

As you can see despite mediadata player tries to play video at 60FPS

I got properly encoded to 30 FPS video via Handbrake (but i still would like to use VCEEncC as quality is much better), and it plays as intended.
image

Metadata of video resulting from Handbrake

General
Complete name                  : F:\Renders\fast_sample_handbrake_8k30 test.mp4
Format                         : MPEG-4
Format profile                 : Base Media / Version 2
Codec ID                       : mp42 (mp42/iso2/mp41)
File size                      : 18.3 MiB
Duration                       : 7 s 557 ms
Overall bit rate               : 20.3 Mb/s
Frame rate                     : 30.041 FPS
Encoded date                   : 2023-06-07 22:56:29 UTC
Tagged date                    : 2023-06-07 22:56:29 UTC
Writing application            : HandBrake 20230604102418-f57897a9b-master 2023060501

Video
ID                             : 1
Format                         : HEVC
Format/Info                    : High Efficiency Video Coding
Format profile                 : Main@L6.2@Main
Codec ID                       : hvc1
Codec ID/Info                  : High Efficiency Video Coding
Duration                       : 7 s 557 ms
Bit rate                       : 20.1 Mb/s
Width                          : 7 680 pixels
Height                         : 4 320 pixels
Display aspect ratio           : 16:9
Frame rate mode                : Variable
Frame rate                     : 30.041 FPS
Minimum frame rate             : 25.210 FPS
Maximum frame rate             : 60.000 FPS
Original frame rate            : 30.000 FPS
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Bits/(Pixel*Frame)             : 0.020
Stream size                    : 18.1 MiB (99%)
Encoded date                   : 2023-06-07 22:56:29 UTC
Tagged date                    : 2023-06-07 22:56:29 UTC
Color range                    : Limited
Color primaries                : BT.709
Transfer characteristics       : BT.709
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                       : 7 s 488 ms
Source duration                : 7 s 509 ms
Bit rate mode                  : Constant
Bit rate                       : 173 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
Stream size                    : 159 KiB (1%)
Source stream size             : 159 KiB (1%)
Title                          : Stereo
Default                        : Yes
Alternate group                : 1
Encoded date                   : 2023-06-07 22:56:29 UTC
Tagged date                    : 2023-06-07 22:56:29 UTC


Unfortunately, VCEEnc does not have feature to convert framerate, it is recommended to use Avisynth or VapourSynth for that purpose, as VCEEnc has Avisynth/VapourSynth reader.

Oh, i see. So framerate mark is basically only here to state framerate of raw input if you ever use one. I just thought it could modify fps of existing source as well, but i was wrong. Welp, seems like next time i will need to change framerate, will be time for me to learn how to properly pipe thread processed by fps conversion).
Sometimes it's hard to be not very good in command line interface stuff. Takes a lot more time to figure things out.

Anyways, thanks for answer!
Issue closed.