开发者

Bitrate Calculation

开发者 https://www.devze.com 2022-12-16 15:50 出处:网络
(Excuse for My english it\'s freak i´m from LA) I\'m trying to fin开发者_运维知识库ish a trascoding process in VB6.0 , i\'m working with ffmpeg , its a very good transcoder , to finish the project i

(Excuse for My english it's freak i´m from LA) I'm trying to fin开发者_运维知识库ish 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..


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消