' Extract subtitles (SRT files) from video (MKV file) - Requires ffmpeg.exe (https://ffmpeg.org)
' Video
Set WshShell = CreateObject("Wscript.Shell")
Set fso = WScript.CreateObject("Scripting.Filesystemobject")
Set toolkit = CreateObject("VbsEdit.Toolkit")
ffmpeg = "c:\ffmpeg.org\bin\ffmpeg.exe"
On Error Resume Next
ffmpeg = wshshell.RegRead("HKEY_CURRENT_USER\Software\Adersoft\Vbsedit\Ffmeg_location")
On Error GoTo 0
If Not(fso.FileExists(ffmpeg)) Then
ffmpeg_files=toolkit.OpenFileDialog("","ffmpeg (*.exe)|*.exe",False,"Locate ffmpeg.exe")
If UBound(ffmpeg_files)<0 Then
WScript.Quit
End If
ffmpeg = ffmpeg_files(0)
If fso.FileExists(ffmpeg) Then
wshshell.RegWrite "HKEY_CURRENT_USER\Software\Adersoft\Vbsedit\Ffmeg_location",ffmpeg
End If
End If
files=toolkit.OpenFileDialog("","MKV Files (*.mkv)|*.mkv",False,"Open a video file")
If UBound(files)<0 Then
Wscript.Quit
End If
videoFile = files(0)
srtFile = toolkit.SaveFileDialog("c:\","test.srt","SRT Files (*.srt)|*.srt","Save SRT file as")
If LCase(Right(srtFile,4))=".srt" Then
srtFile = Left(srtFile,Len(srtFile)-4)
End If
For i=0 To 10
suffixe=""
If i>0 Then
suffixe = "_" & i
End If
cmd= """" & ffmpeg & """ -i """ & videoFile & """ -map 0:s:" & i & " """ & srtFile & suffixe & ".srt"""
WScript.Echo cmd
wshshell.Run cmd,1,True
Next