如何在ffmpeg(c)中获取视频流的格式 | 珊瑚贝

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


我有一个从流中读取帧的函数。我想知道流的格式是什么(我正在使用 H264 进行测试):

1
2
3
4
5
6
7
StreamingResult MediaWriter::Open(const AVFormatContext *const inputFormatContext,
                                  const fs::path &destination)
{
  // Save input stream data
  AVStream *videoStream = inputFormatContext>streams[FindVideoStreamIndex(inputFormatContext)];
  //….
}

如何从视频流中获取格式/编解码器类型?我预计会收到 H264,但将来会收到其他格式。

P.S.:一些好的 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


来源:https://www.codenong.com/63035951/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_8639.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?