ffmpeg calculate video bitrate

MPM Уеб Дизайн picture MPM Уеб Дизайн · Apr 6, 2017 · Viewed 8.6k times · Source

I would like to know how to calculate the bitrate of this video:
http://jell.yfish.us/media/jellyfish-30-mbps-hd-hevc.mkv

Video details: jellyfish-30-mbps-hd-hevc Video details From MediaInfo

I used Format Factory 4.0.0 to convert *.mkv video to *.mp4 with quality [AVC High quality and size] and its command sent to ffmpeg is:

-y -i ellyfish-30-mbps-hd-hevc.mkv -s 1920x1080 -b:v 2724k -ac 2 -r 29.970 -c:v libx264 -ar 48000 -b:a 192k -c:a aac -aspect 16:9 jellyfish-30-mbps-hd-hevc [AVC High quality and size].mp4 

Question:
How does Format Factory calculate the video bitrate as : -b:v 2724k?

Answer

Mick picture Mick · Apr 7, 2017

If you just mean how do you examine the video file to find its bit rate, then you can use ffprobe (https://ffmpeg.org/ffprobe.html) to do this with the command:

./ffprobe jellyfish-30-mbps-hd-hevc.mkv

This will give an output like this - see the bitrate in the 'input #0' information:

ffprobe version 2.6.1 Copyright (c) 2007-2015 the FFmpeg developers
  built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, matroska,webm, from 'jellyfish-30-mbps-hd-hevc.mkv':
  Metadata:
    COMPATIBLE_BRANDS: iso4hvc1iso6
    MAJOR_BRAND     : iso4
    MINOR_VERSION   : 1
    ENCODER         : Lavf56.3.100
  Duration: 00:00:30.10, start: 0.067000, bitrate: 30388 kb/s
    Stream #0:0(und): Video: hevc (Main), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn, 29.97 tbc (default)
    Metadata:
      CREATION_TIME   : 2016-02-05 01:05:30
      LANGUAGE        : und
      HANDLER_NAME    : [email protected]

Its important to note that it is not simply the size of the mkv file divided by the duration of the movie in case this is what you are asking (I am guessing you may have noticed this already). The mkv file is a container (as is mp4 for example) and may contain multiple video, audio, subtitle streams etc along with headers and other overhead.

The file size of your video is so much larger than the video stream bit rate times the duration, however that it may indicate there is an issue either with the file or with the ffprobe interpretation of the data. Using another tool, media info (https://mediaarea.net/en/MediaInfo), the tool fails to read the file on my machine which suggests there may indeed be some problem,

Its also worth being aware that video may have variable bit rate encodings in case that is important in your use case - i.e. the bit rate may vary at different points in the video, so a bit rate figure for an overall stream has to be interpreted with this in mind.