[FFmpeg-trac] #7045(undetermined:new): Should retain pixel density metadata from HiDPI/Retina screen recordings

FFmpeg trac at avcodec.org
Wed Mar 17 14:48:36 EET 2021

#7045: Should retain pixel density metadata from HiDPI/Retina screen recordings
             Reporter:  moubry       |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  unspecified  |               Resolution:
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
Changes (by danielkaiser):

 * cc: daniel.kaiser94@… (added)


 I recently implemented this feature to generate mov files for HiDPI
 screens. And unlike mentioned in the previous comment a bit more data is
 required for this feature to work properly, but it also offers more
 possibilities than simply showing videos in half scale.

 As already mentioned the `com.apple.quicktime.pixeldensity` metadata tag
 is required in the `trak` meta atom followed by a value of 0x30. However
 0x30 is not the actual value of this metadata tag but the size of the
 following `ilst` atom which (among other things) includes 16 Bytes of data
 representing 4 uint32_t. The first pair of these values seems to specify
 the actual pixel resolution of the video stream, the second specifies the
 desired playback resolution (unfortunately, I wasn't able to find any
 documentation from Apple proving this, but regarding my tests it is almost
 certainly the case). This allows arbitrary playback resolutions to be
 defined through the metadata.

 Attached is a diff based on ffmpeg version 4.2.1 adding this feature to
 mov encoding using the `write_pixeldensity` flag. This is a quick-and-
 dirty implementation with the primary aim to keep the patch simple and
 small setting the playback resolution to a fixed half scale. This code is
 far from production ready and containing ''a lot'' of hard-coded values
 but it might be a help for someone who wants to implement this properly.

Ticket URL: <https://trac.ffmpeg.org/ticket/7045#comment:8>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list