FFmpeg源代碼簡單分析-通用-結構體分析-AVStream

參考鏈接

  • FFMPEG結構體分析:AVStream_雷霄驊的博客-CSDN博客_avstream

AVStream

  • AVStream是是存儲每一個視頻/音頻流信息的結構體
  • 結構體的定義位于avformat.h
  • 重要參數介紹
    • int index:標識該視頻/音頻流
    • AVCodecContext *codec:指向該視頻/音頻流的AVCodecContext(它們是一一對應的關系)
    • AVRational time_base:時基。通過該值可以把PTS,DTS轉化為真正的時間。FFMPEG其他結構體中也有這個字段,但是根據我的經驗,只有AVStream中的time_base是可用的。PTS*time_base=真正的時間
    • int64_t duration:該視頻/音頻流長度
    • AVDictionary *metadata:元數據信息
    • AVRational avg_frame_rate:幀率(注:對視頻來說,這個挺重要的)
    • AVPacket attached_pic:附帶的圖片。比如說一些MP3,AAC音頻文件附帶的專輯封面。

代碼

/*** Stream structure. //流結構* New fields can be added to the end with minor version bumps. //可以將新字段添加到末尾,并帶有較小的版本顛簸* Removal, reordering and changes to existing fields require a major //移除、重新排序和更改現有字段需要專業版本顛簸* version bump.* sizeof(AVStream) must not be used outside libav*. //sizeof(AVStream) 不得在 libav* 之外使用*/
typedef struct AVStream {
#if FF_API_AVSTREAM_CLASS/*** A class for @ref avoptions. Set on stream creation.*/const AVClass *av_class;
#endifint index;    /**< stream index in AVFormatContext *//*** Format-specific stream ID.* decoding: set by libavformat* encoding: set by the user, replaced by libavformat if left unset*/int id;void *priv_data;/*** This is the fundamental unit of time (in seconds) in terms* of which frame timestamps are represented.** decoding: set by libavformat* encoding: May be set by the caller before avformat_write_header() to*           provide a hint to the muxer about the desired timebase. In*           avformat_write_header(), the muxer will overwrite this field*           with the timebase that will actually be used for the timestamps*           written into the file (which may or may not be related to the*           user-provided one, depending on the format).*/AVRational time_base;/*** Decoding: pts of the first frame of the stream in presentation order, in stream time base.* Only set this if you are absolutely 100% sure that the value you set* it to really is the pts of the first frame.* This may be undefined (AV_NOPTS_VALUE).* @note The ASF header does NOT contain a correct start_time the ASF* demuxer must NOT set this.*/int64_t start_time;/*** Decoding: duration of the stream, in stream time base.* If a source file does not specify a duration, but does specify* a bitrate, this value will be estimated from bitrate and file size.** Encoding: May be set by the caller before avformat_write_header() to* provide a hint to the muxer about the estimated duration.*/int64_t duration;int64_t nb_frames;                 ///< number of frames in this stream if known or 0/*** Stream disposition - a combination of AV_DISPOSITION_* flags.* - demuxing: set by libavformat when creating the stream or in*             avformat_find_stream_info().* - muxing: may be set by the caller before avformat_write_header().*/int disposition;enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed./*** sample aspect ratio (0 if unknown)* - encoding: Set by user.* - decoding: Set by libavformat.*/AVRational sample_aspect_ratio;AVDictionary *metadata;/*** Average framerate** - demuxing: May be set by libavformat when creating the stream or in*             avformat_find_stream_info().* - muxing: May be set by the caller before avformat_write_header().*/AVRational avg_frame_rate;/*** For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet* will contain the attached picture.** decoding: set by libavformat, must not be modified by the caller.* encoding: unused*/AVPacket attached_pic;/*** An array of side data that applies to the whole stream (i.e. the* container does not allow it to change between packets).** There may be no overlap between the side data in this array and side data* in the packets. I.e. a given side data is either exported by the muxer* (demuxing) / set by the caller (muxing) in this array, then it never* appears in the packets, or the side data is exported / sent through* the packets (always in the first packet where the value becomes known or* changes), then it does not appear in this array.** - demuxing: Set by libavformat when the stream is created.* - muxing: May be set by the caller before avformat_write_header().** Freed by libavformat in avformat_free_context().** @see av_format_inject_global_side_data()*/AVPacketSideData *side_data;/*** The number of elements in the AVStream.side_data array.*/int            nb_side_data;/*** Flags indicating events happening on the stream, a combination of* AVSTREAM_EVENT_FLAG_*.** - demuxing: may be set by the demuxer in avformat_open_input(),*   avformat_find_stream_info() and av_read_frame(). Flags must be cleared*   by the user once the event has been handled.* - muxing: may be set by the user after avformat_write_header(). to*   indicate a user-triggered event.  The muxer will clear the flags for*   events it has handled in av_[interleaved]_write_frame().*/int event_flags;
/*** - demuxing: the demuxer read new metadata from the file and updated*     AVStream.metadata accordingly* - muxing: the user updated AVStream.metadata and wishes the muxer to write*     it into the file*/
#define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001
/*** - demuxing: new packets for this stream were read from the file. This*   event is informational only and does not guarantee that new packets*   for this stream will necessarily be returned from av_read_frame().*/
#define AVSTREAM_EVENT_FLAG_NEW_PACKETS (1 << 1)/*** Real base framerate of the stream.* This is the lowest framerate with which all timestamps can be* represented accurately (it is the least common multiple of all* framerates in the stream). Note, this value is just a guess!* For example, if the time base is 1/90000 and all frames have either* approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1.*/AVRational r_frame_rate;/*** Codec parameters associated with this stream. Allocated and freed by* libavformat in avformat_new_stream() and avformat_free_context()* respectively.** - demuxing: filled by libavformat on stream creation or in*             avformat_find_stream_info()* - muxing: filled by the caller before avformat_write_header()*/AVCodecParameters *codecpar;/*** Number of bits in timestamps. Used for wrapping control.** - demuxing: set by libavformat* - muxing: set by libavformat**/int pts_wrap_bits;
} AVStream;

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/445988.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/445988.shtml
英文地址,請注明出處:http://en.pswp.cn/news/445988.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

在Windows下安裝JDK的通常步驟

獲取安裝包 從官網或其他途徑下載JDK的Windows版本的安裝包&#xff0c;并點擊安裝。安裝向導中無需選擇配置項&#xff0c;默認操作即可&#xff0c;除了自定義的JDK安裝目錄。假設JDK的安裝目錄為C:\Program Files\Java。 設置環境變量 右擊桌面上的計算機&#xff0c;在菜單…

怎么關閉或者卸載ivanti_電腦軟件卸載不了怎么辦,教您解決電腦軟件無法卸載方法技巧...

我們在使用電腦的過程中&#xff0c;肯定會安裝各種軟件&#xff0c;但是一些軟件在使用完之后就不會再使用了&#xff0c;但又無法卸載。下面由小編分享一下電腦安裝的軟件無法卸載解決方法&#xff0c;如果你在某卸載軟件的時候出現無法卸載的情況&#xff0c;不妨通過以下方…

FFmpeg源代碼簡單分析-通用-結構體分析-AVPacket

參考鏈接 FFMPEG結構體分析&#xff1a;AVPacket_雷霄驊的博客-CSDN博客_avpacket AVPacket AVPacket是存儲壓縮編碼數據相關信息的結構體結構體的定義位于packet.h重要參數介紹 uint8_t *data&#xff1a;壓縮編碼的數據。例如對于H.264來說。1個AVPacket的data通常對應一個…

h5支付不能打開支付寶 ios_iOS WKWebview中無法調起支付寶/微信客戶端支付問題的解決方法...

這兩個的解決思路都是要在下面這個方法中先攔截相應的url&#xff0c;再單獨處理- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler;支付寶…

解決Github圖片加載失敗

問題描述 瀏覽自己Github某倉庫的README.md內時&#xff0c;發現文檔的圖片始終加載不出&#xff0c;打開瀏覽器后臺&#xff0c;冒出一片紅&#xff0c;Failed to load resource: net::ERR_CONNECTION_RESET&#xff0c;如下圖所示&#xff1a; 問題分析 可能造成這問題的原…

FFmpeg源代碼簡單分析-通用-結構體分析-AVFrame

參考鏈接 FFMPEG結構體分析&#xff1a;AVFrame_雷霄驊的博客-CSDN博客 AVFrame AVFrame是包含碼流參數較多的結構體結構體的定義位于frame.hAVFrame結構體一般用于存儲原始數據&#xff08;即非壓縮數據&#xff0c;例如對視頻來說是YUV&#xff0c;RGB&#xff0c;對音頻來…

python 求子字符串_(6)KMP算法(求子串的位置)______字符串的匹配

問題&#xff1a;已知字符串 B 是字符串 A 的一個子串,問字符串 B 在字符串 A 的第一次出現位置.暴力方法:從 A 字符串 的每個位置開始對字符串 B 進行匹配. 這種方法根據數據的不同 復雜度不同最高可以達到O( m*n ). (m,n分別為兩個字符串的長度)KMP算法&#xff1a;我們先來看…

用Python將多張圖片合并成一PDF文件

先前條件 需要安裝兩模塊&#xff1a;fpdf、PIL pip install fpdfpip install PIL 放碼過來 from fpdf import FPDF from PIL import Image import osdef makePdf(pdfFileName, listPages):cover Image.open(listPages[0])width, height cover.sizepdf FPDF(unit "…

FFmpeg源代碼簡單分析-通用-結構體分析-關鍵結構體之間的關系

