我想要获得视频的持续时间使用ffmpeg或ff探头与vb.net。但我根本不知道如何使用ffmpeg或ff探头。有人能帮忙吗?对于像我这样的人来说,这是一个起点。
发布于 2022-11-09 22:29:45
Private Function lengthOfAudioFile(locOfFFPROBE As String, fileLoc As String) As String
Dim myprocess As New Process
Dim lines As String = ""
With myprocess
.StartInfo.FileName = locOfFFPROBE & "ffprobe.exe"
.StartInfo.Arguments = " -i " & fileLoc & " -show_entries format=duration -v quiet -of csv=" & """p=0"""
.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
.StartInfo.CreateNoWindow = True
.StartInfo.RedirectStandardOutput = True
.StartInfo.UseShellExecute = False
.Start()
End With
lines = myprocess.StandardOutput.ReadToEnd
lengthOfAudioFile = lines.ToString
End Function“当单击按钮以测试音频文件的长度时,将启动此子例程。
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
MsgBox(lengthOfAudioFile("ENTER YOUR FFPROBE LOCATION", "ENTER THE AUDIO FILE YOU WANT TO TEST"))
End SubFFPROBE位置类似于"C:\FFMPEG\“音频文件位置,类似于"C:\AudioFile\test.mp3”输出的长度(以秒为单位)。
https://stackoverflow.com/questions/74087082
复制相似问题