Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The representation form of ffmpeg score

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report