-
Notifications
You must be signed in to change notification settings - Fork 59
How to process videos (Mac App Store version)
The macOS version (App Store) supports video processing via command line. Input video is provided through STDIN. Result video is written to STDOUT.
To learn about general usage of the command line, please go to this page.
The video filter in the app is a bit slower than the one in this repo (Waifu2xFilter) but it requires way less video RAM to work.
Use --raw
to enable video mode. The model type, scale factor and noise level should also be specified. Real-ESRGAN variant should be specified if applicable. All models support video processing starting from version 5.1.1.
Frames are in 32-bit RGBA format. If --16-bit
flag is present, frames must be in 64-bit little endian RGBA format instead.
You must specify the resolution of input frames through command line arguments --width
and --height
. You must also calculate the size of resulting frames and provide it to the downstream program. Frame rate must also be provided if the downstream program is an encoder.
You can pipe two ffmpeg
instances as decoder and encoder with waifu2x
.
With software encoding 10-bit 4:4:4 h264:
alias waifu2x=/Applications/waifu2x.app/Contents/MacOS/waifu2x
ffmpeg -i input.mkv -pix_fmt rgba64le -f rawvideo -loglevel quiet - |
waifu2x -m real_esrgan -v anime_2x_video --raw --width 1920 --height 1080 --16-bit |
ffmpeg -f rawvideo -pix_fmt rgba64le -s:v 3840x2160 -r 23.98 -i - -c:v libx264 output.mp4
With hardware encoding 8-bit 4:2:0 h264:
alias waifu2x=/Applications/waifu2x.app/Contents/MacOS/waifu2x
ffmpeg -i input.mkv -pix_fmt rgba -f rawvideo -loglevel quiet - |
waifu2x -m real_esrgan -v anime_2x_video --raw --width 1920 --height 1080 |
ffmpeg -f rawvideo -pix_fmt rgba -s:v 3840x2160 -r 23.98 -i - -c:v h264_videotoolbox output.mp4
Sample output from M1 MacBook Air with ANE:
The result video will not contain any audio track. You can combine it with audio from the original video.
ffmpeg -i input.mkv -vn -c:a flac audio.flac
ffmpeg -i output.mp4 -i audio.flac -c:v copy -c:a copy output.mkv
©2017-2021 imxieyi