Using conditional filters in FFmpeg
You can use max:
max(x, y)
Return the maximum betweenx
andy
.
Example:
ffmpeg -i input -vf "scale=-1:'max(720,ih)'" output
If I wanted to replace the
-1
with a$width
variable in my script, would there be a way to ensure that$width
is only acted on when the right side (i.e. height) is also upscaled?
Example using if and lt:
ffmpeg -i input -vf "scale='if(lt(ih,720),$width,iw)':'max(720,ih)'" output