conv2mp4-py

Python 2.7 script that recursively searches through a defined file path and converts MKV, AVI, FLV, and MPEG files to MP4 using handbrake (with AAC audio). It then refreshes a Plex library, and deletes the source file upon success and moves the new files into the defines directory (Plex Library directories for example). Fails over to ffmpeg encode if conversion failure is detected. The purpose of this script is to reduce the number of transcodes performed by a Plex server, by processing all files into an MP4 format.

Designer Templates

Dependencies This script requires Python, Filebot, ffmpeg and Handbrake to be installed on your computer. You can download them from here:

Python
FileBot
ffmpeg
Handbrake

Authors and Contributors

@KameeCoding

Support or Contact

Having trouble with the script? Check out the Readme, F.A.Q. or email me at

F.A.Q.

How do I launch the script
The script takes exactly one launch parameter, the directory where the files are located. For me it's 'F:\Temp'

What does foreign language mean in readme?
In this case I call foreign language every language that is not English. (Even though English is foreign for me)

Options are confusing how can I get my files placed here and there?

Say for example you have a folder with all you media files:
'F:\Temp' You launch the Script with this parameter.


You want to keep the files where they are, you just want to convert them:


You want to move files to your Plex Libraries and you have on TV Show and one Movies Library


You want to move your TV Shows to your Plex Libraries and also create a separate folder for each TV Show

If you have all the Seasons of How I met your mother it will move your files to [Plex TVSHOW Library]\How I Met Your Mother\SeasonXXEpisodeXX.mp4


You want to move your Movie files to your Plex Libraries and also create a separate folder for each Movie file.

If you have the Pacific Rim movie this will move it to [Plex Movie Library]\Pacific Rim\Pacific Rim.mp4 (Note that the script merely cut's of the file extension of the file to create a directory so if your file is named pacific_rim_2013.mp4 the folder will be called pacific_rim_2013)


You have separate libraries for Tv Shows and Movies in your own and english language and you want the script to put the files where they belong


Same as previous but you want to have files with multiple audio stream in both your english and your own language libraries.