簡體   English   中英

如何在 ffmpeg (c++) 中獲取視頻 stream 的格式

[英]How to get format of video stream in ffmpeg (c++)

我有一個 function 從 stream 讀取幀。 我想知道 stream 的格式是什么(我正在使用 H264 進行測試):

StreamingResult MediaWriter::Open(const AVFormatContext *const inputFormatContext,
                                  const fs::path &destination)
{
  // Save input stream data
  AVStream *videoStream = inputFormatContext->streams[FindVideoStreamIndex(inputFormatContext)];
  //....
}

如何從視頻 stream 中獲取格式/編解碼器類型? 我期待收到H264,但將來會收到其他格式。

PS:一些好的 FFMPEG 文檔將不勝感激,因為我迷失在 Doxygen 生成的文檔中。

Some good FFMPEG documentation would be appreciated, because I am getting lost in Doxygen generated documentation.

Doxygen 是最好的 ffmpeg 文檔。 它只是 ffmpeg 是一個非常大的項目,需要時間來學習。

您正在尋找的是videoStream ->codecpar -> codec_id

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM