0

My input is an uncompressed video captured from old Hi8 cassettes, mediainfo:

Format                                   : RGB
Codec ID                                 : V_UNCOMPRESSED
Codec ID/Info                            : Raw uncompressed video frames
Duration                                 : 1 h 32 min
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 5:4
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : PAL

I have looked at the sources I could find and tried to come up with the optimal settings for my encoding needs, while also trying out a few dozen combinations, and the best I could come up with looks like this:

ffmpeg -i in.mkv -vf yadif -c:v hevc_nvenc -preset slow -rc:v vbr_hq -cq:v 19 -b:v 2m -maxrate:v 3m -bufsize:v 1m -c:a copy out.mp4

The output's mediainfo is:

Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Format Range@L3@Main
Codec ID                                 : hev1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 20 s 0 ms
Bit rate                                 : 5 142 kb/s
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 5:4
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : PAL
Chroma subsampling                       : 4:4:4
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.496
Stream size                              : 12.3 MiB (97%)
Codec configuration box                  : hvcC

What I have found is that I can increase the -b:v 2m -maxrate:v 3m -bufsize:v 1m options tenfold, and the output still stays the same. How can this be the case? I am thinking I messed up the settings gravely, in this case, could you please correct me and set me to the right ballpark? First I tried without the bitrate options and only -rc:v vbr_hq -cq:v 19, but that resulted in terrible quality and smaller size, and then I found that I need to set the bitrate as well, unlike just the -crf like I used to do with libx265.

Abandoning -preset slow also doesn't change the result.

I have also tried libx265, which I have used beforehand, but that's a 10-20x speed decrease, so I wouldn't want to use it for this 15+ hour project. One thing I see is that with that the chroma subsamplig is 4:2:2, instead of 4:4:4. Setting it to 4:2:0 actually increases the file size, what should I do with this?

Thank you in advance for any help, and please let me know if I should give more information in order to get the help I need.

0

With hevc_nvenc, if cq:v is set, b:v is ignored. Change -cq:v in conjunction with -maxrate:v instead.

1
  • Thank you, now I know! After I read your solution, I tried different settings, and found out that the problem is that I was using m instead of M, resulting in those options basically getting ignored... Shouldn't this be raised as en error by ffmpeg? It certainly throws an error if I only give it a string... I managed to find the default maxrate and bufsize settings, which were 4.8M and 4M respectively, and I just increased the bufsize, the bitrate seems good. Thank you again! – Boba0514 Dec 19 '20 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.