[FFmpeg-user] How can I simplify these two scale calculations?

Moritz Barsnick barsnick at gmx.net
Thu Aug 6 23:39:30 CEST 2015


On Thu, Aug 06, 2015 at 14:15:22 -0700, ogrgkyle wrote:
> Here is my command:

Because nabble (what is that) seems to cut everything away, let me
quote from here:

> View this message in context: http://ffmpeg-users.933282.n4.nabble.com/How-can-I-simplify-these-two-scale-calculations-tp4671742.html

ffmpeg.exe -y -i "myvideo.avi" -vf "yadif=0:-1:0,framestep=2,scale=iw*sar:ih,scale=-2:ih/3.3333" -c:v libx265 -preset placebo -b:v 53.905k -pass 1 -ac 1 -cutoff 12000 -c:a libopus -b:a 16k -vbr 1 -f matroska NUL && \
ffmpeg.exe -y -i "myvideo.avi" -vf "yadif=0:-1:0,framestep=2,scale=iw*sar:ih,scale=-2:ih/3.3333" -c:v libx265 -preset placebo -b:v 53.905k -pass 2 -ac 1 -cutoff 12000 -c:a libopus -b:a 16k -vbr 1 "myvideo.mkv"

> How can I simplify the two "scale" calculations into one?  (The first one
> converts to square pixels, and the second one sets the resolution to 1/3 of
> the original dimensions.)

May I point out: Diving by 3.3333 is not "to 1/3", it's "to 1/3.3333",
which is "3/10". Are you sure that's what you're trying to achive?

Let me stick with 3 instead of 3.3333: It's simple math:
  -vf "scale=iw/3*sar:ih/3"

In the second scale, while you ensure that the width is divisible by 2
("-2"), the height can be quite arbitrary, though it will be an even
number for "standard" input heights (360, 480, 720, 1080...).

> Also, can you suggest anything else to improve encoding efficiency
> without sacrificing quality? (The quality settings are already really
> low and I don't want to lower them further.)

I have no experience with libx265, but: Is placebo useful at all? With
libx264, it isn't really.

Moritz


More information about the ffmpeg-user mailing list