views:

199

answers:

2

Hi experts , (Excuse for My english it's freak i´m from LA) I'm trying to finish a trascoding process in VB6.0 , i'm working with ffmpeg , its a very good transcoder , to finish the project i want a progress bar for the trascoding process but it's so very hard , first i need to understand , how a program can calculate the time remaining to the process if i have the inputs

  • Average Bitrate
  • Frame rate
  • Start file Size.

I'm trying with : File size (KB) / Average Bitrate Kb/s.

In theory this must to work , but the calculated time it`s very small than the real time processed. Somebody have any idea about this , what is the formula (snipped) to calculate the time remaining in a trascoding process. in this wonderfull web i find many answer to mys projects..

+1  A: 

The bitrate won't help you in calculating progress.

If you have the file length in seconds, and the frame rate, and ffmpeg outputs what frame its processing right now, you can calculate the approximate time.

Infinity
A: 

The general solution for "time remaining," given:

  • A number total_units that represents the size, number of units, etc. to be processed
  • A number units_processed that represents how many M's have been processed so far
  • A number start_seconds that gives the time, in seconds since the operation started

is:

seconds_elapsed = current time - start time
seconds_per_unit = seconds_elapsed / units_processed
units_left = total_units - units_processed
seconds_remaining = unit_left / seconds_per_unit

This algorithm does best when the times to process each unit are nearly the same, or at least when the time/unit has little correlation with elapsed time. It stinks on ice if time/unit varies with elapsed time.

Wayne Conrad