Created
August 15, 2010 06:29
-
-
Save xulapp/525161 to your computer and use it in GitHub Desktop.
1枚の画像と音声から動画を作成するバッチファイル (ffmpeg)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :: 1枚の画像と音声から動画を作成するバッチ | |
| :: makemov [image [audio [output]]] | |
| @echo off | |
| :main | |
| setlocal | |
| call :cdt | |
| ffmpeg > nul 2> nul | |
| if errorlevel 9009 ( | |
| echo ffmpeg が見つかりません | |
| goto :eof | |
| ) | |
| mp4box > nul 2> nul | |
| if not errorlevel 9009 ( | |
| set mp4box="" | |
| ) | |
| if not exist "%~1" ( | |
| if not exist "%~2" ( | |
| echo 以下の情報を入力してください | |
| echo. | |
| ) | |
| ) | |
| if exist "%~1" ( | |
| call :cdt "%~dp1" | |
| set image="%~1" | |
| echo 画像ファイル名: !image! | |
| goto :endimage | |
| ) | |
| :setimage | |
| set /p image=画像ファイル名: | |
| if not exist %image% ( | |
| echo ファイルが見つかりません | |
| goto :setimage | |
| ) | |
| :endimage | |
| echo. | |
| if exist "%~2" ( | |
| set audio="%~2" | |
| echo 音声ファイル名: !audio! | |
| goto :endaudio | |
| ) | |
| :setaudio | |
| set /p audio=音声ファイル名: | |
| if not exist %audio% ( | |
| echo ファイルが見つかりません | |
| goto :setaudio | |
| ) | |
| :endaudio | |
| echo. | |
| if not "%~3"=="" ( | |
| set outfile="%~3" | |
| ) else ( | |
| set outfile=out%random:~-1%%random:~-1%%random:~-1%%random:~-1%%random:~-1%.mp4 | |
| ) | |
| ffmpeg -loglevel 0 -loop_input -r 1 -i %image% -vcodec libx264 -threads 0 -coder ac -trellis 1 -flags2 +dct8x8 -sc_threshold -1 -g 5 -qmin 16 -qmax 51 -qdiff 4 -qcomp 1 -subq 2 -i_qfactor 0.001 -f avi - | ffmpeg -v 0 -loglevel 0 -shortest -i - -vcodec copy -i %audio% -acodec copy -y -f mp4 %outfile% 2> nul | |
| if exist %outfile% ( | |
| echo. | |
| call :gpac %outfile% | |
| ) | |
| echo. | |
| call :printfullpath %outfile% | |
| endlocal | |
| goto :eof | |
| :cdt | |
| cd /d %1 | |
| title %~n0 - %cd% | |
| goto :eof | |
| :printfullpath | |
| echo %~f1 | |
| goto :eof | |
| :gpac | |
| if defined mp4box ( | |
| mp4box -add "%~1" -new "%~1" | |
| ) | |
| goto :eof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment