Applescript for renaming my video files

For certain TV Shows I like to save them in my “archive” for viewing later, so I try to label them in a logical fashion. With my current automated system of recording TV shows, removing commercials, and adding in meta data to the mp4 video file, I’ve created a new Applescript that will help rename the video file for my personal archive.

The script is a bit lengthy to post here in text form, so I’m making it available for download from this link. I’m basically using the freeware program called AtomicParsley to extract some meta data from a specified video file (e.g., show name, episode title, season number and episode number) and use that information for defining the file name. For example, my script will take the video recording of an episode from The Walking Dead and will format the name as:

The Walking Dead – Guts – S01E02.mp4

So it has the TV show’s name, episode title, season and episode number all contained in the name of the video file. Again, it is getting all this data from the metadata contained inside the video file (which was added by my recording script).

I’ve got my Applescript set up as an application icon which I can double-click to bring up File Chooser Dialog Window or you can drag video files onto the icon to process the files. This script makes it much easier for me to rename my videos quickly for storage.

Note, that I tried to do the renaming of these videos in this manner after I processed them in my video recording script, but iTunes renames the video file to only the show’s episode name (e.g., “Guts.m4v”) when it automatically processes the file for syncing.


9 Responses to Applescript for renaming my video files

  1. Grant says:

    When I try this I get “The file you selected is an invalid video file!”, even though it is an MP4. Do I have to install AtomicParsley? I could not find a Mac version.

    • zunetips says:

      Yes, you need atomicparsley installed. You also will need to edit this Applescript a bit to point to wherever you installed atomicparsley. There is a Mac version which you can download from here:

      • Grant says:

        Thanks! that did it. But the title turns out like this:

        “Friends – The First One – S01E475085”, even though it is episode 1.

      • zunetips says:

        Hmm… let me take a look at the script and see what’s up.

      • Grant says:

        I assume it has something to do with the Episode ID vs the Episode Number, because 475085 is the Episode ID in the metadata (in iTunes at least)

      • zunetips says:

        For episode number, the script is grabbing the “tves” metadata tag in the video file. Where did you get the video file you are trying to rename? I’m wondering what metadata tags it has and what they are set to. If you’re familar with using a terminal shell window on your Mac, you can use this to list all the metadata tags for a video file:

        atomicparsley videofile.mp4 -t

  2. Grant says:

    The script is grabbing the “tven” tag if I understand correctly. If I change this to “tven” I think it should work correctly.

  3. Kyle says:

    Is there any way to create a script to remove several atoms present in video files dropped onto the icon? I have it working through the CLI, but I’d like a way to just drop a folder or files onto a script and it edits all M4V files inside, or at least find a way to batch remove atoms using the CLI.

    • zunetips says:

      I’m pretty certain there is a way to drop a folder on a script icon and have the script process the contents. I believe I saw an action in Apple Automator to do this. So far as removing atoms from a video file, I’ve never done that before so I’m not sure. For most of my file video file processing I use AtomicParsley as the main workhorse app tied into my scripts, so I suggest you check the docs for AP and see if there is a way to remove atoms. If I remember correctly I think there is, but I’m not entirely positive. Question: Why are you wanting to remove atoms from the m4v files? Just curious…

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: