cropping: make DisplayWidth/DisplayHeight include cropped area#947
Open
kasper93 wants to merge 1 commit intoietf-wg-cellar:masterfrom
Open
cropping: make DisplayWidth/DisplayHeight include cropped area#947kasper93 wants to merge 1 commit intoietf-wg-cellar:masterfrom
DisplayWidth/DisplayHeight include cropped area#947kasper93 wants to merge 1 commit intoietf-wg-cellar:masterfrom
Conversation
The primary motivation for this change is to ensure that Matroska files with `PixelCrop*` elements are displayed consistently, regardless of whether cropping is applied. This makes such files compatible across software that either supports or ignores these elements. Without this change, files suffer from limited compatibility, whereas cropping tags should enhance the experience rather than be a requirement for proper image display. A secondary motivation is that an overwhelming number of files in the wild do not actually adjust the `DisplayWidth`/`DisplayHeight` elements as expected by the specification. Most of the time, these values are left uncropped, with the expectation that cropping will be applied later. This issue arises partly because MKVToolNix does not automatically perform this calculation, it only sets the `PixelCrop*` elements unless explicitly instructed by the user. Observing the existing files in circulation, it is evident that almost no one manually adjusts these values. Lastly, some subtitle formats depend on the video size for positioning and rendering, making them sensitive to cropping. Currently, most authoring tools do not take cropping into account. By making the Matroska specification more flexible and allowing subtitles to be cropped along with the video, it becomes easier to produce files that are compatible with various Matroska players. For a more detailed discussion on this topic, please refer to the links below: See: https://gitlab.com/mbunkus/mkvtoolnix/-/issues/2389 See: mpv-player/mpv#13446
kasper93
added a commit
to kasper93/mpv
that referenced
this pull request
Feb 26, 2025
I don't expect the Matroska specification to be adjusted for this to work soon, so in the meantime, follow the spec as written and add an option to support most files in the wild. I would prefer this to never be an option, but it looks like it's unavoidable. Recently, FFmpeg added cropping support for Matroska, so we don’t want to be the odd one out by doing it differently... See for more details: ietf-wg-cellar/matroska-specification#947 https://gitlab.com/mbunkus/mkvtoolnix/-/issues/2389 mpv-player#13446 Fixes: mpv-player#15800
kasper93
added a commit
to kasper93/mpv
that referenced
this pull request
Mar 3, 2025
I don't expect the Matroska specification to be adjusted for this to work soon, so in the meantime, follow the spec as written and add an option to support most files in the wild. I would prefer this to never be an option, but it looks like it's unavoidable. Recently, FFmpeg added cropping support for Matroska, so we don’t want to be the odd one out by doing it differently... See for more details: ietf-wg-cellar/matroska-specification#947 https://gitlab.com/mbunkus/mkvtoolnix/-/issues/2389 mpv-player#13446 Fixes: mpv-player#15800
kasper93
added a commit
to mpv-player/mpv
that referenced
this pull request
Mar 4, 2025
I don't expect the Matroska specification to be adjusted for this to work soon, so in the meantime, follow the spec as written and add an option to support most files in the wild. I would prefer this to never be an option, but it looks like it's unavoidable. Recently, FFmpeg added cropping support for Matroska, so we don’t want to be the odd one out by doing it differently... See for more details: ietf-wg-cellar/matroska-specification#947 https://gitlab.com/mbunkus/mkvtoolnix/-/issues/2389 #13446 Fixes: #15800
HopperLogger
pushed a commit
to HopperLogger/mpv-frame-interpolator
that referenced
this pull request
Mar 26, 2025
I don't expect the Matroska specification to be adjusted for this to work soon, so in the meantime, follow the spec as written and add an option to support most files in the wild. I would prefer this to never be an option, but it looks like it's unavoidable. Recently, FFmpeg added cropping support for Matroska, so we don’t want to be the odd one out by doing it differently... See for more details: ietf-wg-cellar/matroska-specification#947 https://gitlab.com/mbunkus/mkvtoolnix/-/issues/2389 mpv-player#13446 Fixes: mpv-player#15800
trim21
pushed a commit
to trim21/mpv
that referenced
this pull request
Dec 25, 2025
I don't expect the Matroska specification to be adjusted for this to work soon, so in the meantime, follow the spec as written and add an option to support most files in the wild. I would prefer this to never be an option, but it looks like it's unavoidable. Recently, FFmpeg added cropping support for Matroska, so we don’t want to be the odd one out by doing it differently... See for more details: ietf-wg-cellar/matroska-specification#947 https://gitlab.com/mbunkus/mkvtoolnix/-/issues/2389 mpv-player#13446 Fixes: mpv-player#15800
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The primary motivation for this change is to ensure that Matroska files with
PixelCrop*elements are displayed consistently, regardless of whether cropping is applied. This makes such files compatible across software that either supports or ignores these elements. Without this change, files suffer from limited compatibility, whereas cropping tags should enhance the experience rather than be a requirement for proper image display.A secondary motivation is that an overwhelming number of files in the wild do not actually adjust the
DisplayWidth/DisplayHeightelements as expected by the specification. Most of the time, these values are left uncropped, with the expectation that cropping will be applied later. This issue arises partly because MKVToolNix does not automatically perform this calculation, it only sets thePixelCrop*elements unless explicitly instructed by the user. Observing the existing files in circulation, it is evident that almost no one manually adjusts these values.Lastly, some subtitle formats depend on the video size for positioning and rendering, making them sensitive to cropping. Currently, most authoring tools do not take cropping into account. By making the Matroska specification more flexible and allowing subtitles to be cropped along with the video, it becomes easier to produce files that are compatible with various Matroska players.
For a more detailed discussion on this topic, please refer to the links below:
See: https://gitlab.com/mbunkus/mkvtoolnix/-/issues/2389
See: mpv-player/mpv#13446