I have media files. I do some multimedia processing, and these scripts help me stay organized.
You can use these to write Automator-based services, for example.
- I only work with MP4 containers, so these are designed to work for that.
- I am assuming you're putting metadata into your media files with Subler or a similar tool.
- I have installed Bash 4 on my Mac, and some of these scripts may use Bash 4 features.
After you have added metadata using Subler (or similar), look inside the media file to find the title of the movie and its resolution, and rename the file.
Pattern: ${TITLE} (${RESOLUTION}).mp4
(e.g., Something in the Public Domain (480p).mp4)
After you have added metadata using Subler (or similar), look inside the media file to find the title of the episode, season number, episode number, and its resolution, and rename the file.
Pattern: ${SEASON}.${EPISODE} - ${TITLE} (${RESOLUTION}).mp4
(e.g., 1.01 - Pilot (1080p).mp4)
Many media files exist where the person who did the encoding used H.264 video and AC3 audio inside of an MKV container. These are non-standard formats that are popular among open-source players. Most devices (iPhone, iPad, Apple TV, Xbox, Playstation, and others) support the ISO-backed trinity of H.264 video and AAC audio inside an MP4 container.
This will look inside the file for an AAC stream.
-
If it finds one, cool. It'll just make sure that its wrapped in an MP4 container and move the
moov
atom to the front of the file. -
If not, it'll convert the audio to AAC — and also make sure that its wrapped in an MP4 container and move the
moov
atom to the front of the file.