Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Announcements and Chat > General Discussion

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th January 2021, 12:15   #1  |  Link
d3crypti0n
Registered User
 
Join Date: Aug 2020
Posts: 18
MKVtoolNix Bitrate change

Hello everybody,

Yesterday evening I extracted a Movie using MakeMKV and also kept the bonuses on that disc. After the extraction I usually use a tool called MKV Optimizer which uses MKVToolNix to remove all subtitles and audio tracks which are not the ones set in the condition (meaning only German and English Audio- und Subtitle tracks will be kept).

There I noticed that after the re-Mux the video bitrate was smaller. It is no way near of a big deal (it went from 4 994 kb/s to 4 993 Kb/s). I googled and found out that it was due to the Subtitles being compressed with zlib and if I understood correct they were somehow part of the video which decreased the bitrate.
Is this right so far?

But since the MKV Optimizer tool runs through every file it also changes the Bitrate of videos were no muxing needs to be done. There is one short clip which had only one Audio track and no subtitle tracks so in conclusion nothing had to be removed and nothing should have been changed. But the video bitrate changed from 4 993 Kb/s to 4 895 Kb/s. Again, this is no big deal but I still wonder why this happened. Since MKVToolNix does not re-encode I wonder why my bitrate decreased ? Can someone explain why and also if there has been a (even little) drop in quality?

Edit: Both videos used AVC and there has been no change of video length.
d3crypti0n is offline   Reply With Quote
Old 10th January 2021, 15:32   #2  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
How are you determining the bitrate?
hello_hello is offline   Reply With Quote
Old 10th January 2021, 16:42   #3  |  Link
d3crypti0n
Registered User
 
Join Date: Aug 2020
Posts: 18
I use mediainfo GUI
d3crypti0n is offline   Reply With Quote
Old 10th January 2021, 20:57   #4  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
You can use mkvextract and compare the video stream filesize , or check the quality with metrics such as PSNR

PSNR is better to confirm , because padding and junk can get removed, headers stripped, changing the filesize slightly.
poisondeathray is offline   Reply With Quote
Old 10th January 2021, 22:26   #5  |  Link
d3crypti0n
Registered User
 
Join Date: Aug 2020
Posts: 18
How do I check the PSNR?
d3crypti0n is offline   Reply With Quote
Old 10th January 2021, 22:30   #6  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by d3crypti0n View Post
How do I check the PSNR?
you can use ffmpeg

https://ffmpeg.org/ffmpeg-filters.html#psnr

eg
Code:
ffmpeg -i muxed.mkv -i original.mkv -lavfi  "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
If it's "infinity" then streams are the same. Anything else means different

The timecodes have to be the same, otherwise ffmpeg might be comparing different frames.
poisondeathray is offline   Reply With Quote
Old 10th January 2021, 22:35   #7  |  Link
d3crypti0n
Registered User
 
Join Date: Aug 2020
Posts: 18
Sorry to ask again, what am I supposed to see or see not ?

Edit: Extracting both streams with mkvmerge to a .h264 resulted in the exact same file size according to the Windows File Explorer
d3crypti0n is offline   Reply With Quote
Old 10th January 2021, 22:37   #8  |  Link
d3crypti0n
Registered User
 
Join Date: Aug 2020
Posts: 18
Edit 2: you mean this with infinity?:

[Parsed_psnr_4 @ 0x7f93e750e700] PSNR y:inf u:inf v:inf average:inf min:inf max:inf
d3crypti0n is offline   Reply With Quote
Old 10th January 2021, 22:38   #9  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by d3crypti0n View Post
Sorry to ask again, what am I supposed to see or see not ?
It measures the quality of a video vs. original . If result is "inf" (infinity), then it's identical. It decodes the actual video, so it's more accurate than something like filesize

Quote:
Edit: Extracting both streams with mkvmerge to a .h264 resulted in the exact same file size according to the Windows File Explorer
That's probably good enough for most people, because mkvmerge does not re-encode

If you want to be 100% accurate, check with PSNR


Quote:
Originally Posted by d3crypti0n View Post
Edit 2: you mean this with infinity?:

[Parsed_psnr_4 @ 0x7f93e750e700] PSNR y:inf u:inf v:inf average:inf min:inf max:inf
Yes. Perfect.
poisondeathray is offline   Reply With Quote
Old 10th January 2021, 22:41   #10  |  Link
d3crypti0n
Registered User
 
Join Date: Aug 2020
Posts: 18
That's good.
Thank you for that. But still, any idea why the Bitrate changed even if there are no additional things like audio or subtitle tracks?

Also, you mentioned junk and padding, what's up with that?
d3crypti0n is offline   Reply With Quote
Old 10th January 2021, 22:55   #11  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Mediainfo's reported bitrate isn't the actual bitrate (think about it, you demuxed it and have the exact same filesize. That means exact same bitrate if the running time is the same)

Yes mkvmerge removes things like junk stuffing bytes, empty NALU's . Look at the changelog to see what it removes from different streamtypes for different versions of mkvmerge

If you had started with a different container instead of mkv, the actual video stream can be a different filesize too, because it removes some sequence headers. But the actual decoded video data, and there fore the PSNR , will be the same
poisondeathray is offline   Reply With Quote
Old 10th January 2021, 23:06   #12  |  Link
d3crypti0n
Registered User
 
Join Date: Aug 2020
Posts: 18
Ah Okay understood. Thank you my friend for your explanation.
d3crypti0n is offline   Reply With Quote
Reply

Tags
avc, bitrate, mkvtoolnix

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 14:52.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.