Skip to content
TianZer edited this page Oct 1, 2020 · 12 revisions

Quick start

  • Image:
Anime4KCPP -i "source image path" -o "destination image path"
  • Video:
Anime4KCPP -i "source video path" -o "destination video path" -v

Arguments

usage: Anime4KCPP_CLI [options] ...
options:
  -i, --input
        File for loading
         (string [=./pic/p1.png])

  -o, --output
        File for outputting
         (string [=output.png])

  -p, --passes
        Passes for processing
         (int [=2])

  -n, --pushColorCount
        Limit the number of color pushes
         (int [=2])

  -c, --strengthColor
        Strength for pushing color,range 0 to 1,higher for thinner
         (double [=0.3])

  -g, --strengthGradient
        Strength for pushing gradient,range 0 to 1,higher for sharpe
        r
         (double [=1])

  -z, --zoomFactor
        zoom factor for resizing
         (double [=2])

  -t, --threads
        Threads count for video processing
         (unsigned int [=12])

  -f, --fastMode
        Faster but maybe low quality

  -v, --videoMode
        Video process

  -s, --preview
        Preview image

  -b, --preprocessing
        Enable preprocessing

  -a, --postprocessing
        Enable postprocessing

  -r, --preFilters
        Enhancement filter, only working when preProcessing is true,
        there are 5 options by binary:Median blur=0000001, Mean blur
        =0000010, CAS Sharpening=0000100, Gaussian blur weak=0001000
        , Gaussian blur=0010000, Bilateral filter=0100000, Bilateral
         filter faster=1000000, you can freely combine them, eg: Gau
        ssian blur weak + Bilateral filter = 0001000 | 0100000 = 010
        1000 = 40(D)
         (unsigned int [=4])

  -e, --postFilters
        Enhancement filter, only working when postProcessing is true
        ,there are 5 options by binary:Median blur=0000001, Mean blu
        r=0000010, CAS Sharpening=0000100, Gaussian blur weak=000100
        0, Gaussian blur=0010000, Bilateral filter=0100000, Bilatera
        l filter faster=1000000, you can freely combine them, eg: Ga
        ussian blur weak + Bilateral filter = 0001000 | 0100000 = 01
        01000 = 40(D), so you can put 40 to enable Gaussian blur wea
        k and Bilateral filter, which also is what I recommend for i
        mage that < 1080P, 48 for image that >= 1080P, and for perfo
        rmance I recommend to use 72 for video that < 1080P, 80 for
        video that >=1080P
         (unsigned int [=40])

  -q, --GPUMode
        Enable GPU acceleration

  -w, --CNNMode
        Enable ACNet

  -H, --HDN
        Enable HDN mode for ACNet

  -L, --HDNLevel
        Set HDN level
         (int [=1])

  -l, --listGPUs
        list GPUs

  -h, --platformID
        Specify the platform ID
         (unsigned int [=0])

  -d, --deviceID
        Specify the device ID
         (unsigned int [=0])

  -C, --codec
        Specify the codec for encoding from mp4v(recommended in Wind
        ows), dxva(for Windows), avc1(H264, recommended in Linux), v
        p09(very slow), hevc(not support in Windows), av01(not suppo
        rt in Windows)
         (string [=mp4v])

  -V, --version
        print version information

  -F, --forceFps
        Set output video fps to the specifying number, 0 to disable
         (double [=0])

  -D, --disableProgress
        disable progress display

  -W, --webVideo
        process the video from URL

  -A, --alpha
        preserve the Alpha channel for transparent image

  -B, --benchmark
        do benchmarking

  -?, --help
        print this message

Shorthand

eg: -vqh 1 equal to -v -q -h 1

ACNet

Use -w to enable ACNet, -q for GPU acceleration, you may use -wq.
Use -H to enable HDN mode of ACNet for better denoise, but it maybe more blurred.
For detail, see ACNet

