10
4
I record my desktop with avconv (aka ffmpeg) and then scale it to 720p.
I recently added to my script so they can select a window with xwininfo and it will record that one specifically.
However, if the output format isn't divisible by 2 the encoder freaks out and I don't get my video.
Is there a way to fix this inside ffmpeg so I don't have to do a bunch of manual math in bash to set the scale values?
Is it possible to have the scale filter subtract/add one to width/height if they're uneven? (round?)
Is it possible to apply another filter after the original scale that could accomplish this? (This would round videos that have an uneven input size and no scaling)
#!/bin/bash
avconv \
-f x11grab -r $fps -s $capturesize -i :0.0$offset \
-vcodec libx264 \
-vf scale=-1:720 \
-pre:v lossless_ultrafast \
-threads 4 \
-y $@
Some old mailing lists suggest a round()
function you can use in the filter but I can't seem to get the syntax right. If it works a scale=round(iw,2):round(ih,2)
filter applied at the end would solve all my problems at once. iw
and ih
don't seem to work.
I use
ceil
insteadtrunc
to get a higher pair number as the case of 16:9 480p – Felipe Alcacibar – 2016-11-02T15:05:53.803