This is a sample C# project that extracts Depth and Color information from videos shot in iPhone's Cinematic mode and outputs each as separate videos, along with a sample Unity project for 3D playback of these videos.
This sample consists of three projects:
- DepthExtractor:
A C# sample project for separating Depth and Color from videos shot in Cinematic mode. - DepthPlayer:
A Unity sample project to display Depth and Color videos in 3D. - DepthPlayer_LKG:
A Unity sample project to display Depth and Color videos in 3D using Looking Glass.
Refer to Apple Support.
Additionally, the iPhone 15 Series is compatible.
- Settings -> Camera -> Formats
- Choose "High Efficiency" under the Camera Capture section
- Settings -> Photos
- Select "Keep Originals" under the TRANSFER TO MAC OR PC section
- Connect the iPhone to your PC with a USB cable
- Using Explorer, locate the cinematic video you wish to use
- Copy it to any folder on your PC
Note: When shooting a video, filenames like IMG_0001.MOV and IMG_E0001.MOV might be generated. Make sure to select files without the "E", such as IMG_0001.MOV.
- Connect the iPhone to your Mac using a USB cable
- Launch the Photos app on your Mac
- Choose "iPhone" from the list on the left side of the window
- Select the video you wish to import and click the Import button
- Choose "Imports" from the list on the left side of the window
- From the menu bar at the top, select File -> Export
- Click on "Export Unmodified Original for 1 Video"
- Hit the Export button
- Save to your desired folder
- Launch the Photos app on your iPhone
- Select the cinematic video and tap the Share button
- Tap "Export Unmodified Original"
- Select a destination folder and tap the Save button
- Open the Files app
- Share the video saved in step 4 as you see fit, e.g., through Google Drive.
- Navigate to the DepthExtractor_Win folder
- Start DepthExtractor.exe from the Executable folder or run the project in the Project folder using Visual Studio
- Click the Open button and select a cinematic video
- Hit the Convert button and wait for "Done" to be displayed
color_output.webm
anddepth_output.webm
will be generated in the same directory as the video you selected in step 3.
Note: The depth video size is either 512x288 or 288x512, while the color video size is 512x512.
- Open the DepthPlayer or DepthPlayer_LKG project in Unity
- Place
color_output
anddepth_output
into any directory under the Assets folder
e.g., within the VideoFiles directory - Double-click on DepthPlayer inside the Scenes directory
- In the Hierarchy, select the [Main] object
- Drag & drop
color_output
onto "Color Video" in the Inspector - Drag & drop
depth_output
onto "Depth Video" in the Inspector - At the top of the UnityEditor, click the Play button
Note 1: To change the display size, position, or angle, please modify the Transform parameters of the [DepthMeshRoot] object.
Note 2: To adjust only the depth direction scale, you can modify the Depth Scale value (Default=1.5) of the [Main] object. Note 3: To change viewpoints, please use the Scene View. Viewpoint control within the Game View have not been implemented.
While this sample is under the MIT License, be aware of the following dependencies and their respective licenses:
- GPAC2.2 - License: [GNU Lesser General Public License, version 2.1]
- FFmpeg - License: [GNU Lesser General Public License, version 2.1]
- Looking Glass Unity PlugIn - License: [See here]
In the development of Depth Extractor, the trial and error results by Jan Kaiser proved to be invaluable.
You can see the details in this tweet.
Feel free to provide feedback on my project via social media. I appreciate your insights and comments.
Connect with me on X (Well know as Twitter) @Tks_Yoshinaga.