Skip to content

Instantly share code, notes, and snippets.

@PyYoshi
Created August 17, 2011 20:18
Show Gist options
  • Select an option

  • Save PyYoshi/1152500 to your computer and use it in GitHub Desktop.

Select an option

Save PyYoshi/1152500 to your computer and use it in GitHub Desktop.
avisynth経由でtsファイルをPS3で再生可能なmp4/avcに変換するためのバッチ。パスを適切に変更してください。
@echo off
rem Version:0.1
rem ###エラーメッセージ###
rem =====================================================
set error=ファイルが存在しないか、ファイル名・拡張子が間違っています
if not exist "%1" echo %error%
if not exist "%1" pause
rem ###映像・音声エンコード設定###
rem =====================================================
set x264=--preset medium --crf 23 --qcomp 0.7 --min-keyint 4 --b-pyramid 0 --ref 3 --no-fast-pskip --no-dct-decimate --level 4.1 --vbv-maxrate 25000 --vbv-bufsize 25000 --stats .\x264.stats
set aac=-br 192000 -2pass -lc
rem =====================================================
rem ### 出力ファイル ###
rem =====================================================
set work_dir=D:\work\
set save_dir=D:\save\
set subtitle=%~n1
set out_project=%work_dir%%subtitle%
set outfile_aac=%work_dir%%subtitle%.aac
set outfile_m4a=%work_dir%%subtitle%.m4a
set outfile_wav=%work_dir%%subtitle%.wav
set outfile_avs=%work_dir%%subtitle%.avs
set outfile_264="%work_dir%%subtitle%[enc].mp4"
set outfile_264b="%save_dir%%subtitle%.mp4"
rem =====================================================
rem ### プログラム/template.avsのパス ###
rem =====================================================
rem ### DGIndex.exe ###
set dgindex_path="DGIndex.exeのフルパス。"
rem ### avs2wav.exe ###
set avs2wav_path="avs2wav.exeのフルパス。"
rem ### fawcl.exe ###
set fawcl_path="fawcl.exeのフルパス。"
rem ### template.avs ###
set template_avs_path=template.avsのフルパス。
rem ### MP4Box ###
set mp4box_path="MP4Box.exeのフルパス。"
rem ### コマンドライン版 x264 ###
set x264_path="x264.exeのフルパス。"
rem ### コマンドライン版 avs2yuv 64bit版x264を使う場合 ###
set avs2yuv_path="avs2yuv.exeのフルパス。"
rem ### コマンドライン版 pipebuf 64bit版x264を使う場合 ###
set pipebuf_path="pipebuf.exeのフルパス。"
echo ====================================================
echo 入力ファイル
echo ====================================================
set INPUTFILE=%~1
echo パス:%INPUTFILE%
echo.
echo ====================================================
echo demux開始
echo ====================================================
echo パス:%out_project%
%dgindex_path% -IF=[%INPUTFILE%] -IA=3 -OM=2 -AT=[%template_avs_path%] -OF=[%out_project%] -EXIT
for %%i in (%out_project%*.aac) do set aac_path=%%i
echo %aac_path%
echo.
echo ====================================================
echo wav偽装 aac化開始
echo ====================================================
%fawcl_path% "%aac_path%" %outfile_wav%
%fawcl_path% %outfile_wav% %outfile_aac%
echo.
echo ====================================================
echo aac→m4a開始
echo ====================================================
%mp4box_path% -add %outfile_aac% -new %outfile_m4a%
echo.
echo ====================================================
echo x264エンコード開始
echo ====================================================
rem 64bit版x264を使う場合 ※速度がかなり下がる。
rem %pipebuf_path% %avs2yuv_path% %outfile_avs% - : %x264_x64_path% %x264% -o %outfile_264% --demuxer y4m --stdin y4m - : 4
rem 通常はこちら
%x264_path% %x264% -o %outfile_264% %outfile_avs%
echo.
echo ====================================================
echo mp4boxで結合
echo ====================================================
%mp4box_path% -add %outfile_264% -add %outfile_m4a% -new %outfile_264b%
echo.
rem pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment