2024-09-24 Video Production
Preparing MP4s for Cinema Surround and DCP with DCP-O-Matic
By O. Wolfson
Creating a polished, professional-quality cinema experience requires careful attention to both the video and audio formats. When preparing video content for projection on a surround sound system in theaters, it’s essential to ensure the resolution, aspect ratio, and audio configurations are all optimized for a Digital Cinema Package (DCP). In this guide, we’ll walk through the steps we follow to prepare stereo MP4s for the cinema, focusing on video conversion, audio upscaling to Dolby Digital 5.1 surround sound, and final packaging as a DCP using DCP-O-Matic.
Step 1: Video Conversion to a DCP-Compatible Resolution
One of the first decisions when creating a DCP is selecting the proper video resolution. DCP supports several resolutions, each suited to specific aspect ratios and projection systems. For our project, since our source material is in 1080p (1920x1080), we typically convert it to 2K flat (1998x1080), which closely matches the original resolution and avoids unnecessary upscaling or cropping. However, DCPs can be created using a variety of resolutions depending on the original content and target output.
Common DCP-Compatible Resolutions:
-
2K Flat (1998x1080):
- Aspect Ratio: ~1.85:1
- When to use it: This resolution is ideal when your source material has an aspect ratio close to 1.85:1 (standard for many films and TV shows) and is in 1080p. The minimal scaling ensures that image quality is preserved without introducing artifacts.
-
2K Scope (2048x858):
- Aspect Ratio: ~2.39:1 (widescreen)
- When to use it: Use this resolution for content originally shot in a widescreen format. Scope films tend to be more cinematic, with a wider field of view, making this resolution ideal for projects designed for a true cinema experience.
-
4K Flat (3996x2160):
- Aspect Ratio: ~1.85:1
- When to use it: This resolution is used when a higher-quality source, such as 4K video, is available. It offers double the resolution of 2K flat, resulting in sharper and more detailed imagery, especially on large theater screens.
-
4K Scope (4096x1716):
- Aspect Ratio: ~2.39:1
- When to use it: Use this resolution for widescreen 4K content, often seen in high-budget cinema productions. It provides a stunningly immersive experience for projects with wide cinematic framing.
-
2K Full Frame (2048x1080):
- Aspect Ratio: ~1.90:1
- When to use it: This resolution is a full-frame version of 2K, suitable for content where you want to fill the entire screen without cropping or adding too much padding. It can be used when the source aspect ratio is close to 1.90:1.
-
4K Full Frame (4096x2160):
- Aspect Ratio: ~1.90:1
- When to use it: Like 2K Full Frame but at 4K resolution, this is ideal for high-quality content that fills the screen and is shot in a near full-frame format.
Since our source material is in 1080p, we generally stick to 2K flat (1998x1080) to maintain the original quality without introducing unnecessary scaling.
The idea is to process the video first then the audio. Then merge the two files together into an MP4 file.
bashffmpeg -i video.mp4 -vf "scale=-1:1080,pad=1998:1080:(ow-iw)/2:(oh-ih)/2,fps=24" -an -c:v libx264 -pix_fmt yuv420p -preset slow -crf 18 video_2K_Flat_24fps_video_only.mp4
Here above is example FFmpeg command to convert a video to 2K flat resolution. The command scales the video to 1998x1080, adds padding if necessary to maintain the aspect ratio, and sets the frame rate to 24 fps. The -an
flag removes the audio stream, ensuring that only the video is processed. This script automatically adds padding based on the aspect ratio of the original video, ensuring a smooth conversion to 2K flat resolution.
for testing purposes you can constrain the number of seconds to process by adding -t 10
to the command. This will process the first ten seconds of the video.
bashffmpeg -i video.mp4 -vf "scale=-1:1080,pad=1998:1080:(ow-iw)/2:(oh-ih)/2,fps=24" -an -c:v libx264 -pix_fmt yuv420p -preset slow -crf 18 -t 10 video_2K_Flat_24fps_video_only.mp4
One of our videos had a resolution of 3840 × 2160. The padding didnt work as expected. We had to manually add padding to the video. Below is the command we used to add padding to the video.
bashffmpeg -i 3840X2160_video.mp4 -vf "scale=1998:1080:force_original_aspect_ratio=increase,crop=1998:1080" -an -c:v libx264 -pix_fmt yuv420p -preset slow -crf 18 3840X2160_video_2K_Flat_24fps_video_only.mp4
Batch Processing Multiple Files
Since we had many files to deal with we used a script to process multiple files. Below is the batch script that contains our ffmpeg command.
bash#!/bin/bash
# Input directory containing videos
input_directory="/path/to/input_videos"
# Output directory for converted videos (video-only)
output_directory="/path/to/output_videos"
# Create output directory if it doesn't exist
mkdir -p "$output_directory"
# Loop through all video files in the input directory
for file in "$input_directory"/*.mp4 "$input_directory"/*.mov; do
# Extract the filename from the input file
filename=$(basename "$file")
# Define the output file path
output_file="$output_directory/converted_${filename%.*}_video_only.mp4"
# Use ffprobe to check the resolution and aspect ratio of the video
resolution=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 "$file")
width=$(echo $resolution | cut -d',' -f1)
height=$(echo $resolution | cut -d',' -f2)
# Calculate aspect ratio
aspect_ratio=$(echo "$width / $height" | bc -l)
# Target aspect ratio for 2K flat (1998x1080) ~1.85:1
target_aspect_ratio=$(echo "1998 / 1080" | bc -l)
# ffmpeg command to process the video (video only) with padding based on its aspect ratio
if (( $(echo "$aspect_ratio > $target_aspect_ratio" | bc -l) )); then
# If the video is wider than 1.85:1 (needs vertical padding)
ffmpeg -i "$file" \
-vf "scale=1998:-1,pad=1998:1080:(ow-iw)/2:(oh-ih)/2,fps=24" \
-r 24 \
-an -c:v libx264 -crf 18 -preset fast "$output_file"
else
# If the video is narrower than 1.85:1 (needs horizontal padding)
ffmpeg -i "$file" \
-vf "scale=-1:1080,pad=1998:1080:(ow-iw)/2:(oh-ih)/2,fps=24" \
-r 24 \
-an -c:v libx264 -crf 18 -preset fast "$output_file"
fi
# Output progress to the console
echo "Converted $filename to 2K flat (video only) with padding and conformed to 24 fps"
done
Step 2: Converting Stereo Audio to Dolby Digital 5.1 Surround Sound
With the visual format taken care of, the next step is transforming the audio. While standard MP4s typically come with stereo sound (2 channels), a cinema setting demands more immersive audio. That’s where Dolby Digital 5.1 comes in, offering 6 audio channels (front left, front right, center, subwoofer, surround left, and surround right).
We use the following FFmpeg command to convert the stereo mix into 5.1 surround sound:
bashffmpeg -i video.mp4 -filter_complex \
"[0:a]volume=0.5,pan=5.1|c0=FL|c1=FR|c2=0.4*FL+0.4*FR|c3=0.8*FL+0.8*FR|c4=FL|c5=FR" \
-ac 6 -ar 48000 -b:a 640k _audio_5.1_surround.ac3
This command creates 6 channels by mapping the stereo audio to surround sound, ensuring that the audience experiences audio from multiple directions, enhancing the cinematic feel.
A helpful utility to check the audio channels are ffprobe
. Below is an example of how to use ffprobe
to check the audio channels of a video file.
bashffprobe -v error -select_streams a:0 -show_entries stream=channels -of default=noprint_wrappers=1:nokey=1 video.mp4
The output will show the number of audio channels in the video file. In this case, we are looking for 6 channels (5.1 surround sound).
bash6
I also used the following command to split the audio channels into separate WAV files for testing purposes. I can bring these files into an audio editing software to verify the audio channels.
bashffmpeg -i video-surround-final-ac3.mp4 -filter_complex \
"[0:a]channelsplit=channel_layout=5.1[left][right][center][lfe][left_surround][right_surround]" \
-map "[left]" left.wav \
-map "[right]" right.wav \
-map "[center]" center.wav \
-map "[lfe]" lfe.wav \
-map "[left_surround]" left_surround.wav \
-map "[right_surround]" right_surround.wav
Step 3: Merging the Video and Audio Files
Now that we have the video converted to 2K flat resolution and the audio transformed into Dolby Digital 5.1 surround sound, the next step is to merge the two files into a single MP4 file. We use FFmpeg to combine the video and audio streams:
bashffmpeg -i video_2K_Flat_24fps_video_only.mp4 -i video_audio_5.1_surround.ac3 -c:v copy -c:a copy video_2K_Flat_24fps_5.1_surround.mp4
Step 4: Packaging the Video and Audio as a DCP
After converting the video to a DCP-compatible resolution and upscaling the audio to 5.1 surround sound, the final step is packaging everything into a Digital Cinema Package (DCP). We use DCP-O-Matic, a user-friendly tool for converting videos into the DCP format, to handle this step.
Here’s how to package the final video and audio files:
- Open DCP-O-Matic: Start the DCP-O-Matic application.
- Add the Video File: Import the MP4 file that has been converted to 2K flat and 5.1 surround sound.
- Configure Settings: Ensure that the settings match the desired output (e.g., 2K resolution, 24 fps, surround sound).
- Generate the DCP: Once configured, DCP-O-Matic will process the files and package them into a DCP format, ready for cinema projection.
Conclusion
Preparing content for cinema involves careful conversion of both video and audio formats to meet DCP standards. By converting our 1080p stereo MP4s to a 2K flat resolution and transforming the audio into Dolby Digital 5.1 surround, we create a polished, theater-ready product. DCP-O-Matic simplifies the final packaging process, making it easy to deliver high-quality content to cinemas worldwide.
Whether you're working with 1080p, widescreen content, or full-frame 4K material, choosing the correct resolution and audio setup is essential for ensuring a seamless cinema experience.
Tips:
The expected delivery format for a DCP (Digital Cinema Package) is typically a portable hard drive formatted in the following way:
Drive Format for DCP Delivery:
-
File System: EXT2 or EXT3 (Linux file systems) are the most commonly accepted formats. This ensures compatibility with the digital cinema servers (media block) used in most theaters.
- Some cinemas also accept EXT4 or NTFS, but EXT2/EXT3 is the safest option and is part of the DCI standard.
-
Drive Type:
- SATA external hard drives are preferred (typically 2.5" or 3.5" drives).
- USB 3.0 drives are widely accepted, and some cinemas can handle eSATA or FireWire if necessary.
-
Partition Scheme: The drive should use Master Boot Record (MBR) for broader compatibility with servers.
-
Drive Size: Ensure that the drive size is sufficient for the DCP, which can range from several GB to hundreds of GB, depending on the film length and quality (e.g., 2K vs. 4K).
-
Delivery: DCPs are often delivered in a pelican case or similar protective casing to safeguard the drive during transportation.
By following these guidelines, you ensure your DCP is compatible with most digital cinema servers worldwide.