How does QuickTime Player know when do play a video in HiDPI/Retina/@2x mode? 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
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.