VPSWeb Development

How to Install Movie Thumbnailer (mtn) on Ubuntu 14.04 Server

MTN is a command-line tool to create preview thumbnails of a video file. It’s a freeware software which is available for both Windows and Linux. I’ll be installing it on a Ubuntu 14.04 server in this tutorial.

A few days ago, I’ve posted a tutorial to set up desktop on Ubuntu 14.04 droplet from DigitalOcean. I wanted to create thumbnails of videos I download to this droplet just to see if they are in good quality before I finally download to my PC. I download lot of movies every month and can’t afford download same move twice due to my limited bandwidth. I search Ubuntu Software center but couldn’t find a quality piece of software to install. But I always knew Movie Thumbnailer (mtn) as a great tool for creating thumbnails. But it’s not available from Ubuntu Software center. So I had to install through command-line. I though I’ll post it here to help anyone in need and for future reference.

Prepare the Server

According to official mtn documentation,

mtn is developed by tuit (tuitfun); though most of its magic is done by FFmpeg libraries

You’ll need FFmpeg libraries on your server for mtn to work. Ubuntu 14.04 does to come with FFmpeg and it’s not on the official repos either. So we’ll add a repo that has FFmpeg libraries to the server.

Ubuntu 15.04 now ships with FFmpeg libraries. You can skip this step if you’re on Ubuntu 15.04. PS – This tutorial might also work on Ubuntu 15.04. But I’m not going to test it. Not anytime soon.
add-apt-repository ppa:samrog131/ppa

Update apt cache,

apt-get update

Install FFmpeg libraries,

apt-get install ffmpeg-set-alternatives

The PPA also contains other packages that we don’t want. Remove the ppa after installation,

add-apt-repository --remove ppa:samrog131/ppa
apt-get update

Install MTN

First you need to download it to the server. It’s hosted on sourceforge.net. I hate sourceforge, so I’ve hosted it on my server. Following command will download mtn package to your server,

wget https://vpsfix.com/files/mtn-200808a-linux.tgz

Extract it,

tar xvzf mtn-200808a-linux.tgz

Copy files to system folder,

cp mtn-200808a-linux/mtn /usr/local/bin/

Install fonts,

apt-get install fonts-liberation

MTN is now installed on your server.

Usage

You can now use MTN to create thumbnails. I use following command to create my thumbnails,

mtn -w 1024 -c 4 -r 10 -f /usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf /path/to/file.mp4*

This command creates an image with minimun width of 1024p, 4 maximum columns and 10 rows. You can customize the command as needed. Following options can be used.

-a aspect_ratio : override input file's display aspect ratio
-b 0.80 : skip if % blank is higher; 0:skip all 1:skip really blank >1:off
-B 0.0 : omit this seconds from the beginning
-c 3 : # of column
-C -1 : cut movie and thumbnails not more than the specified seconds; <=0:off -D 12 : edge detection; 0:off >0:on; higher detects more; try -D4 -D6 or -D8
-E 0.0 : omit this seconds at the end
-f tahomabd.ttf : font file; use absolute path if not in usual places
-F RRGGBB:size[:font:RRGGBB:RRGGBB:size] : font format [time is optional] info_color:info_size[:time_font:time_color:time_shadow:time_size] -g 0 : gap between each shot
-h 150 : minimum height of each shot; will reduce # of column to fit
-i : info text off
-I : save individual shots too
-j 90 : jpeg quality
-k RRGGBB : background color (in hex)
-L info_location[:time_location] : location of text
1=lower left, 2=lower right, 3=upper right, 4=upper left
-n : run at normal priority
-N info_suffix : save info text to a file with suffix
-o _s.jpg : output suffix
-O directory : save output files in the specified directory
-p : pause before exiting; default on in win32
-P : don't pause before exiting; override -p
-r 0 : # of rows; >0:override -s
-s 120 : time step between each shot
-t : time stamp off
-T text : add text above output image
-v : verbose mode (debug)
-w 1024 : width of output image; 0:column * movie width
-W : don't overwrite existing files, i.e. update mode
-z : always use seek mode
-Z : always use non-seek mode -- slower but more accurate timing

Tags

Tharindu

Hey!! I'm Tharindu. I'm from Sri Lanka. I'm a part time freelancer and this is my blog where I write about everything I think might be useful to readers. If you read a tutorial here and want to hire me, contact me here.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Close