Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save robby-robby/375ed032f3ec338452a40fd0ddf4283c to your computer and use it in GitHub Desktop.
Save robby-robby/375ed032f3ec338452a40fd0ddf4283c to your computer and use it in GitHub Desktop.

Troubleshooting playback of .mov files from quicktime on iphone

2024-03-07 01:43:24

User

why cant i play .mov files from macos quicktime in iphone?

Assistant

If you're having trouble playing .MOV files from macOS QuickTime on your iPhone, it could be due to several reasons. Here are some common issues and suggestions for resolving them:

  1. Unsupported Codec: The most common reason is that the .MOV file might use a codec that is not supported by the iPhone. While .MOV is a container format that can hold various types of video and audio codecs, not all of them are compatible with iOS devices. For example, if the .MOV file uses a codec like Apple ProRes, it might not play on your iPhone because iOS devices generally support H.264 (in .mp4, .mov, and .m4v formats).

  2. File Corruption: The .MOV file could be corrupted or partially downloaded, making it unplayable on any device, including your iPhone.

  3. Software Issue: There could be a temporary glitch in the iOS software or the QuickTime Player on macOS that prevents the file from being transferred or recognized properly.

  4. Transfer Method: If you're transferring the file via a method that doesn't preserve the file integrity (like sending it through a messaging app that compresses media files), the file might not play correctly on your iPhone.

Solutions:

  • Convert the File: Use a video converter tool to convert the .MOV file to an iPhone-compatible format like H.264 .MP4. You can use macOS's built-in QuickTime Player, iMovie, or third-party software like HandBrake for this purpose.

  • Check for Corruption: Try playing the file on another device or computer to see if it works. If it doesn't, the file might be corrupted.

  • Update Software: Ensure your iPhone and macOS are running the latest software versions. Sometimes, compatibility issues are resolved in software updates.

  • Transfer Properly: Use AirDrop, iCloud Drive, or a direct cable connection to transfer the file from your Mac to your iPhone to ensure the file doesn't get compressed or corrupted.

  • Use Alternative Apps: If you're still unable to play the file, consider using a third-party video player app on your iPhone that supports a wider range of codecs and formats than the native Videos app.

Following these steps should help you resolve the issue with playing .MOV files from macOS QuickTime on your iPhone.

User

Can i use ffmpeg to make it compatible for iphone?

Assistant

Yes, you can use FFmpeg to convert .MOV files to a format that is compatible with iPhone. FFmpeg is a powerful, open-source command-line tool capable of converting multimedia files between different formats. To make a .MOV file compatible with iPhone, you would typically convert it to an H.264 encoded MP4 file, which is widely supported across all iOS devices.

Here is a basic example of how to use FFmpeg to convert a .MOV file to an iPhone-compatible format:

ffmpeg -i input.mov -vcodec h264 -acodec aac output.mp4

This command tells FFmpeg to take input.mov as the input file, use h264 as the video codec, aac as the audio codec, and save the output as output.mp4.

Additional Options

You might want to customize the conversion process to better suit your needs or to optimize the video for your specific iPhone model. Here are a few additional options:

  • Specifying Resolution: To specify the resolution of the output video, which can be useful if you want to reduce the file size or ensure compatibility with the screen resolution of your iPhone, you can use the -s option followed by the desired resolution (e.g., -s 1920x1080 for 1080p).

  • Adjusting Quality: You can adjust the quality of the output video by changing the bitrate (using the -b:v option for video bitrate and -b:a for audio bitrate) or by using the Constant Rate Factor (CRF) method (using the -crf option, where lower values mean better quality and the range is 0–51). For example, -crf 23 is the default, and -crf 18 would be a higher quality.

  • Optimizing for Streaming: If you want to ensure that the MP4 file is optimized for fast streaming (especially useful if you're hosting the video online), you can add the -movflags +faststart option. This moves some of the metadata to the beginning of the file, allowing playback to start before the file is completely downloaded.

Here's an example command that incorporates these options:

ffmpeg -i input.mov -vcodec h264 -crf 23 -acodec aac -b:a 128k -s 1920x1080 -movflags +faststart output.mp4

This command converts input.mov to an H.264/AAC encoded MP4 file with 1080p resolution, a good balance of quality and file size for the video, a 128 kbps bitrate for the audio, and is optimized for fast streaming.

Remember, the best settings will depend on your specific needs, such as the desired balance between quality and file size, and the capabilities of the iPhone model you're using. You may need to experiment with different settings to find what works best for you.

User

Lets make a siri quick action shortcut for this, using either automator or whatever makes it easier, i should be able to right click a .mov file and convert it this way

Assistant

Creating a Quick Action with Automator on macOS to convert .MOV files to an iPhone-compatible format using FFmpeg is a practical way to streamline your workflow. This guide assumes you have FFmpeg installed on your Mac. If not, you can easily install it using Homebrew with the command brew install ffmpeg in the Terminal.

Step 1: Open Automator and Create a New Document

  1. Open Automator (you can find it using Spotlight search by pressing Cmd + Space and typing "Automator").
  2. Choose New Document.
  3. Select Quick Action as the type of your document and click Choose.

Step 2: Configure the Quick Action

  1. At the top of the right pane, for "Workflow receives current," choose files or folders.
  2. For "in," select Finder.
  3. You can optionally choose to add an image for your Quick Action and give it a name like "Convert to iPhone Video."

Step 3: Add a Run Shell Script Action

  1. In the search field within the Actions panel on the left, type "shell" to find the Run Shell Script action.
  2. Drag the Run Shell Script action to the workflow on the right.
  3. In the Run Shell Script action, make sure to set "Pass input" to as arguments.
  4. In the script area, you'll input the command to convert the video. Here's an example script you can use:
for f in "$@"
do
    /usr/local/bin/ffmpeg -i "$f" -vcodec h264 -crf 23 -acodec aac -b:a 128k -s 1920x1080 -movflags +faststart "${f%.mov}-iPhone.mp4"
done

This script loops through all files you've selected (though you'll likely only be converting one at a time), uses FFmpeg to convert each to an iPhone-compatible format, and saves the new file in the same location with "-iPhone.mp4" appended to the original filename.

Note: Ensure the path to FFmpeg (/usr/local/bin/ffmpeg) matches where FFmpeg is installed on your system. You can check this by running which ffmpeg in the Terminal.

Step 4: Save Your Quick Action

  1. Go to File > Save.
  2. Name your Quick Action, such as "Convert to iPhone Video".

Using Your Quick Action

Right-click (or Control-click) on a .MOV file in Finder, go to Quick Actions, and select "Convert to iPhone Video". The script will run, converting the file to an iPhone-compatible format.

Additional Notes

  • The conversion process will happen in the background. You can check the progress by looking at the output file size in Finder or by monitoring the ffmpeg process in Activity Monitor.
  • If you frequently work with videos of different resolutions or have specific needs, consider modifying the FFmpeg command in the script to better suit your requirements.

This Quick Action provides a convenient way to convert videos directly from Finder without needing to open a Terminal or other applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment