Category: Ubuntu

Added: 24th of May 2018

Viewed: 2580 times

Convert .mkv video to .png images using ffmpeg

This tutorial works in Ubunbu, Kubuntu, Xubuntu, Lubuntu, Ubuntu Mate and other Ubuntu based distributions. The tutorial also works in Linux Mint and other Debian based distributions.



One of my passions is playing old retro computer games, these can be found over at my other site Retro Gas

Whenever I add a new game, I always try to provide a small video and screenshots of the game for users visiting the site.

As you can imagine, getting just one game listed on the site is quite a task. When I first started adding games to my site, I needed a way to grab screenshots from the video I recorded.

After much searching and lots of trial and error, I found a software package for Linux called ffmpeg.
ffmpeg is cross platform solution to record, convert and stream audio and video. You can visit the main ffmpeg site here

As I use an Ubuntu based distribution, I first needed to install the package.
To install ffmpeg enter the following command in the terminal

sudo apt-get install ffmpeg


After this I created a new folder on my desktop and dragged my .mkv video file in to it. The reason for this, is that I wanted all .png files in one folder and not scattered across the desktop. If your outputting 1 frame per second that is a lot of images.

The next step was to CD to the directory that contains the .mkv file
cd /home/username/Desktop/video_file


Then run the following command to output the .png images
ffmpeg -i filename.mkv -vf fps=1 filename_%d.png


The command above outputs one .png file from the .mkv file every second.
Each .png created also follows a numerical sequence because of %d in the command, example filename_1.png, filename_2.png, filename_3.png and so on......

Remember to replace filename with your own file names.

Other Tips & Tutorials

Ubuntu

Create a really simple banner using GIMP (GNU Image Manipulation Program) in Linux

Posted: 7th of August 2020

Views: 149

Ubuntu

Install the tree package to list folders and files in a tree like format inside the terminal on Linux

Posted: 22nd of July 2020

Views: 148

Ubuntu

Ubuntu 4.10, Warty Warthog. The first Ubuntu Linux Distribution

Posted: 6th of October 2019

Views: 939

Ubuntu

Sim City 4 Deluxe Edition Install Wine Linux. Trouble installing from CD/Disk 2

Posted: 19th of May 2019

Views: 1210

Ubuntu

Where are the fonts located in Ubuntu and other Ubuntu based distributions

Posted: 3rd of June 2018

Views: 1326

Ubuntu

Install MariaDB Database in Ubuntu and other Ubuntu based distributions (Part 1)

Posted: 26th of May 2018

Views: 1258

Ubuntu

Convert .mkv video to .png images using ffmpeg

Posted: 24th of May 2018

Views: 2580

Ubuntu

Shutdown Ubuntu using the terminal

Posted: 20th of May 2018

Views: 1130

Ubuntu

Running Sketchup 8 in Wine. Sketchup was unable to initialize OpenGL, Linux

Posted: 29th of May 2016

Views: 3550

Ubuntu

How do I install a .deb package using the terminal

Posted: 17th of April 2016

Views: 1949