Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Set oFSO = CreateObject("Scripting.FileSystemObject")
- Set WShell = CreateObject("WScript.Shell")
- Set oFil = oFSO.CreateTextFile("script.bat", True)
- oFil.WriteLine "@echo off"
- Function ToNumTime(S)
- T = CInt(Mid(S, 1, 2)) * 3600000
- T = T + CInt(Mid(S, 4, 2)) * 60000
- T = T + CInt(Mid(S, 7, 2)) * 1000
- T = T + CInt(Mid(S, 10)) * 10 ^ (3 - Len(Mid(Line, 10)))
- T = T / 1000
- ToNumTime = T
- End Function
- Function FromNumTime(T)
- S = Mid(CStr(Round(T - Int(T), 3)), 3)
- While Len(S) < 3 : S = S & "0" : Wend
- S = CStr(Int(T) Mod 60) & "." & S
- While Len(S) < 6 : S = "0" & S : Wend
- S = CStr((T \ 60) Mod 60) & ":" & S
- While Len(S) < 9 : S = "0" & S : Wend
- S = CStr(T \ 3600) & ":" & S
- While Len(S) < 12 : S = "0" & S : Wend
- FromNumTime = S
- End Function
- Sub PrepareVideo(FileName)
- Set oProc = WShell.Exec("ffmpeg.exe -i ""..\new_raw_videos\" & FileName & """")
- Set oStdOut = oProc.StdErr
- While Not oStdOut.AtEndOfStream
- Line = oStdOut.ReadLine
- If Left(Line, 12) = " Duration: " Then
- T = ToNumTime(Mid(Line, 13, InStr(Line, ",") -13))
- While Not oStdOut.AtEndOfStream : Line = oStdOut.ReadLine : Wend
- oFil.WriteLine "ffmpeg.exe -y -i ""..\new_raw_videos\" & FileName & """ -ar 22050 -ac 1 -ab 56k -f flv -s 320x240 -b 256k -r 15 -acodec mp3 ""%TEMP%\" & FileName & ".flv"""
- oFil.WriteLine "ffmpeg.exe -y -i ""..\new_raw_videos\" & FileName & """ -f mjpeg -ss " & FromNumTime(T * 0.50) & " -vframes 1 -s 128x96 -an ""%TEMP%\thumb_" & FileName & ".jpg"""
- oFil.WriteLine "ffmpeg.exe -y -i ""..\new_raw_videos\" & FileName & """ -f mjpeg -ss " & FromNumTime(T * 0.50) & " -vframes 1 -s 320x240 -an ""%TEMP%\" & FileName & ".jpg"""
- oFil.WriteLine "move ""%TEMP%\" & FileName & ".flv"" ""..\public_html\new_videos\" & FileName & ".flv"""
- oFil.WriteLine "move ""%TEMP%\" & FileName & ".jpg"" ""..\public_html\new_videos\" & FileName & ".jpg"""
- oFil.WriteLine "move ""%TEMP%\thumb_" & FileName & ".jpg"" ""..\public_html\new_videos\thumb_" & FileName & ".jpg"""
- End If
- Wend
- End Sub
- Set oFol = oFSO.GetFolder("..\new_raw_videos\")
- For Each oFile in oFol.Files
- If (Right(oFile.Name, 4) <> ".lnk") Then
- PrepareVideo oFile.name
- End If
- Next
- oFil.WriteLine "start ..\public_html\new_videos\"
- oFil.WriteLine "del script.bat"
- oFil.Close
- WShell.Run "script.bat"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement