Skip to main content

Advanced Settings of Command Line Interface

Justin62628About 4 min

Warning

This page is for advanced content. Please read the detailed explanation of advanced content first.

SVFI supports calling via the command line

Tips

Using the pure OLS command line is the fastest.

Environment Setup

  1. Create a new steam_appid.txt in the SVFI installation root directory and fill in the following content:

1692080

Tips

Filling in this text file will cause SVFI to start in standalone application mode to avoid interference from the Steam client.

This can achieve special operations such as multiple instances of the software, software installation location migration, and software version retention.

  • Software version retention: After reverting the steam operation to the specified branch, copy the entire SVFI installation folder and ensure the existence of steam_appid.txt. In the future, you can click SVFI.Professional or SVFI.Community in this folder to run this version of SVFI.
  1. In the SVFI installation root directory, start the command prompt cmd (if the installation location is not on the system disk, no administrator privileges are required), enter one_line_shot_args -h and press Enter, and you should be able to see the following similar content:
usage: #### SVFI CLI tool by Jeanna #### [-h] -iINPUT -cCONFIG -t TASK_ID
                                         [--concat-only] [--extract-only]
                                         [--render-only] [-p] [--pipe-in]
                                         [--pipe-out]
                                         [--pipe-iw PIPE_IN_WIDTH]
                                         [--pipe-ih PIPE_IN_HEIGHT]
                                         [--pipe-in-fps PIPE_IN_FPS]
                                         [--pipe-in-pixfmt {rgb24,rgb48be,rgb48le,rgb48}]
                                         [--pipe-rgb]
                                         [--pipe-colormatrix {470bg,170m,2020ncl,709}]

To enhance Long video/image sequence quality

optional arguments:
  -h, --help            show this help message and exit

Basic Settings:
  -iINPUT, --inputINPUT
                        Path of input video/image sequence folder
  -cCONFIG, --configCONFIG
                        Path of config
  -t TASK_ID, --task-id TASK_ID
                        13-digit Task id
  --concat-only         Concat Chunk only
  --extract-only        Extract input to frames Only
  --render-only         Render only
  -p, --preview         Preview Settings

Pipe Settings:
  Set the follow parameters when '-mid' is assigned, or you will encounter
  exceptions.Output Y4M at YUV444P10

  --pipe-in             This enables OLS to obtain input data from stdin
  --pipe-out            This enables OLS to pipe output to stdout
  --pipe-iw PIPE_IN_WIDTH
                        Width of input raw RGB, effective when --pipe-in
                        appointed
  --pipe-ih PIPE_IN_HEIGHT
                        Height of input raw RGB, effective when --pipe-in
                        appointed
  --pipe-in-fps PIPE_IN_FPS
                        Input stream FPS, effective when --pipe-in appointed
  --pipe-in-pixfmt {rgb24,rgb48be,rgb48le,rgb48}
                        Pixel format of input raw RGB, effective when --pipe-
                        in appointed
  --pipe-rgb            Pipe RGB Raw data to stdout, effective when --pipe-out
                        appointed
  --pipe-colormatrix {470bg,170m,2020ncl,709}
                        Colormatrix for RGB-YUV Conversion, effective when
                        --pipe-in appointed, --pipe-rgb not appointed


Explanation of typical usage scenarios

Multi-Open SVFI

The one_line_shot_args (hereinafter referred to as OLS) program supports multi-opening after completing the above configuration, for multi-process tasks. Please note that this may cause significant resource usage.

There are three necessary parameters that need to be entered:

  • --input: Folder where the video file or image sequence to be processed is located
  • --config: Configuration file generated by the SVFI GUI program, usually located in the Configs folder of the installation directory
  • --task-id: Task ID, a non-empty string used to distinguish different tasks.

Pipeline Input

SVFI supports input of RGB streams from other processes, currently supporting bare stream input of rgb24, rgb48, rgb48le, and rgb48be pixel formats.

You must fill in --pipe-in to enable this function, and specify --pipe-iw for the input image pixel length, --pipe-ih for the width, --pipe-in-fps for the input stream frame rate (only supports floats), and --pipe-in-pixfmt for the pixel format of the input.

Pipeline Output

SVFI supports outputting RGB or YUV444P10 Y4M streams to stdout.

You must fill in --pipe-out to enable this function,

  • If you need to output YUV444P10, specify --pipe-colormatrix for SVFI to convert RGB to YUV streams
  • To output RGB streams, specify --pipe-rgb. The specific output pixel format is controlled by the options in the configuration file. Generally, rgb48 is output for high-precision workflows, and rgb24 is output for non-high-precision workflows.

