Skip to content

Instantly share code, notes, and snippets.

@ueponx
Last active April 6, 2024 08:37
Show Gist options
  • Save ueponx/6b376bb8c0fb3df088354b54bce344d5 to your computer and use it in GitHub Desktop.
Save ueponx/6b376bb8c0fb3df088354b54bce344d5 to your computer and use it in GitHub Desktop.
RealESRGANとffmpegを使用して超解像化した動画を作成するバッチファイル
@echo off
setlocal enabledelayedexpansion
:: 引数の確認
if "%~4"=="" (
echo 使用法: %0 [入力動画パス] [imgフォルダパス] [hiresフォルダパス] [出力動画パス]
goto :eof
)
:: 引数を変数に格納
set "inputVideo=%~1"
set "imgFolder=%~2"
set "hiresFolder=%~3"
set "outputVideo=%~4"
:: フォルダの準備
if not exist "%imgFolder%" mkdir "%imgFolder%"
if not exist "%hiresFolder%" mkdir "%hiresFolder%"
:: ffmpegを使用して動画をフレームに分割(ファイル形式の指定で使用する%を%%にする必要あり)
echo 動画をフレームに分割しています...
ffmpeg.exe -i "%inputVideo%" -q:v 1 "%imgFolder%/%%06d.png"
:: realesrgan-ncnn-vulkanで超解像化
echo 超解像化を行っています...
realesrgan-ncnn-vulkan.exe -i "%imgFolder%" -o "%hiresFolder%" -n realesrgan-x4plus
:: ffmpegを使用してフレームを動画に再結合(ファイル形式の指定で使用する%を%%にする必要あり)
echo フレームを動画に再結合しています...
ffmpeg.exe -i "%hiresFolder%/%%06d.png" -i "%inputVideo%" "%outputVideo%"
echo 処理が完了しました。
endlocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment