Category: Ubuntu

Added: 24th of May 2018

Viewed: 3139 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

Install Redshift to automatically adjust the colour of your screen depending on time of day on Ubuntu and Ubuntu based distributions

Posted: 26th of November 2020

Views: 164

Ubuntu

PulseAudio, Pavucontrol not saving settings after reboot on Ubuntu and Ubuntu based distributions

Posted: 11th of November 2020

Views: 452

Ubuntu

No sound after installation of Ubuntu or Ubuntu based distribution, install pavucontrol

Posted: 9th of November 2020

Views: 143

Ubuntu

Shutdown Ubuntu and Ubuntu based distributions at a specific time or within (x) minutes

Posted: 30th of October 2020

Views: 157

Ubuntu

Open and edit files using Visual Studio Code from FIlezilla FTP Client on Linux

Posted: 27th of October 2020

Views: 300

Ubuntu

Download Microsoft Edge preview version for Ubuntu and Ubuntu based distributions

Posted: 22nd of October 2020

Views: 210

Ubuntu

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

Posted: 7th of August 2020

Views: 320

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: 303

Ubuntu

Ubuntu 4.10, Warty Warthog. The first Ubuntu Linux Distribution

Posted: 6th of October 2019

Views: 1244

Ubuntu

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

Posted: 19th of May 2019

Views: 1430