all videos with %i_height% equal 256px

Questions and answers on how to get the most out of FFAStrans
Post Reply
buddhabas
Posts: 19
Joined: Tue Oct 04, 2022 9:03 pm

all videos with %i_height% equal 256px

Post by buddhabas »

Hello to all,
I need to resize a group of videos so that they have:

%i_height% = 256px

Ex.: if I have a video 1920x1080p I will have a video 456x256.

Important
455 is correct but there need be rounded to 456 obviously

Thank you! ;)

Ps
I need to mimic ffmpeg option: -vf scale=-2:256
emcodem
Posts: 1815
Joined: Wed Sep 19, 2018 8:11 am

Re: all videos with %i_height% equal 256px

Post by emcodem »

You can use s_options just as in my other example i posted to you before with nvenc.
It goes like: disable encoding - calculate the encoding cmd - modify the encoding cmd - execute encoding in a cmd proc
emcodem_s_options_insert_scale.json
(8.17 KiB) Downloaded 42 times
When you replace stuff in the internally calculated encoding cmd, you must make sure that it works in all cases, e.g. in this case i replace

Code: Select all

-vf 
by

Code: Select all

-vf scale=-2:256,
Note the comma after 256, it is because other filter already exist in the encoding cmd.


Why did i choose this? Because -vf is always there, independent of the source file, the internally calculated ffastrans encoding cmd will always have carry exactly one "-vf" character.

Real life example:

Code: Select all

-vf sidedata=delete,metadata=delete,setrange=tv,scale=interl=1,format=yuv422p,bwdif=mode=0:parity=0,format=yuv420p,setfield=prog,setsar=r=1:max=1
The internally calculated encoding cmd looks like this. it does not have any scale filter because the h264 processor was set to encode to the same resolution as input has.
Now we can safely replace -vf as stated above, resulting in this filter cmd:

Code: Select all

-vf scale=-2:256,sidedata=delete,metadata=delete,setrange=tv,scale=interl=1,format=yuv422p,bwdif=mode=0:parity=0,format=yuv420p,setfield=prog,setsar=r=1:max=1
voila, we successfully inserted your desired scale filter into the internally calculated encoding command, from here we just need to execute the encoding in a cmd processor, see attached workflow example.

Of course, nothing speaks against combining this exapmle with the nvenc one and replacing libx264 by h264_nvenc (along with the profile settings)
emcodem, wrapping since 2009 you got the rhyme?
Post Reply