網站首頁 編程語言 正文
struct OutputFile
struct OutputFile
?是單個輸出文件的管理器。之前在?parse_optgroup()
?處理好的?OptionsContext o
?變量,有一部分字段會賦值給?OutputFile
?管理器
如下:
OptionsContext o
?變量的另一部分字段,會在?open_output_file()
?里面傳遞給 API 函數,例如:avformat_write_header()
,或者賦值給?OutputStream
?的一些字段。
ret = avformat_write_header(of->ctx, &of->opts);
output_files
?全局變量是一個數組,里面的成員正是?OutputFile
,所以你在二次開發?ffmpeg.exe
?的時候,可以通過?output_files
?全局變量獲取到所有的輸出文件的信息。
OutputFile **output_files = NULL; int nb_output_files = 0;
我們接下來仔細學習一下?struct OutputFile
?的結構,如下:
typedef struct OutputFile { AVFormatContext *ctx; AVDictionary *opts; int ost_index; /* index of the first stream in output_streams */ int64_t recording_time; ///< desired length of the resulting file in microseconds == AV_TIME_BASE units int64_t start_time; ///< start time in microseconds == AV_TIME_BASE units uint64_t limit_filesize; /* filesize limit expressed in bytes */ int shortest; int header_written; } OutputFile;
相比?InputFile
,OutputFile
?數據結構的字段簡直太少了,讀起來太爽了。
struct OutputFile?字段解析
1, AVFormatContext *ctx
,容器上下文,也叫容器實例。
2, AVDictionary *opts
,容器格式的參數,是從?OptionsContext
?里面 的?OptionGroup
?的?format_opts
?復制過來的,如下:
av_dict_copy(&of->opts, o->g->format_opts, 0);
opts
?會傳遞給?avformat_write_header()
?函數,如下:
ret = avformat_write_header(of->ctx, &of->opts);
3, int ost_index
,輸出文件的第一個流在?output_streams
?數組里面的索引,output_streams
?數組是一個全局變量,里面包含所有輸出文件的所有輸出流。你二次開發?ffmpeg.exe
?的時候,可以使用?output_streams
?數組,獲取到所有的輸出流。
4, int64_t recording_time
,命令行選項?-t
?的值,設置輸出文件的時長,單位是微秒,具體的功能是通過?trim
?濾鏡來實現的。
5, int64_t start_time
,標記輸出文件的開始時間,例如一個輸入文件本來是 6 分鐘的,你可以用?-ss 120
?指定?start_time
,這樣,輸出文件就會裁剪成 第 2 ~ 6分鐘 的視頻,前面 2 分鐘丟棄。
6, uint64_t limit_filesize
,限制輸出文件的大小,一旦達到這個大小,輸出文件立即結束。
7, int shortest
,命令行選項?-shortest
?的值,當最短的輸出流結束的時候,整個文件就結束了,例如一個輸出文件里面有 音頻流 跟 視頻流,視頻流 3 分鐘,音頻流 5 分鐘。如果啟用了這個選項,音頻流就會被裁剪成 3 分鐘。
8, int header_written
,是否已經調用了?avformat_write_header()
?函數,往輸出文件寫入了頭部信息。
原文鏈接:https://juejin.cn/post/7159422966650896415
相關推薦
- 2022-04-22 golang數據類型【字符類型】以及fmt的輸出輸入、UTF-8 和 Unicode 有何區別?
- 2023-01-01 matplotlib基本圖形繪制操作實例_python
- 2022-06-16 React實現核心Diff算法的示例代碼_React
- 2022-04-10 SpringBoot 導入插件報錯 Cannot resolve plugin org.spring
- 2022-11-05 Android?Jetpack組件中LifeCycle作用詳細介紹_Android
- 2022-01-10 解決遮罩下方元素禁止滾動
- 2023-11-23 cmake: command not found
- 2022-05-31 Python中的?if?語句及使用方法_python
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支