1

I have a function that reads frames from a stream. I want to find out what the format of the stream is (I'm testing with H264):

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

How can I get the format/codec type from the video stream? I am expecting to receive H264, but other formats will be received in the future.

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

genpfault
  • 49,394
  • 10
  • 79
  • 128
Serban Stoenescu
  • 2,308
  • 3
  • 19
  • 37
  • 1
    You might want to look at the answers/comments from [this post](https://stackoverflow.com/questions/2641460/ffmpeg-c-api-documentation-tutorial). – G.M. Jul 22 '20 at 14:04

1 Answers1

1

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

Doxygen is th best ffmpeg documentation there is. Its just ffmpeg is a very large peroject and takes time to learn.

What you are looking for is videoStream->codecpar->codec_id

szatmary
  • 28,669
  • 7
  • 42
  • 56