Alan
Alan

Reputation: 2086

FFmpeg resize without upscaling

I am working on a script that searches for all media files in the current directory and subdirectories and then batch encodes them to H.265. I was hoping to put in some max frame sizes to make things that are 1080p to be 720p. That is the straightforward part but I have some that are 480p and I don't want those to end up as 720p. How can I modify my ffmpeg filters to take that into account?

The command:

ffmpeg -i input -c:v hevc_nvenc -preset medium -crf 28 -c:a copy output.mp4

Upvotes: 1

Views: 2193

Answers (1)

llogan
llogan

Reputation: 133673

Use:

-vf "scale=-2:min'(720,ih)'"

or

-vf "scale=min'(1280,iw)':-2"

See :

Upvotes: 6

Related Questions