About
This repository contains a set of Bash shell scripts driving ffmpeg
, ffprobe
, mediainfo
, and atomicparsley
to convert files of any type supported by these programs into H.264 *.mp4 files suitable for playing on an iPad Air 2 class device.
Usage
Simply pass the main ipad-h264
script any number of video files. It will do its best to transform them into a format suitable for playback on your device of choice without re-encoding anything it doesn't need to re-encode. If the video is already in the correct format but the audio is wrong, it will copy the video over but transcode the audio. If both streams are correct but the container format is wrong (e.g. H.264 + AAC in QuickTime MOV) it will copy both streams into an ISO MP4 container.
The scripts do not yet handle the case of correct audio but incorrect video, simply because I have yet to encounter such a case myself. In that case, it will transcode both the audio and the video. If you needed to solve it, adding a suitable remux-mp4-h264
script would be straightforward given the pattern already established.
The remux-*
scripts can be run for their own sake, but they are primarily intended as helpers for the main ipad-h264
script.
Adapting the Scripts to Your Particular Purposes
The name of the project merely reflects my personal use case. The scripts are readily adapted to other device types by adjusting the ffmpeg
commands.
Here are the areas you are most likely to need to pay attention to in adapting the software:
The scripts contain some macOSisms, so the scripts will need some adjustment for use on Linux, or for use on Windows under Cygwin, MSYS, or WSL:
The
rmtrash
program acts likerm
except that the files are moved to the user's Trash folder. Many similar tools exist for other systems, or you could just replace this line inipad-h264
with anrm
call or some other "move out of the way" type of command.The
open
call is a macOS mechanism for opening a file using the GUI program associated with it. I have*.mp4
files associated with Subler here because the next step after remuxing or transcoding is to look at the tags, apply cover art, etc. Under Cygwin, you can get the same effect withcygstart
. I assume there is a way to get a similar effect on Linux. Alternately, you could just hard-code the next step in place of myopen
command.
Downloads
You can download the current state of the code repository directly:
Zip file: ipad-h264-trunk.zip
Tarball: ipad-h264-trunk.tar.gz
Repository Access
You can also clone this repository using Fossil, a distributed version control system that works like a simple, self-contained, GitHub-in-a-box.
See the Fossil Quick Start Guide for more information.