0

I am using the following line in Python to compress videos into h265 (in Google Colab).

!ffmpeg -v error -nostats -hwaccel_output_format cuda -i "$input_folder/{filename}" -metadata comment="HEVC{cq}" -c:v hevc_nvenc -preset:v slow -rc vbr -cq 30 -qmin 30 -qmax 30 -b:v 0 2>"$output_folder/logs/{filename} (30).txt" -profile:v main10 -c:a copy "$output_folder/{filename.rpartition('.')[0]} ({cq}).$output_file_type"

I came across a guide that mentions that using some x265-params would result in better results. Though, using different parameters does not impact output file size nor quality. It is as if I am not using the parameters. Here are some examples of me using the parameters:

!ffmpeg -v error -nostats -hwaccel_output_format cuda -i "$input_folder/{filename}" -metadata comment="HEVC{cq}" -c:v hevc_nvenc -preset:v slow -rc vbr -cq 30 -qmin 30 -qmax 30 -b:v 0 2>"$output_folder/logs/{filename} (30).txt" -profile:v main10 -x265-params bframes=8:psy-rd=1:aq-strength=0.6:deblock=1,1:aq-mode=3 -c:a copy "$output_folder/{filename.rpartition('.')[0]} ({cq}).$output_file_type"
!ffmpeg -v error -nostats -hwaccel_output_format cuda -i "$input_folder/{filename}" -metadata comment="HEVC{cq}" -c:v hevc_nvenc -preset:v slow -rc vbr -cq 30 -qmin 30 -qmax 30 -b:v 0 2>"$output_folder/logs/{filename} (30).txt" -profile:v main10 -x265-params limit-sao:bframes=8:psy-rd=1:aq-mode=3 -c:a copy "$output_folder/{filename.rpartition('.')[0]} ({cq}).$output_file_type"
!ffmpeg -v error -nostats -hwaccel_output_format cuda -i "$input_folder/{filename}" -metadata comment="HEVC{cq}" -c:v hevc_nvenc -preset:v slow -rc vbr -cq 30 -qmin 30 -qmax 30 -b:v 0 2>"$output_folder/logs/{filename} (30).txt" -profile:v main10 -x265-params bframes=8:psy-rd=1:aq-mode=3 -c:a copy "$output_folder/{filename.rpartition('.')[0]} ({cq}).$output_file_type"

Would appreciate any information regarding this issue.

6
  • 1
    The main issue is you're using the GPU (Nvidia). It's faster but always produce much bigger files and there's nothing you can change because it uses the "hardcoded" codec. You mustn't use the GPU, only the CPU (i.e. the software codec), for recording if you want smaller files. Commented May 31 at 22:20
  • 1
    You may want to read the comments here: superuser.com/q/1841240/653259 Commented May 31 at 22:23
  • @ChanganAuto Are the x265-params parameters ignored on hevc_nvenc? I actually tried using the CPU on Google Colab (libx265 encoder) but after around 2 hours the the process of encoding was still going for a small file of 500mb size. Not sure if this is supposed to take more than 2 hours.
    – wanderer
    Commented Jun 1 at 0:45
  • 2
    x265-params is relevant only with -c:v libx265, a software H.265 encoder, hevc_nvenc is a nVidia GPU-based H.265 encoder.
    – Gyan
    Commented Jun 1 at 4:46
  • @Gyan ChanganAuto Thank you for the information.
    – wanderer
    Commented Jun 1 at 9:20

0

You must log in to answer this question.

Browse other questions tagged .