【发布时间】:2022-11-10 06:29:45
【问题描述】:
我想使用 ffmpeg 或 ffprobe 和 vb.net 获取视频的持续时间。但我根本不知道如何使用 ffmpeg 或 ffprobe。有没有人可以帮忙?这可以成为像我这样的人的起点
【问题讨论】:
-
请提供足够的代码,以便其他人可以更好地理解或重现该问题。
我想使用 ffmpeg 或 ffprobe 和 vb.net 获取视频的持续时间。但我根本不知道如何使用 ffmpeg 或 ffprobe。有没有人可以帮忙?这可以成为像我这样的人的起点
【问题讨论】:
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
End Function
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
MsgBox(lengthOfAudioFile("ENTER YOUR FFPROBE LOCATION", "ENTER THE AUDIO FILE YOU WANT TO TEST"))
End Sub
FFPROBE 位置类似于“C:FFMPEG” 音频文件位置类似于“C:AudioFile est.mp3” 输出是以秒为单位的长度。
【讨论】: