关于 ffmpeg 的帮助

发布于 2024-08-19 07:02:56 字数 621 浏览 4 评论 0原文

我现在可以读取在 cmd 窗口中执行的 FFmpeg 进程的最后一行。 使用脚本宿主模型对象引用来使用此源。

Private Sub Command1_Click()
    Dim oExec       As WshExec
    Dim sRow        As String

    With New WshShell
        Set oExec = .Exec("ffmpeg.exe")
    End With
    Do While oExec.Status = WshRunning
        sRow = oExec.StdOut.ReadLine
    Loop
End Sub

这条线是这样的。这是 cmd 窗口中的最后一行(在底部)。

frame= 2816 fps=667 q=11.0 Lsize= 13036kB time=187.66 bitrate= 569.1kbits/s

我剪掉了部分时间来在我的 vb 6.0 应用程序中构建进度条。但在 cmd 进程中存在一个值 13,该值称为总持续时间。但我无法读取这一行,有人有代码或任何想法可以从 ffmpeg 的 cmd 窗口的最后一行读取这一行 ubicated 13 行...

I can read now the last line from the FFmpeg procees executed in a cmd window.
with this source using Scripting host model object reference.

Private Sub Command1_Click()
    Dim oExec       As WshExec
    Dim sRow        As String

    With New WshShell
        Set oExec = .Exec("ffmpeg.exe")
    End With
    Do While oExec.Status = WshRunning
        sRow = oExec.StdOut.ReadLine
    Loop
End Sub

This line is like this. it's the last line in the cmd window (in the botom).

frame= 2816 fps=667 q=11.0 Lsize= 13036kB time=187.66 bitrate= 569.1kbits/s

I cut the part of Time to bulid a progress bar in my vb 6.0 app. But in the cmd process exist a value 13 lines up this value its called Total duration. But i cant read this line , somebody haves a code or any idea to read this line ubicated 13 lines up from the last line of the cmd window from ffmpeg...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

左耳近心 2024-08-26 07:02:56

我自己用 Java 做过这个。我认为问题在于状态更新行(就像上面用 time= 子字符串引用的那样)以 CR(回车)而不是 LF(换行)终止。我的直觉告诉我 ReadLine 正在寻找完整的 CRLF。因此,要执行此操作,您需要:

  • 了解 CR、LF 和 CRLF 之间的区别,以及
  • 在输出流中逐个字符读取每个 ASCII 代码,构建以 CR 结尾的行,然后将其解析为time=Durration= 标记

如果您在代码中调试打印语句并向我们展示输出,这将对您和我们都有帮助。

I've done this myself in Java. I think the problem is that the status update lines (like you quote above with the time= substring) is terminated with a CR (Carriage Return) and not a LF (Line Feed). My gut says that ReadLine is looking for a full CRLF. So, to do this, you will need to:

  • understand the difference between CR, LF and CRLF, and what ASCII code each is
  • read in the output stream character by character, building up a CR-terminated line, and then parse it for the time= and Durration= tokens

It would help both you and us if you had debugging print statements in your code, and showed us the output.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文