Skip to content

Instantly share code, notes, and snippets.

@Miragecore
Last active November 16, 2018 01:26
Show Gist options
  • Save Miragecore/3e8bb717404efaeddfcb72155a860a7c to your computer and use it in GitHub Desktop.
Save Miragecore/3e8bb717404efaeddfcb72155a860a7c to your computer and use it in GitHub Desktop.
Take a screenshot with subtitles of every mkv file in the directory, at 10 seconds after the video starts
rem Take a screenshot with subtitles of every mkv file in the directory,
rem at 10 seconds after the video starts
@echo off
SET count=1
FOR /f "tokens=*" %%G IN ('dir /b') DO (call :subroutine "%%G")
GOTO :eof
:subroutine
set tmp=%1
set ext="%tmp:~-5%
IF %ext%==".mkv" (
set fn=%tmp:~0,-5%
echo Take screen shot %fn%.mkv
ffmpeg -i %1 -map 0:s:0 %fn%.srt
ffmpeg -ss 00:00:10 -copyts -i %1 -vf subtitles=%fn%.srt" -vframes 1 %fn%.jpg"
)
set /a count+=1
GOTO :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment