Skip to content

Instantly share code, notes, and snippets.

@road3x
Created February 2, 2018 08:40
Show Gist options
  • Save road3x/2ee26746e8eafd66903d777d5220361e to your computer and use it in GitHub Desktop.
Save road3x/2ee26746e8eafd66903d777d5220361e to your computer and use it in GitHub Desktop.
retrieve and transcode files with ffmpeg
@echo off
set MTS_ROOT=D:\path\to\dir
set MTS_FIXED_OPT=-f mp4 -r 29.97 -vcodec libx264 -preset slow -filter:v scale=704:384 -b:v 1000k -aspect 16:9 -flags +loop -cmp chroma -b:v 1250k -maxrate 1500k -bufsize 4M -bt 256k -refs 1 -bf 3 -coder 1 -me_method umh -me_range 16 -subq 7 -partitions +parti4x4+parti8x8+partp8x8+partb8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -qcomp 0.6 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libvo_aacenc -b:a 112k -ar 48000 -ac 2
set MTS_IN_EXT=MTS
set MTS_OUT_EXT=mp4
set MTS_TMP_EXT=tmp
set FFEXE=C:\path\to\ffmpeg.exe
pushd .
cd /d %MTS_ROOT%
for /f "usebackq" %%i in (`dir /B /S *.%MTS_IN_EXT%`) do (
if not exist "%%~ni.%MTS_OUT_EXT%" (
"%FFEXE%" -y -i "%%~dpni.%MTS_IN_EXT%" %MTS_FIXED_OPT% "%%~dpni.%MTS_TMP_EXT%"
ren %%~dpni.%MTS_TMP_EXT% %%~ni.%MTS_OUT_EXT%
del "%%~dpni.%MTS_IN_EXT%"
)
)
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment