1

How can we find bitrate of a video file in c++? Can we do this by file handling?

Thanks

user229044
  • 232,980
  • 40
  • 330
  • 338
Umer Farooq
  • 7,356
  • 7
  • 42
  • 67

4 Answers4

2

Install FFMEPG it will give you all the information related to the video

e.g.

ffmpeg -i filename.flv
  • Thanks buddy! but is there anyway to do it using pure C++. Just Asking! BTW thanks – Umer Farooq Apr 17 '12 at 05:21
  • Well you will need to understand how so many video file formats work, basically it will be a BYTE level inspection of data and from there . you will decide what the bit rate would be. Doable but lengthy. Here is a link to Avi header formate. Read down to samples per second part and you will understand what I mean http://www.adp-gmbh.ch/win/programming/avi/avi.html –  Apr 17 '12 at 05:23
  • Thats preety difficult cux I haven't learnt Win32 Api. I'll see may be i'll use ffmepg. – Umer Farooq Apr 17 '12 at 11:29
  • You can use ffmpeg C library. http://www.ffmpeg.org/doxygen/2.2/group__libavc.html – java_geek Oct 06 '14 at 14:56
1

If you want to implement such yourself you need to be able to read the video container format (Quicktime, ASF, AVI, Matroska etc) and try to find the bitrate from the metadata.

Petteri H
  • 11,779
  • 12
  • 64
  • 94
0

You can use ffprobe from the ffmpeg project to get the information about your video files and get a nice JSON ouput.

Check this answer for an example.

Community
  • 1
  • 1
Paulo Fidalgo
  • 21,709
  • 7
  • 99
  • 115
0

Bitrate can be accessed from an AVFormatContext formed from an open video file. See this answer for an example of how to open the format context and access using c++.

You might also take a look at get_bit_rate(...) from avcodec.c, which returns the correct bitrate, even when the codec_type for the format context is an audio file.

treavg
  • 189
  • 1
  • 8