Notice: If you enabled ACNet, only the following arguments works:

  -i, --input               File for loading (string [=./pic/p1.png])
  -o, --output              File for outputting (string [=output.png])
  -z, --zoomFactor          zoom factor for resizing (float [=2])
  -t, --threads             Threads count for video processing (unsigned int [=12])
  -v, --videoMode           Video process
  -s, --preview             Preview image
  -q, --GPUMode             Enable GPU acceleration
  -w, --CNNMode             Enable ACNet
  -l, --listGPUs            list GPUs
  -H, --HDN                 Enable HDN mode for ACNet
  -L, --HDNLevel            Set HDN level (int [=1])
  -h, --platformID          Specify the platform ID (unsigned int [=0])
  -d, --deviceID            Specify the device ID (unsigned int [=0])
  -C, --codec               Specify the codec for encoding from mp4v(recommended in Windows), dxva(for Windows), avc1(H264,   recommended in Linux), vp09(very slow), hevc(not support in Windows), av01(not support in Windows) (string [=mp4v])
  -V, --version             print version information
  -F, --forceFps            Set output video fps to the specifying number, 0 to disable (float [=0])
  -D, --disableProgress     disable progress display
  -W, --webVideo            process the video from URL
  -A, --alpha               preserve the Alpha channel for transparent image
  -B, --benchmark           do benchmarking
  -?, --help                print this message

GPU acceleration

Use -l to list the available platform IDs and device IDs:

Anime4KCPP -l

The result may like this:

List GPU

About GPU acceleration

Use -q to enable GPU acceleration, and then use -l to list the platform ids and device ids, -h for specifying platform id, -d for specifying device id.

Anime4KCPP -i "source video path" -o "destination video path" -v -q -h 1 -d 0

If you don't specify them or input an ID which is not correct, it will be treated as 0

Filters (Only for Anime4K09)

Filters is not GPU accelerated, and normally not needed for video processing

Enable filters can make the result be better, now Anime4kCPP support following filters:

  • Median blur [0000001]
  • Mean blur [0000010]
  • CAS Sharpening [0000100]
  • Gaussian blur weak [0001000]
  • Gaussian blur [0010000]
  • Bilateral filter [0100000]
  • Bilateral filter faster [1000000]

You can freely combine them by their binary.
eg: Gaussian blur weak + Bilateral filter = 0001000 | 0100000 = 0101000(B)= 40(D)

you can use -b to enable preprocessing filters function, and then use -r to custom your own combination, normally, if you don't specify the -r manually it will be 4. You can use command like this:

Anime4KCPP -i input.png -o output.png -b -r 44

Easily use -a to enable postprocessing filters function, and then use -e to custom your own combination, normally, if you don't specify the -e manually it will be 40. You can use command like this to enable Gaussian blur and Bilateral filter:

Anime4KCPP -i input.png -o output.png -a -e 48

I recommend use 40(Gaussian blur weak + Bilateral filter) for image that < 1080P, 48(Gaussian blur + Bilateral filter) for image that >= 1080P, and 72(Gaussian blur weak + Bilateral filter faster) for video that < 1080P, 80(Gaussian blur + Bilateral filter faster) for video that >=1080P.

It is not sure which will be better between pre and post processing, it depends on the specific image, you can try different combination for best quality.

CAS is an adaptive sharpening technology which is open source by AMD, simple but efficient.

Directory processing

Anime4KCPP CLI will automatically assess if the input is a directory, if the it is, Anime4KCPP will treated the output as a directory.
You need make sure all the files are image or all the files are video, otherwise it will be fail.

About fast mode

Fast mode is only for CPU, if you enabled GPU acceleration, it will be ignore.
Fast mode will be more aliasing, but may be faster (usually less than 5s, so you don't need to enable it normally).

Note: In the Linux build, Anime4KCPP is run as ./Anime4KCPP_CLI.

Clone this wiki locally