cropping: make DisplayWidth
/DisplayHeight
include cropped area
#947
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
/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 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