Force SVFI to use the specified GPU number

  • Select gpu0 to start the task in the SVFI interface, generate the task configuration file, and then follow the online tutorial separately
  • New command line cmd,
  • Enter set CUDA_VISIBLE_DEVICES=1 and press Enter,
  • Call OLS to run SVFI on the GPU in the second PCIE slot
  • This method can solve the problem of not being able to specify the graphics card when using int8 quantization

Command Line Examples

Batch processing all mp4, webm, and gif files in a folder using the same settings

for %i in ("folder path/*.mp4" "folder path/*.webm" "folder path/*.gif") do (one_line_shot_args.exe --input "%i" --task-id "%~ni" --config "SVFI_Config_vfi_sr.ini")

Where:

  • To execute in the SVFI installation software root directory using cmd
  • SVFI_Config_vfi_sr.ini is the configuration file exported by clicking the Export Settings button below the advanced settings
  • It will be output to the same folder

Use ffmpeg for high-precision frame splitting and input to SVFI for processing, and use Y4M for input to ffmpeg for compression

ffmpeg -loglevel error -vsync passthrough -hwaccel auto -i test/test.mp4 -map 0:v:0 -sws_flags +bicubic+full_chroma_int+accurate_rnd -vf copy,format=yuv444p10le,format=rgb48be,format=rgb24,minterpolate=fps=24.000:mi_mode=dup -f image2pipe -pix_fmt rgb24 -vcodec rawvideo - |  one_line_shot_args.exe  -i - -c Configs/SVFI_Config_pipe_test.ini -t pipe_2 --pipe-in --pipe-iw 960 --pipe-ih 540  --pipe-in-fps 24 --pipe-out |  ffmpeg.exe -loglevel error -hide_banner -y -vsync cfr -i - -preset:v slow -c:v hevc_nvenc -pix_fmt yuv420p -crf 16 test/output.mp4 -y

Use ffmpeg for high-precision frame splitting and input to a 2-length SVFI pipeline for processing, and output Y4M for compression using ffmpeg

The first OLS process is used for super-resolution, and the second OLS process is used for frame interpolation

ffmpeg -loglevel error -vsync passthrough -hwaccel auto -i test/test.mp4 -map 0:v:0 -sws_flags +bicubic+full_chroma_int+accurate_rnd -vf copy,format=yuv444p10le,format=rgb48be,format=rgb24,minterpolate=fps=24.000:mi_mode=dup -f image2pipe -pix_fmt rgb48be -vcodec rawvideo - | one_line_shot_args.exe  -i - -c Configs/SVFI_Config_pipe_1.ini -t pipe_1 --pipe-in --pipe-iw 960 --pipe-ih 540 --pipe-in-fps 24 --pipe-out --pipe-rgb --pipe-in-pixfmt rgb48be | one_line_shot_args.exe -i - -c Configs/SVFI_Config_pipe_2.ini -t pipe_2 --pipe-in --pipe-iw 960 --pipe-ih 540  --pipe-in-fps 24 --pipe-in-pixfmt rgb48 --pipe-out |  ffmpeg.exe -loglevel error -hide_banner -y -vsync cfr -i - -preset:v slow -c:v hevc_nvenc -pix_fmt yuv420p -crf 16 test/output.mp4 -y

Use Vapoursynth for preprocessing the input and then use ffmpeg for high-precision frame splitting and SVFI pipeline processing

The Vapoursynth script input.vpy used:

import vapoursynth as vs
from vapoursynth import core
video = core.lsmas.LWLibavSource(r'test.mp4')  # 960x540, 24fps

# DO SOMETHING

video.set_output()  # output yuv

Command line:

vspipe input.vpy --y4m - | ffmpeg -loglevel error -vsync passthrough -hwaccel auto -i - -map 0:v:0 -sws_flags +bicubic+full_chroma_int+accurate_rnd -vf copy,format=yuv444p10le,format=rgb48be,format=rgb24,minterpolate=fps=24.000:mi_mode=dup -f image2pipe -pix_fmt rgb24 -vcodec rawvideo - |  one_line_shot_args.exe  -i - -c Configs/SVFI_Config_pipe_test.ini -t pipe_2 --pipe-in --pipe-iw 960 --pipe-ih 540  --pipe-in-fps 24 --pipe-out |  ffmpeg.exe -loglevel error -hide_banner -y -vsync cfr -i - -preset:v slow -c:v hevc_nvenc -pix_fmt yuv420p -crf 16 test/output.mp4 -y

Tips

After configuring the task parameters using SVFI and starting the task, use the Config.ini generated in the Configs folder for the command line task.

Last update:
Contributors: Justin62628,DAMNCRAB