<p>The specific atom is in the <code>trak</code> metadata. When the <code>com.apple.quicktime.pixeldensity</code> metadata has the value <code>0x30</code>, quicktime will play it at double the DPI.</p>
<p>There is currently not very good support for transferring this atom when re-encoding the file. You may have success using the <code>use_metadata_tags</code> value for the <code>movflags</code> option if you are just copying the video.</p>
<p>Example:</p>
<pre><code># loses high dpi playback
ffmpeg -i retina_sample.mov -c copy new.mov  

# retains high dpi playback
ffmpeg -i retina_sample.mov -movflags use_metadata_tags -c copy new_high_dpi.mov
</code></pre>
<p>Hopefully soon <a href="https://trac.ffmpeg.org/ticket/7045" rel="nofollow noreferrer">issue 7045</a> will be addressed to fix this.</p>

CC BY-SA 4.0
2024-10-29T11:10:43.033Z
Created native screen recording with `⌘-⇧-5`. With HandBrake I transcoded `screen-recording.mov` to `screen-recording.mp4` (h264, RF 18). Saw no possibility in HandBrake itself to achieve the `Display Size` to be half of the `Storage Size` to achieve @2x resolution. With `ffmpeg` I'd like to postprocess the metadata/flags of the MP4 file without re-encoding anything. Does `-movflags use_metadata_tags` work between different container formats, e.g. from MOV to MP4 ? Can I transplant `com.apple.quicktime.pixeldensity` from the original MOV into the transcoded MP4 ?
porg
CC BY-SA 4.0
2020-12-15T07:32:17.817Z
2020-12-16T17:58:30.430Z
2020-12-16T17:58:30.430Z
hughes
<p>When you’re on a Mac with Retina Display (HiDPI), and you make a screen recording using QuickTime Player, whenever that video is played in QuickTime Player, it is shown with the expected 2:1 pixel density.</p>

<p>However, if you attempt to re-encode this video using ffmpeg (<a href="https://stackoverflow.com/questions/31586732/how-can-i-specify-pixel-density-in-ffmpeg-for-video-captured-on-retina-screen#_=_">like in this question on Stack Overflow</a>) the outputted file will instead be played back at a too-big/fuzzy 1:1 pixel density.</p>

<p>Also, if you attempt to play the QuickTime-generated screen recording in a player like VLC, you’ll notice it plays at the blurry 1:1 instead of the sharp 2:1. So it seems like there’s a feature in QuickTime Player that knows this video was captured at a 2x pixel density, so it needs to be played-back at a 2x pixel density.</p>

<p>How does QuickTime Player know when to play a video back in HiDPI/Retina mode? Is there <a href="https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html" rel="nofollow noreferrer">some special metadata that’s written to the file</a>?</p>

<p>How to reproduce:</p>

<ol>
<li>Use QuickTime Player to create a Screen Recording on a Retina Mac.</li>
<li>Play the video you recorded in QuickTime Player using the <code>⌘1 Actual Size</code> view. Notice that it’s playing 2:1 on your Retina Display, so the video looks sharp. It’s playing in half the space of the actual recorded pixels.</li>
<li><p>Use ffmpeg to encode the video using a command like this:</p>

<pre><code>ffmpeg -i retina_sample.mov -c:v libx264 -crf 23 retina_sample_compressed.mov
</code></pre></li>
<li>Play the new ffmpeg-compressed video in QuickTime Player using the <code>⌘1 Actual Size</code> view. Notice that it’s playing 1:1, so the video looks fuzzy.</li>
</ol>

<p>To clarify, the video does not look blurry because it was compressed. Rather, it looks blurry because the video is being played twice as big as it should be, at a 1:1 pixel density, instead of the required 2:1 pixel density, presumably because some metadata is being discarded when encoding.</p>

<p>Here are links to example videos:</p>

<ul>
<li>Before: <a href="https://www.dropbox.com/s/5a9l23jdlmhtqut/retina_sample.mov?dl=1" rel="nofollow noreferrer">https://www.dropbox.com/s/5a9l23jdlmhtqut/retina_sample.mov?dl=1</a></li>
<li>After: <a href="https://www.dropbox.com/s/v0ek4k981b0y2jn/retina_sample_compressed.mov?dl=1" rel="nofollow noreferrer">https://www.dropbox.com/s/v0ek4k981b0y2jn/retina_sample_compressed.mov?dl=1</a></li>
</ul>

CC BY-SA 3.0
2018-02-27T05:05:52.180Z
It'll be via an atom in the QT file. Upload a small sample and I'll check.
Gyan
CC BY-SA 3.0
2018-03-05T21:10:37.943Z
@Mulvya I edited the question to add two links: before and after videos.
Sean Moubry
CC BY-SA 3.0
2018-03-06T07:11:55.253Z
Does this file play in QT with 2:1? https://drive.google.com/open?id=1PPTE4zwN44g91D0Hsf5OvYrkLtJJ0g4K
Gyan
CC BY-SA 3.0
2018-03-06T14:51:48.783Z
@Mulvya No, it plays 1:1 (blown-up/blurry).
Sean Moubry
CC BY-SA 3.0
2018-03-07T19:14:14.687Z
@Mulvya I've uploaded new videos. I realized the original video I uploaded was not playing in 2x for me — videos of a certain smaller size seem to not be played back at 2x.
Sean Moubry
CC BY-SA 3.0
2018-03-07T20:07:20.623Z
Does `ffmpeg -i retina_sample.mov -c copy new.mov` play at 2:1?
Gyan
<ffmpeg><quicktime>
How does QuickTime Player know when do play a video in HiDPI/Retina/@2x mode?
Sean Moubry
# How does QuickTime Player know when do play a video in HiDPI/Retina/@2x mode?

(Asked by: username_0 on 2018-02-26)

When you’re on a Mac with Retina Display (HiDPI), and you make a screen recording using QuickTime Player, whenever that video is played in QuickTime Player, it is shown with the expected 2:1 pixel density.
However, if you attempt to re-encode this video using ffmpeg (like in this question on Stack Overflow) the outputted file will instead be played back at a too-big/fuzzy 1:1 pixel density.
Also, if you attempt to play the QuickTime-generated screen recording in a player like VLC, you’ll notice it plays at the blurry 1:1 instead of the sharp 2:1. So it seems like there’s a feature in QuickTime Player that knows this video was captured at a 2x pixel density, so it needs to be played-back at a 2x pixel density.
How does QuickTime Player know when to play a video back in HiDPI/Retina mode? Is there some special metadata that’s written to the file?
How to reproduce:

Use QuickTime Player to create a Screen Recording on a Retina Mac.
Play the video you recorded in QuickTime Player using the ⌘1 Actual Size view. Notice that it’s playing 2:1 on your Retina Display, so the video looks sharp. It’s playing in half the space of the actual recorded pixels.
Use ffmpeg to encode the video using a command like this:
ffmpeg -i retina_sample.mov -c:v libx264 -crf 23 retina_sample_compressed.mov

Play the new ffmpeg-compressed video in QuickTime Player using the ⌘1 Actual Size view. Notice that it’s playing 1:1, so the video looks fuzzy.

To clarify, the video does not look blurry because it was compressed. Rather, it looks blurry because the video is being played twice as big as it should be, at a 1:1 pixel density, instead of the required 2:1 pixel density, presumably because some metadata is being discarded when encoding.
Here are links to example videos:

Before: https://www.dropbox.com/s/5a9l23jdlmhtqut/retina_sample.mov?dl=1
After: https://www.dropbox.com/s/v0ek4k981b0y2jn/retina_sample_compressed.mov?dl=1

**Tags:** ffmpeg, quicktime

> **Comments:**
> **username_1**: It'll be via an atom in the QT file. Upload a small sample and I'll check.  
> **username_0**: @Mulvya I edited the question to add two links: before and after videos.  
> **username_1**: Does this file play in QT with 2:1? https://drive.google.com/open?id=1PPTE4zwN44g91D0Hsf5OvYrkLtJJ0g4K  
> **username_0**: @Mulvya No, it plays 1:1 (blown-up/blurry).  
> **username_0**: @Mulvya I've uploaded new videos. I realized the original video I uploaded was not playing in 2x for me — videos of a certain smaller size seem to not be played back at 2x.  
> **username_1**: Does `ffmpeg -i retina_sample.mov -c copy new.mov` play at 2:1?  

---

## 1 answers

### Answer by username_2 on 2020-12-15. Score: 3 | Accepted answer

The specific atom is in the trak metadata. When the com.apple.quicktime.pixeldensity metadata has the value 0x30, quicktime will play it at double the DPI.
There is currently not very good support for transferring this atom when re-encoding the file. You may have success using the use_metadata_tags value for the movflags option if you are just copying the video.
Example:
# loses high dpi playback
ffmpeg -i retina_sample.mov -c copy new.mov  

# retains high dpi playback
ffmpeg -i retina_sample.mov -movflags use_metadata_tags -c copy new_high_dpi.mov

Hopefully soon issue 7045 will be addressed to fix this.

> **Comments:**
> **username_3**: Created native screen recording with `⌘-⇧-5`. With HandBrake I transcoded `screen-recording.mov` to `screen-recording.mp4` (h264, RF 18). Saw no possibility in HandBrake itself to achieve the `Display Size` to be half of the `Storage Size` to achieve @2x resolution. With `ffmpeg` I'd like to postprocess the metadata/flags of the MP4 file without re-encoding anything. Does `-movflags use_metadata_tags` work between different container formats, e.g. from MOV to MP4 ? Can I transplant `com.apple.quicktime.pixeldensity` from the original MOV into the transcoded MP4 ?  

---

