VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Member
    Join Date
    May 2013
    Location
    Staffordshire
    Search Comp PM
    I'm trying to convert my h264 video into hevc file and maximize my graphics card to encode.
    The original h264 file size is 99.2MB

    For the CPU command, I use
    ffmpeg -hwaccel cuda -i input.mp4 -c:v libx265 test1.mp4
    test1.mp4 is 76.1MB

    For the GPU command, I use
    ffmpeg -hwaccel cuda -i input.mp4 -c:v hevc_nvenc test2.mp4
    test2.mp4 is 540MB

    But I found the bitrate for test1.mp4 is 262kb/s and for test2.mp4 is 1864kb/s, my original is 342kb/s

    Why the bitrate for default nvenc encoder is much larger than libx265 encoder?
    What's the command for nvenc encoder to imitate libx265 default behavior?
    Quote Quote  
  2. Different encoders have different defaults. And different encoders have different abilities. So you can't expect different encoders to deliver the same file size (bitrate) by default. If you adjust the settings to get the same size the quality will not be the same. And even if you adjust the settings so that the encoders deliver the same size/quality for a particular video, they may not deliver the same size/quality with a different video.

    I don't use nvnec so I can't give you specific recommendations for it. But if you want the same bitrate (and hence size) you can always use bitrate based encoding and specify the same bitrate.
    Quote Quote  
  3. You could try something like this and adjust the compression (and quality) with the -cq xx parameter:

    Code:
    ffmpeg.exe -i input.mp4  -c:v h264_nvenc -preset:v bd -profile:v high -level 41 -2pass 1 -maxrate 40000k -bufsize 30000k -b:v 0k -cq 22 -refs:v 0 -bf 3 -rc vbr_hq -b_adapt 1 -rc-lookahead 32 -nonref_p 1 -b_ref_mode 2 -pix_fmt yuv420p  "output.mp4"
    Edit:
    Ooops, I just noted that you want x265 rather than x264. I have little experience with x265 settings, so I can't really help....
    Quote Quote  
  4. Member
    Join Date
    May 2013
    Location
    Staffordshire
    Search Comp PM
    Originally Posted by Sharc View Post
    You could try something like this and adjust the compression (and quality) with the -cq xx parameter:

    Code:
    ffmpeg.exe -i input.mp4  -c:v h264_nvenc -preset:v bd -profile:v high -level 41 -2pass 1 -maxrate 40000k -bufsize 30000k -b:v 0k -cq 22 -refs:v 0 -bf 3 -rc vbr_hq -b_adapt 1 -rc-lookahead 32 -nonref_p 1 -b_ref_mode 2 -pix_fmt yuv420p  "output.mp4"
    Edit:
    Ooops, I just noted that you want x265 rather than x264. I have little experience with x265 settings, so I can't really help....
    did as instructed. no good.

    [h264_nvenc @ 000001a6ae8f58c0] The selected preset is deprecated. Use p1 to p7 + -tune or fast/medium/slow.
    [h264_nvenc @ 000001a6ae8f58c0] Specified rc mode is deprecated.
    [h264_nvenc @ 000001a6ae8f58c0] Use -rc constqp/cbr/vbr, -tune and -multipass instead.
    [h264_nvenc @ 000001a6ae8f58c0] InitializeEncoder failed: invalid param (8): Presets P1 to P7 are not supported with older 2 Pass RC Modes(CBR_HQ, VBR_HQ) and cbr lowdelay.
    Enable NV_ENC_RC_PARAMS::multiPass flag for two pass encoding a
    Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
    [aac @ 000001a6ae8f7c80] Qavg: 30008.844
    [aac @ 000001a6ae8f7c80] 2 frames left in the queue on closing
    Conversion failed!Image
    [Attachment 61440 - Click to enlarge]
    Quote Quote  
  5. ffmpeg -y -hwaccel cuda -i "input.mp4" -c:v hevc_nvenc -b:v 250k -c:a aac -b:a 96k "output.mp4"
    Specify bitrate with -b:v or you can tool around with adjusting cq settings until you get your desired output bitrate / size:
    ffmpeg -y -hwaccel cuda -i "input.mp4" -c:v hevc_nvenc -preset p6 -b:v 0 -cq 24 -qmin 22 -qmax 26 -c:a copy output.mp4
    -c:a copy specifies to copy the audio, if you don't the audio in encoded at a default bitrate
    -c:s specifies to copy the subtitle
    -b:v must be set to 0 for -cq to work
    -cq x specifies the quality you're aiming for, not quite crf but treat it similarly
    -qmin and -qmax may be used to give extra headroom for lower and higher bitrates if needed for less or more complex scenes respectively but can be left out
    Last edited by blud7; 25th Oct 2021 at 08:52.
    Quote Quote  
  6. Banned
    Join Date
    Aug 2020
    Location
    Cumi
    Search PM
    Originally Posted by wonmanfactory View Post
    I'm trying to convert my h264 video into hevc file and maximize my graphics card to encode.
    The original h264 file size is 99.2MB

    For the CPU command, I use
    ffmpeg -hwaccel cuda -i input.mp4 -c:v libx265 test1.mp4
    test1.mp4 is 76.1MB

    For the GPU command, I use
    ffmpeg -hwaccel cuda -i input.mp4 -c:v hevc_nvenc test2.mp4
    test2.mp4 is 540MB

    But I found the bitrate for test1.mp4 is 262kb/s and for test2.mp4 is 1864kb/s, my original is 342kb/s

    Why the bitrate for default nvenc encoder is much larger than libx265 encoder?
    What's the command for nvenc encoder to imitate libx265 default behavior?
    Why do you use FFMPEG for Hardware encoding, despite there is less options/functions, FFMPEG is slower and had worse quality than proper encoders like Rigaya's NVENC ?
    Quote Quote  
  7. My question is why convert the original h264 file to h265, you will gain nothing.
    Quote Quote  
  8. Member
    Join Date
    May 2013
    Location
    Staffordshire
    Search Comp PM
    Originally Posted by Truthler View Post
    Originally Posted by wonmanfactory View Post
    I'm trying to convert my h264 video into hevc file and maximize my graphics card to encode.
    The original h264 file size is 99.2MB

    For the CPU command, I use
    ffmpeg -hwaccel cuda -i input.mp4 -c:v libx265 test1.mp4
    test1.mp4 is 76.1MB

    For the GPU command, I use
    ffmpeg -hwaccel cuda -i input.mp4 -c:v hevc_nvenc test2.mp4
    test2.mp4 is 540MB

    But I found the bitrate for test1.mp4 is 262kb/s and for test2.mp4 is 1864kb/s, my original is 342kb/s

    Why the bitrate for default nvenc encoder is much larger than libx265 encoder?
    What's the command for nvenc encoder to imitate libx265 default behavior?
    Why do you use FFMPEG for Hardware encoding, despite there is less options/functions, FFMPEG is slower and had worse quality than proper encoders like Rigaya's NVENC ?
    i don't really know. I just want to compress my files.
    I have got no clue how I can size it down but keep the quality.
    265 seems more advanced than 264?
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!