我每天要从网上截屏几百个RTSP图片,循环调用cmd很慢,高手有没有办法可以一次调用多个cmd(如一次出20张图)我看别人用Power shell 可以多线程的,不知VBA可不可以?急用,在线等,可红包
Sub CaptureRTSP()
Dim sRTSP As String, sCMD As String, sFullName As String
Dim iA As Integer
sRTSP = "rtmp://58.200.131.2:1935/livetv/hunantv"
For iA = 1 To 5
sFullName = "E:\" & iA & "_" & Format(Date, "mmss") & ".png"
sCMD = "ffmpeg -y -i " & sRTSP & " -ss 00:00:01 -vframes 1 -f image2 -vcodec png " & sFullName
Shell "cmd.exe /c " & sCMD
Next iA
End Sub
Sub Sample1()
Shell "cmd.exe /c ffmpeg -y -i rtmp://58.200.131.2:1935/livetv/hunantv -ss 00:00:01 -vframes 1 -f image2 -vcodec png e:\image.png", vbHide
End Sub
另外,不知何故,公司的电脑不能直接sample1这样用,需要做成bat文件,但bat文件内如果一次调用多个,其中一个RTSP连不上时就会卡死,后面的就截不了屏。
Sub CaptureRTSP()
Dim sRTSP As String, sCMD As String, sFullName As String
Dim iA As Integer
sRTSP = "rtmp://58.200.131.2:1935/livetv/hunantv"
For iA = 1 To 5
sFullName = "E:\" & iA & "_" & Format(Date, "mmss") & ".png"
sCMD = "ffmpeg -y -i " & sRTSP & " -ss 00:00:01 -vframes 1 -f image2 -vcodec png " & sFullName
Shell "cmd.exe /c " & sCMD
Next iA
End Sub
Sub Sample1()
Shell "cmd.exe /c ffmpeg -y -i rtmp://58.200.131.2:1935/livetv/hunantv -ss 00:00:01 -vframes 1 -f image2 -vcodec png e:\image.png", vbHide
End Sub
另外,不知何故,公司的电脑不能直接sample1这样用,需要做成bat文件,但bat文件内如果一次调用多个,其中一个RTSP连不上时就会卡死,后面的就截不了屏。