Get the App
SLTechnology News&Howtos  ›  Servers  › 

The representation form of ffmpeg score

Shulou Source: shulou.com Published: 2022-06-03 08:07:03 09月10日 Update

Before providing a possible solution to the time-consuming problem of avformat_find_stream_info, learn some basic ffmpeg knowledge points

Look at the code first.

PFormatContext- > streams [video _ index]-> time_base.den = 1200000

PFormatContext- > streams [video _ index]-> time_base.num = 1

/ / avg_frame_rate gets the frame rate

PFormatContext- > streams [video _ index]-> avg_frame_rate.den = 1

PFormatContext- > streams [video _ index]-> avg_frame_rate.num = 25

PFormatContext- > streams [video _ index]-> r_frame_rate.den = 25

PFormatContext- > streams [video _ index]-> r_frame_rate.num = 1

Notice that each structure has a member variable of den and num

By looking at the declaration, we can see that the above structure is actually such a type.

/ * *

* Rational number (pair of numerator and denominator).

, /

Typedef struct AVRational

{

Int num; / < Numerator

Molecule

Int den; / < Denominator denominator

} AVRational

Since the expression of the fraction is not convenient to calculate, one of the above structures is provided to preserve the numerator and denominator, etc.

Division is performed only when calculation is needed. Ffmpeg provides the following templates for division.

/ * *

* Convert rational to double.

* @ param a rational to convert

* @ return (double) a

, /

Static inline double av_q2d (AVRational a)

{

Return a.num / (double) a.den

}

Referenc

Http://www.jianshu.com/p/66b13b2b2979

Tags: Structure numerator denominator division operation fraction code variable form member scheme time appearance template knowledge knowledge point type problem facet reference Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Technology Apple Shulou Information vpn