Skip to content

A Python script that auto tags and adds poster to mkv or mp4 movie files.

License

Notifications You must be signed in to change notification settings

prithugoswami/auto-movie-tagger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 

Repository files navigation

Auto Movie Tagger

A Python script that auto tags and adds poster to MKV or MP4 movie files.
Also adds subtitles if provided.

The metadata it adds:

  • Genre - Movie's genres
  • Year - The release year of the movie
  • Comment - IMDb Rating and the movie's plot-outline.

first

Requirements

  • python 3.x
  • ffmpeg - A cli-tool that can encode/decode media files
  • imdbpie - A Python module for IMDb
  • tmdbsimple - A Python module which is a wrapper for The Movie Database API v3
  • mutagen - Python module to handle media files' metadata

Note for installing python 3 dependencies

This script is compatible for python3 only. If you are on Ubuntu or any other distro/OS with python2.x and python3.x both installed, make sure you use 'pip3' command to install the python modules. On Ubuntu/Debian-based distros you can run:

sudo apt-get install pip3
and then install the dependencies:
pip3 install <module>

Installing ffmpeg

You can download ffmpeg for your platform from here. Most of the linux distributions come with it ffmpeg pre-installed, or you can always look for the package in your distro's package repository.
Compilation Guide for ffmpeg
Here's a wikiHow article on how to install ffmpeg on Windows

Installing Python module dependencies

pip install imdbpie tmdbsimple mutagen

How to use

  1. Move all the movie files you want to be tagged into one folder. Make sure that the filename is the correct title of the movie. Year of the title can also be included.
  2. If you want subtitles to be embedded into the movie file(s) then add a subtitle file (.srt only) in the same folder named exactly the same as the movie file(s).
  3. Download the script (amt.py) and run it in that directory and sit back and relax till it ends executing. How to run the script in that directory? Copy the script in the directory and run it using the command:
    python amt.py
    Ubuntu users with python2.x and python3.x both installed, make sure the depedences are installed using pip3 install <module> and then run the script using:
    python3 amt.py

Notes

  • This script only works for mp4 and mkv file types.
  • The final file is always a MP4 file.
  • Make sure if you are having a MKV file, it should not contain picture based subtitles (hdmv-pgs/vobsub,etc) as MP4 files do not support picture based subtitles. You can use MKVToolNix or any other similar GUI utility to quickly remove the picture based subtitles or you can use ffmpeg to this as well. If the file already has an SRT subtitle then the script will just copy it.
  • If you would like to use your own poster image then add an image file (jpg only) in the same folder and rename it to the same name as the movie file.
  • Although I have provided my own TMDb API key in the source, I would recommend you get you own from here
  • Tip - When you sort your tagged movies according to the comment they get sorted by ascending/descending order of their IMDb rating.

Tooltips for Windows Users

tooltip

To make the tooltip show the movie's genre and IMDb rating and plot-outline like in the screenshot, you will have to make some changes in the registry of your windows machine.

  1. Fire up your Registry Editor. Open the Run window (Win + R) and type "regedit"
  2. Head over to HKEY_CLASSES_ROOT\SystemFileAssociations\.mp4
  3. From the left panel right click on the "InfoTip" value name and click "Modify..."
  4. Under the "Value Data" field add the attributes, "System.Music.Genre" and "System.Comment" anywhere you like depending how you would like the metadata to show in the tool tip. The "Value Data" filed consists of different attributes that appear in the tooltip. For example "System.Media.Duration" is the Duration of the media. These attributes are separated by ";" (semicolon). I would recommend adding the Genre and Comment attributes after "System.Media.Duration".

About

A Python script that auto tags and adds poster to mkv or mp4 movie files.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages