Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can easily implement a progress bar if running ffmpeg. The output of ffmpeg while running is something like:</p> <pre><code>frame= 3366 fps=465 q=31.0 Lsize= 6474kB time=140.35 bitrate= 377.9kbits/s </code></pre> <p>And it is refreshed ~twice per second. You can parse that line and get the data you need to display the progress. When you run in the command line, you only see one line being updated all the time, but what ffmpeg does is to write the line followed by <b>\r</b>. That's why you don't see multiple lines. However, when using StreamReader.ReadLine() on the error output of the program, you get one line for every update.</p> <p>Sample code to read the output follows. You would have to ignore any line that does not begins with 'frame', perhaps use <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.beginerrorreadline.aspx" rel="noreferrer">BeginErrorReadLine()</a>+<a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.errordatareceived.aspx" rel="noreferrer">ErrorDataReceived</a> if you want reading lines to be asynchronous, etc., but you get the idea (I've actually tested it):</p> <pre><code>using System; using System.Diagnostics; using System.IO; class Test { static void Main (string [] args) { Process proc = new Process (); proc.StartInfo.FileName = "ffmpeg"; proc.StartInfo.Arguments = "-i " + args [0] + " " + args [1]; proc.StartInfo.RedirectStandardError = true; proc.StartInfo.UseShellExecute = false; if (!proc.Start ()) { Console.WriteLine ("Error starting"); return; } StreamReader reader = proc.StandardError; string line; while ((line = reader.ReadLine ()) != null) { Console.WriteLine (line); } proc.Close (); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload