Thank you for this substantial video software,
I’m trying to come up with a bash script to automate video upscaling based on the Topaz AI Video FFmpeg command.
For some reason when running the script I get different output size each time (a couple of bytes). That’s not the case when I run the exact same command with the UI.
Am I doing something wrong ?
My script is the following:
#--------------------------------------------------------------------------------------------------
# Configuration
#--------------------------------------------------------------------------------------------------
ffmpeg="$topaz/ffmpeg"
export TVAI_MODEL_DIR="$model"
export TVAI_MODEL_DATA_DIR="$model"
#--------------------------------------------------------------------------------------------------
# Run
#--------------------------------------------------------------------------------------------------
# NOTE: This line comes from Topaz Video AI (right click > FFmpeg command).
"$ffmpeg" -y "-hide_banner" "-i" "$1" "-sws_flags" "spline+accurate_rnd+full_chroma_int" \
"-filter_complex" "tvai_up=model=$3:scale=0:w=3840:h=2160:preblur=0:noise=0:details=0:halo=0:blur=0:compression=0:estimate=8:blend=0.2:device=0:vram=1:instances=1,scale=w=3840:h=2160:flags=lanczos:threads=0:force_original_aspect_ratio=increase,crop=3840:2160" \
"-c:v" "h264_nvenc" "-profile:v" "high" "-pix_fmt" "yuv420p" "-g" "30" "-preset" "p7" \
"-tune" "hq" "-rc" "constqp" "-qp" "18" "-rc-lookahead" "20" "-spatial_aq" "1" \
"-aq-strength" "15" "-b:v" "0" "-an" "-map_metadata" "0" "-map_metadata:s:v" "0:s:v" \
"-movflags" "frag_keyframe+empty_moov+delay_moov+use_metadata_tags+write_colr" "-bf" "0" \
"-metadata" "videoai=Enhanced using $3; mode: auto; revert compression at 0; recover details at 0; sharpen at 0; reduce noise at 0; dehalo at 0; anti-alias/deblur at 0; focus fix Off; and recover original detail at 20. Changed resolution to 3840x2160" \
"temp.mp4"
# NOTE: This line comes from Topaz Video AI logs (Help > logging > Open current log). We remove the
# -nostdin option because it seems to make the output size vary, could be unrelated though.
"$ffmpeg" -y "-hide_banner" "-i" "temp.mp4" "-i" "$1" "-c:v" "copy" "-map" "0:v" "-an" \
"-map_metadata" "0" "-movflags" "use_metadata_tags" "-fps_mode" "passthrough" "$2"
source: Sky/tools/ffmpeg/topaz.sh at master · omega-gg/Sky · GitHub