How to use the x264 encoding presets when rendering an XGES project
x264 has a few generic
encoding presets you can use when rendering. You can see the list of
presets and exactly what encoding options they specify by running
x264 --fullhelp
.
You’ll most probably notice the following presets: ultrafast
, superfast
,
veryfast
, faster
, fast
, medium
, slow
, slower
, veryslow
.
Ideally you’d always use veryslow
when rendering, but you can't always wait for it to finish, so you go
for faster ones. The ffmpeg wiki summarizes the difference between
these presets:\
veryslow
helps about 3% compared to theslower
preset,slower
helps about 5% compared to theslow
preset, andslow
helps about 5-10% compared to themedium
preset.
To be able to use for example slow
with ges-launch-1.0
,
you need to create a GStreamer preset. Add the following section to
~/.local/share/gstreamer-1.0/presets/GstX264Enc.prs
[slow12mbps]
speed-preset=slow
bitrate=12288
You need to specify a bitrate in kbits per second because the default value of 2048 kbits per second might not be what you want. I picked 12288 because it’s what YT recommends for 1920x1080p50. See the documentation for the x264enc plugin to see all the options you can specify in the preset.
You might also be interested in specifying a tune:
tune=stillimage
or a psy-tune:
psy-tune=film
Other possible tune values are: film
, animation
, grain
, psnr
, ssim
.
For the complete list see the plugin source
code.
To use the new preset, run:
$ ges-launch-1.0 -l pitivi-project.xges -o out.mp4 \
-f "video/quicktime,variant=iso:video/x-raw,width=1920,height=1080->video/x-h264+slow12mbps:audio/mpeg,mpegversion=1,layer=3"
The -f
parameter accepts a serialized encoding
profile.