【问题标题】:Getting video duration using ffmpeg or ffprobe with vb.net使用 ffmpeg 或 ffprobe 与 vb.net 获取视频持续时间
【发布时间】:2022-11-10 06:29:45
【问题描述】:

我想使用 ffmpeg 或 ffprobe 和 vb.net 获取视频的持续时间。但我根本不知道如何使用 ffmpeg 或 ffprobe。有没有人可以帮忙?这可以成为像我这样的人的起点

【问题讨论】:

  • 请提供足够的代码,以便其他人可以更好地理解或重现该问题。

标签: video ffmpeg duration


【解决方案1】:
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” 输出是以秒为单位的长度。

在这里大喊伊万的回答:How to extract duration time from ffmpeg output?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-26
    • 2014-02-26
    • 2016-12-17
    • 2020-07-29
    • 2019-11-11
    • 2011-09-21
    • 2014-08-07
    • 2021-05-08
    相关资源
    最近更新 更多