Answers.Body: <p>For mkv files, you can use mkvpropedit —add-track-statistics-tags to add stream level data.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-16T00:34:28.907Z
Answers.LastActivityDate: 2020-08-16T00:34:28.907Z
Answers.UserDisplayName: Jeff Rice
Answers.Body: <p>Bitrate isn't calculated from stream size, but the number is saved in file as special field/metadata. Now, the problem with ffmpeg (or rather libmatroska) and Matroska (MKV) muxer is it doesn't save such data. </p>
  
  <p>If you are able, use another container - for me switching to MP4 helped. While it's in Handbrake's GitHub, there's discussion about bitrate in MKV here: <a href="https://github.com/HandBrake/HandBrake/issues/1609" rel="nofollow noreferrer">https://github.com/HandBrake/HandBrake/issues/1609</a></p>
  
  <p>PS: As I see you are into open source, I bet MP4 is not a good way, but it's the only I know. I'll be happy to find out how to add such metadata to MKV.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-30T21:17:43.773Z
Answers.LastActivityDate: 2020-04-30T21:17:43.773Z
Answers.UserDisplayName: Krzysiu
Body: <p>I've downloaded a video from YouTube, well I've downloaded the video stream and the audio stream of a YouTube video separately. Then with this ffmpeg command <code>ffmpeg -protocol_whitelist "file,http,https,tcp,tls" -i video.mp4 -i audio.webm -acodec copy -vcodec copy output.mkv</code> I merged the two streams together.</p>
  
  <p>Using the <code>ffprobe -i audio.webm -show_streams -hide_banner</code> command it gives me the bitrate of the audio file but not of the stream (in this case it's not crucial since the file is only one stream) :</p>
  
  <pre><code>Duration: 01:35:26.06, start: -0.007000, bitrate: 119 kb/s
    Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
  </code></pre>
  
  <p>But in the detailed stream informations I get after thanks to the parameter <code>-show-streams</code> it doesn't give me the bit rate of the stream : <code>bit_rate=N/A</code></p>
  
  <p>Same command with the video file :</p>
  
  <pre><code>Duration: 01:35:26.04, start: 0.000000, bitrate: 213 kb/s
     Stream #0:0(und): Video: av1 (Main) (av01 / 0x31307661), yuv420p(tv), 640x284, 0 kb/s, 24 fps, 24 tbr, 12288 tbn, 12288 tbc (default)
  </code></pre>
  
  <p>And again in the detailed stream informations it doesn't give me 213 for the bitrate of the stream but 21 (I don't know why) : <code>bit_rate=21</code>.</p>
  
  <p>However when I try the same command with the mkv file that contains the audio and video streams I get that :</p>
  
  <pre><code>Duration: 01:35:26.06, start: -0.007000, bitrate: 331 kb/s
    Stream #0:0: Video: av1 (Main), yuv420p(tv), 640x284, 24 fps, 24 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
  </code></pre>
  
  <p>So I get an overall bit rate but not the bitrate of each stream which is more annoying. In the detailed stream informations for both streams I have : <code>bit_rate=N/A</code>.</p>
  
  <p>Using other tools, mediainfo for example.
  On the audio file (<code>mediainfo --fullscan Ofitsery.webm</code>) I have an overall bitrate for the file : <code>Overall bit rate : 120 kb/s</code> but no bitrate indicated for the audio stream.
  For the video file (<code>mediainfo --fullscan Ofitsery.mp4</code>) I have an overall bitrate : <code>Overall bit rate : 213 kb/s</code> and a bitrate for the video stream which is not exactly the same (on a file with only one stream) : <code>Bit rate : 211 kb/s</code>.
  But on my mkv file that contains the audio and the video stream I have an overall bitrate : <code>Overall bit rate : 332 kb/s</code> but no bitrate neither for the video stream nor the audio stream.</p>
  
  <p>It annoys me because I'd like to check if I have bitrate loss during the file merging and I can't check the bit rate of the streams separately.
  Beside why are there 1 or 2 kb/s differences sometimes ?</p>
  
Tags: <video><ffmpeg><audio><bitrate><ffprobe>
Title: Why I can't check the bit rate on some videos?
UserDisplayName: Nicryc
ThreadText: # Why I can't check the bit rate on some videos?
  
  (Asked by: username_0 on 2019-12-19)
  
  I've downloaded a video from YouTube, well I've downloaded the video stream and the audio stream of a YouTube video separately. Then with this ffmpeg command `ffmpeg -protocol_whitelist "file,http,https,tcp,tls" -i video.mp4 -i audio.webm -acodec copy -vcodec copy output.mkv` I merged the two streams together.
  
  Using the `ffprobe -i audio.webm -show_streams -hide_banner` command it gives me the bitrate of the audio file but not of the stream (in this case it's not crucial since the file is only one stream) :
  
  ```
  Duration: 01:35:26.06, start: -0.007000, bitrate: 119 kb/s
    Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
  
  ```
  
  But in the detailed stream informations I get after thanks to the parameter `-show-streams` it doesn't give me the bit rate of the stream : `bit_rate=N/A`
  
  Same command with the video file :
  
  ```
  Duration: 01:35:26.04, start: 0.000000, bitrate: 213 kb/s
     Stream #0:0(und): Video: av1 (Main) (av01 / 0x31307661), yuv420p(tv), 640x284, 0 kb/s, 24 fps, 24 tbr, 12288 tbn, 12288 tbc (default)
  
  ```
  
  And again in the detailed stream informations it doesn't give me 213 for the bitrate of the stream but 21 (I don't know why) : `bit_rate=21`.
  
  However when I try the same command with the mkv file that contains the audio and video streams I get that :
  
  ```
  Duration: 01:35:26.06, start: -0.007000, bitrate: 331 kb/s
    Stream #0:0: Video: av1 (Main), yuv420p(tv), 640x284, 24 fps, 24 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
  
  ```
  
  So I get an overall bit rate but not the bitrate of each stream which is more annoying. In the detailed stream informations for both streams I have : `bit_rate=N/A`.
  
  Using other tools, mediainfo for example.
  On the audio file (`mediainfo --fullscan Ofitsery.webm`) I have an overall bitrate for the file : `Overall bit rate : 120 kb/s` but no bitrate indicated for the audio stream.
  For the video file (`mediainfo --fullscan Ofitsery.mp4`) I have an overall bitrate : `Overall bit rate : 213 kb/s` and a bitrate for the video stream which is not exactly the same (on a file with only one stream) : `Bit rate : 211 kb/s`.
  But on my mkv file that contains the audio and the video stream I have an overall bitrate : `Overall bit rate : 332 kb/s` but no bitrate neither for the video stream nor the audio stream.
  
  It annoys me because I'd like to check if I have bitrate loss during the file merging and I can't check the bit rate of the streams separately.
  Beside why are there 1 or 2 kb/s differences sometimes ?
  
  **Tags:** video, ffmpeg, audio, bitrate, ffprobe
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-08-16. Score: 2
  
  For mkv files, you can use mkvpropedit —add-track-statistics-tags to add stream level data.
  
  
  ---
  
  ### Answer by username_2 on 2020-04-30. Score: 1
  
  Bitrate isn't calculated from stream size, but the number is saved in file as special field/metadata. Now, the problem with ffmpeg (or rather libmatroska) and Matroska (MKV) muxer is it doesn't save such data.
  
  If you are able, use another container - for me switching to MP4 helped. While it's in Handbrake's GitHub, there's discussion about bitrate in MKV here: <https://github.com/HandBrake/HandBrake/issues/1609>
  
  PS: As I see you are into open source, I bet MP4 is not a good way, but it's the only I know. I'll be happy to find out how to add such metadata to MKV.
  
  
  ---
  
  