FFmpeg Settings for Apple TV 4K Video Encoding
This article provides a direct guide on how to configure FFmpeg parameters to encode videos compatible with the Apple TV 4K. You will learn the exact command-line arguments needed for both H.264 (Standard Definition/HD) and HEVC/H.265 (4K/HDR) video formats, along with optimal audio configurations to ensure seamless playback on Apple’s streaming device.
Apple TV 4K Video Specifications
To play videos natively on Apple TV 4K without transcoding, your files must meet these specifications: * HEVC (H.265): Up to 2160p (4K) at 60 fps, Main/Main 10 Profile with HDR10/Dolby Vision. * H.264 (AVC): Up to 1080p/4K at 60 fps, High or Main Profile level 4.2 or lower. * Audio: AAC-LC (up to 320 Kbps), HE-AAC, AC-3 (Dolby Digital), E-AC-3 (Dolby Digital Plus up to 7.1), or FLAC. * Container: MP4, M4V, or MOV.
Command for 4K HEVC (HDR10) Encoding
For 4K HDR content, HEVC (H.265) is the required codec. Apple devices
require a specific tag (hvc1) to recognize and
hardware-decode HEVC files.
Use the following command to encode a 10-bit 4K video with Dolby Digital Plus (E-AC-3) audio:
ffmpeg -i input.mkv -c:v libx265 -pix_fmt yuv420p10le -profile:v main10 -tag:v hvc1 -preset medium -crf 22 -c:a eac3 -b:a 640k output.mp4Parameter Breakdown: * -c:v libx265:
Uses the x265 encoder for HEVC video. *
-pix_fmt yuv420p10le: Sets 10-bit color depth, which is
required for HDR10 compatibility. * -profile:v main10:
Targets the HEVC Main 10 profile. * -tag:v hvc1: Crucial
step that writes the “hvc1” video handler brand into the metadata.
Without this, Apple TV will refuse to play the file. *
-crf 22: Constant Rate Factor. Controls quality; 20-23 is
ideal for 4K. * -c:a eac3 -b:a 640k: Encodes audio to Dolby
Digital Plus at 640 Kbps for surround sound systems.
Command for H.264 (SDR/1080p) Encoding
For standard dynamic range (SDR) or 1080p video, H.264 (AVC) is highly compatible and easier to encode.
Use this command to encode an H.264 video with stereo AAC audio:
ffmpeg -i input.mkv -c:v libx264 -pix_fmt yuv420p -profile:v high -level 4.2 -preset medium -crf 20 -c:a aac -b:a 256k output.mp4Parameter Breakdown: * -c:v libx264:
Uses the x264 encoder for H.264 video. * -pix_fmt yuv420p:
Sets the standard 8-bit YUV 4:2:0 chroma subsampling. *
-profile:v high -level 4.2: Targets the High Profile at
Level 4.2, which guarantees smooth hardware decoding on the Apple TV. *
-crf 20: Sets the quality target for H.264 (lower means
higher quality; 18-22 is standard). * -c:a aac -b:a 256k:
Encodes audio to standard AAC stereo at 256 Kbps.
Remuxing without Re-encoding (Fastest Method)
If your video file already uses compatible video streams (like H.264 or HEVC with the correct profiles) but is in an unsupported container (like MKV), you can copy the video track without re-encoding to save time.
ffmpeg -i input.mkv -c:v copy -tag:v hvc1 -c:a aac -b:a 256k output.mp4This command copies the video stream directly
(-c:v copy), applies the required Apple compatibility tag
(-tag:v hvc1), and transcodes only the audio to AAC,
completing the process in seconds.