For scaling a video with ffmpeg with a target of 1280px width or height, I use the following filters:
If the source width or height is less than 1280px, the original dimensions will be kept.
If the source width or height is larger than 1280px, the output is scaled to 1280px
Since scaling requires division by 2, the dimensions are calculated and ensured to add up
Change (both) '
1280' to fit your output needs.
Escaping ruins the formatting, click here to get the source in plain text