如何将ffmpeg转码过程信息链接到vb6 GUI应用程序中? [英] How to link the ffmpeg transcoding process information into a vb6 GUI app?

查看:286
本文介绍了如何将ffmpeg转码过程信息链接到vb6 GUI应用程序中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 ffmpeg 使用vb6 gui前端,到目前为止,我可以做的是通过cmd.exe调用ffmpeg,它将在整个过程仍在运行时显示命令提示符.而且我认为这是看到WinFF的规范,这是另一种基于Pascal的ffmpeg前端gui的工作原理.

i'm playing with a vb6 gui frontend for ffmpeg and as of now all i can do is to call the ffmpeg via cmd.exe which will shows the command prompt while the whole process is still running. And i thought this was the norm seeing how WinFF, another pascal based frontend gui for ffmpeg works.

但是当我看到其他具有进度条的GVC gui时,我感到非常震惊一切.

因此,基本上,我正在研究一种方法,可以干净地隐藏整个命令提示符,并将转码进度链接到我的GUI中的进度条.

So basically, i'm looking into a way how i could cleanly hide the whole command prompt and link the transcoding progress to a progress bar into my gui.

所以这是我的计划,我正在考虑找到一个Win32 API函数,该函数可以调用cmd行并将其隐藏,然后

So here's my plan, I'm thinking of finding a win32 api function which i can call the cmd line and yet hide it, and from another discussion here, i think i would have to read the log file to get the ffmpeg progress information.

那么我应该为win32 api调用哪个函数? 有谁知道一种更好/更简便的方法来完成此工作? 谢谢

So which function should i call for the win32 api? And does anyone knows of a better/easier way to get this done? thanks

如果有人感兴趣,我会找到一个关于如何获取cmd输出到我的vb6应用中,除了出色的joacim :)

In case anybody is interested, i find a nice class module on how to grab the cmd output into my vb6 app, and it's by none other than the great joacim :)

推荐答案

我在OSX上为Java编写了与此完全相同的东西.极简逻辑:

I have written this exact same thing for Java on OSX. Very minimalist logic:

  • 您需要在生成ffmpeg输出时读取它.
  • 逐行分析输出(CR和LF)
    • 找到"Duration"行,将时间值以秒为单位存储在整数中. 持续时间: 00:03:18 .48,开始:0.000000,比特率:274 kb/s" (CRLF终止)
    • 从那时起,解析CR并查找完成时间(以秒为单位). 帧= 2816 fps = 667 q = 11.0 Lsize = 13036kB时间= 187.66 比特率= 569.1kbits/s" (CR终止,没有LF)
    • 进行除法(时间/持续时间),您就有一个百分比!
    • You need to read ffmpeg output as it is produced.
    • Parse the output line by line (both CR and LF)
      • Find the 'Duration' line, store the time value as seconds in an integer. "Duration: 00:03:18.48, start: 0.000000, bitrate: 274 kb/s" (CRLF terminated)
      • From that point onward, parse the CR and look for the time (in seconds) completed values. "frame= 2816 fps=667 q=11.0 Lsize= 13036kB time=187.66 bitrate= 569.1kbits/s" (CR terminated, no LF)
      • Do the division (time / duration) and you have a percentage!

      我不认为将ffmpeg写入日志文件会起作用.至少在* nix上,ffmpeg将此输出写入std err,并且您需要捕获的状态行没有换行符,因此将覆盖先前的状态行.您可以在自己的代码中克服这一点.

      I do not believe having ffmpeg write to a log file is going to work. On *nix at least, ffmpeg writes this output to std err, and the status lines that you need to capture do not have a line feed, and so overwrite the previous status line. This is something you can overcome within your own code.

      对不起,VB6部分无济于事,但是假设它可以直接捕获您从shell中获取的进程的输出.

      Sorry, can't help with the VB6 part, but would assume it is straight forward to capture output from a process you shell out.

      这篇关于如何将ffmpeg转码过程信息链接到vb6 GUI应用程序中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