參考鏈接 FFMPEG中最關鍵的結構體之間的關系_雷霄驊的博客-CSDN博客_ffmpeg 結構體關系 最關鍵的結構體可以分成以下幾類&#xff1a; 解協議&#xff08;http,rtsp,rtmp,mms&#xff09; AVIOContext&#xff0c;URLProtocol&#xff0c;URLContext主要存儲視音頻使用的協…

用Python下載文件

前提條件 需要事先安裝requests模塊&#xff1a; pip install requests 放碼過來 import requestsurl XXX #文件下載來源URL filename #下載到本地后新文件名 r requests.get(url) with open(filename, "wb") as code:code.write(r.content)實戰演習 從目標…

distenct oracle_Oracle的distinct關鍵字

distinct關鍵字用于從查詢的結果集中篩選出唯一值的記錄。我們通過示例來介紹distinct關鍵字的用法。一、生成測試數據用以下SQL創建超女基本信息表(T_GIRL)&#xff0c;插入一些測試數據。create table T_GIRL(id char(4) not null, -- 編號name varchar2(30) not null, -- 姓…

FFmpeg源代碼簡單分析-通用-常見結構體的初始化和銷毀(AVFormatContext,AVFrame等)

參考鏈接 FFmpeg源代碼簡單分析&#xff1a;常見結構體的初始化和銷毀&#xff08;AVFormatContext&#xff0c;AVFrame等&#xff09;_雷霄驊的博客-CSDN博客 結構體 AVFormatContext&#xff1a;統領全局的基本結構體。主要用于處理封裝格式&#xff08;FLV/MKV/RMVB等&…

python中object轉為float_object格式怎樣無損轉換成float64格式

這次給大家帶來object格式怎樣無損轉換成float64格式&#xff0c;object格式無損轉換成float64格式的注意事項有哪些&#xff0c;下面就是實戰案例&#xff0c;一起來看一下。在數據處理過程中比如從CSV文件中導入數據data_df pd.read_csv("names.csv")在處理之前一…

FFmpeg源代碼簡單分析-通用-avio_open2()

參考鏈接 FFmpeg源代碼簡單分析&#xff1a;avio_open2()_雷霄驊的博客-CSDN博客_avio_open avio_open2() 該函數用于打開FFmpeg的輸入輸出文件avio_open2()的聲明位于libavformat\avio.h文件中&#xff0c;如下所示。 /*** Create and initialize a AVIOContext for accessi…

用Tomcat構建一個簡單圖片服務器

前提條件 Tomcat 7.0.90 方法一&#xff1a;修改配置文件 在TOMCAT_HOME/conf/server.xml配置文件內的<Host>內添加一子標簽&#xff1a; <Context docBase"C:\exambase\" path"/img"/>方法二&#xff1a;添加Servlet 新建一應用&#xf…

flash靜態的農夫走路_健身神動作——你不知道的“農夫行走”

原標題&#xff1a;健身神動作——你不知道的“農夫行走”本期導讀握力是訓練中及其重要的一環&#xff0c;強大的握力會使你的訓練效果MAX&#xff0c;就像開了加速器一樣&#xff01;很多人把握力和前臂力量混為一談&#xff0c;主要使用腕彎舉提高握力。實際上&#xff0c;握…

FFmpeg源代碼簡單分析-通用-av_find_decoder()和av_find_encoder()

參考鏈接 FFmpeg源代碼簡單分析&#xff1a;av_find_decoder()和av_find_encoder()_雷霄驊的博客-CSDN博客_avcodec_find_encoder avcodec_find_encoder avcodec_find_encoder()用于查找FFmpeg的編碼器avcodec_find_encoder()的聲明位于libavcodec\codec.h 版本差異avcode…

用Java的Set實現交并差等集合運算

放碼過來 package com.lun.util;import java.util.HashSet; import java.util.Set;public class SetUtils {public static <T> Set<T> union(Set<T> setA, Set<T> setB) {Set<T> tmp new HashSet<T>(setA);tmp.addAll(setB);return tmp;…

post方法就反回了一個string字符串前臺怎么接_Golang Web入門(2):如何實現一個RESTful風格的路由...

摘要在上一篇文章中&#xff0c;我們聊了聊在Golang中怎么實現一個Http服務器。但是在最后我們可以發現&#xff0c;固然DefaultServeMux可以做路由分發的功能&#xff0c;但是他的功能同樣是不完善的。由DefaultServeMux做路由分發&#xff0c;是不能實現RESTful風格的API的&a…

FFmpeg源代碼簡單分析-通用-avcodec_open2()

參考鏈接 FFmpeg源代碼簡單分析&#xff1a;avcodec_open2()_雷霄驊的博客-CSDN博客 avcodec_open2() 該函數用于初始化一個音視頻編解碼器的AVCodecContextavcodec_open2()的聲明位于libavcodec\avcodec.h&#xff0c;如下所示。 /*** Initialize the AVCodecContext to use…