Crop + pad for free performance in v3 (VEAI does it wrong though)

If you are processing a movie which has a black frame, you can get some free extra performance by cropping the input (= less work for AI) and padding the cropped output with ffmpeg (which essentially doesn’t cost any performance).

Unfortunately, v3 can crop (crop tool in input video window) and pad (choose original output size with letterbox option) but also introduces unnecessary scaling which will result in even worse performance than without cropping.

Therefore, in order to get the free performance, it is necessary to remove the unwanted commands and paste the corrected command into the command line manually.

For this u go to Menu Process/Show Export Command and copy it to the clipboard.
Next paste that into a simple text editor like notepad and fix 2 parts of the command.

  1. Fix first scale command by setting the dimensions to the same values as the cropped dimensions
  2. remove the next scale command completely, it’s not needed

Here is an example with the parts to edit (other parts can be ignored since most of them will depend on your settings)

ffmpeg “-hide_banner” “-nostdin” “-y” “-nostats” “-i” “in.mkv” “-vsync” “0” “-avoid_negative_ts” “1” “-sws_flags” “spline+accurate_rnd+full_chroma_int” “-color_trc” “1” “-colorspace” “1” “-color_primaries” “1” “-filter_complex” “crop=exact=1:w=1920:h=816:x=0:y=128,veai_up=model=ahq-12:scale=0:w=1920:h=816:device=0:vram=1.0:instances=1,scale=w=1920:h=1080:flags=lanczos:threads=0:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1:color=black,scale=out_color_matrix=bt709” “-c:v” “hevc_nvenc” “-profile:v” “main” “-preset” “medium” “-pix_fmt” “yuv420p” “-b:v” “24M” “-map_metadata” “0” “-movflags” "frag_keyframe+empty_moov+delay_moov+use_metadata_tags+write_colr " “-map_metadata:s:v” “0:s:v” “-an” “out.mkv”

After fixing your command (another tip, remove the “-nostats” part so that u can see the progress in the command line), you open a command line from VEAI and paste it there.

This also works when scaling a movie. It’s important to remove the extra scaling and let the ffmpeg pad do the addition of the black frame alone.

2 Likes

Wow. I will sure give it a try… thanks for an amazing tip !!!