slop
slop copied to clipboard
add outputs for width and height rounded to even numbers
having even number outputs is nice because then you can use -pix_fmt yuv420p with ffmpeg when recording the screen. This results in smaller file sizes and better hardware support.
#!/bin/bash
geometry=$(slop -f "-video_size %mx%n -i $DISPLAY.0+%x,%y")
ffmpeg -y -framerate 60 -f x11grab $geometry -pix_fmt yuv420p "$1"
Otherwise, ffmpeg will complain:
[libx264 @ 0x562cfa9437c0] height not divisible by 2 (52x125)
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