This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to do a 2-pass rendering (VP9)?

Tags: None
(comma "," separated)
pieq
Registered Member
Posts
2
Karma
0

How to do a 2-pass rendering (VP9)?

Fri Aug 26, 2022 12:47 pm
Hello!

Before creating this topic, I searched the forum. The only existing thread I could find is this one, but it doesn't answer my question. Although I mention VP9 codec, I think my question would apply for most codecs (h264, h265, av1...) since most of them have a 2-pass encoding option.

Why 2-pass encoding?

According to the official FFmpeg documentation about VP9 encoder,

Two-pass is the recommended encoding method for libvpx-vp9 as some quality-enhancing encoder features are only available in 2-pass mode.


Google Developers documentation also suggests 2-pass with some default configuration to encode videos in VP9.

The problem

I'm using Kdenlive 22.04.3. In the Render dialog, I can select "WebM-VP9/Opus (libre)", but when I check "More options", the "2 pass" option is greyed out.

I tried creating another preset based on "WebM-VP9/Opus (libre)", but I couldn't find how to enable 2-pass encoding.

I could not find any documentation on how to enable it, nor how to use it in a preset.

I know 2-pass encoding requires to first write to /dev/null and generates a log file that is then used for the second pass, so I'm not sure how to achieve that directly in Kdenlive.

The workaround

For now, here is what I do:

  1. Render my video using the "FFV1 (ffv1+flac)" lossless format
  2. Run the 2-pass encoding from a terminal with the following FFmpeg command (found in the aforementioned Google Developers page):

Code: Select all
ffmpeg -i tearsofsteel_4k.mov -vf scale=1920x1080 -b:v 1800k \
  -minrate 900k -maxrate 2610k -tile-columns 2 -g 240 -threads 8 \
  -quality good -crf 31 -c:v libvpx-vp9 -c:a libopus \
  -pass 1 -speed 4 tos-1920x1080-24-30fps.webm && \
ffmpeg -i tearsofsteel_4k.mov -vf scale=1920x1080 -b:v 1800k \
  -minrate 900k -maxrate 2610k -tile-columns 3 -g 240 -threads 8 \
  -quality good -crf 31 -c:v libvpx-vp9 -c:a libopus \
  -pass 2 -speed 4 -y tos-1920x1080-24-30fps.webm


It works fine, produces an output with a good balance between the image quality and the file size (my 11 minutes video is around 175 MB). But:

  • It takes much more disk space to first generate a lossless output (my 11 minutes video took around 13 GB)
  • It requires more time to process, since I have to render to lossless, then run the 1st pass, then run the 2nd pass.
  • It's not really user-friendly, which is a shame because I think Kdenlive is actually quite nice to use otherwise!

Questions

So, with all that said:

  • How to use the "2 pass" checkbox in Kdenlive?
  • How to create a preset based on the config provided by the Google Developers documentation that would run the 2 passes during the rendering job?

Thank you!


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot]