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 ?


For mkv files, you can use mkvpropedit —add-track-statistics-tags to add stream level data.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.