Category: Ubuntu

Added: 24th of May 2018

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

How do I upgrade a single package in Ubuntu and Ubuntu based distributions

Posted: 12th of September 2021

Views: 248

Ubuntu

Create a multiboot USB for your .iso images, using Ventoy on Linux

Posted: 25th of August 2021

Views: 340

Ubuntu

How to find out what date you installed Linux on your machine

Posted: 13th of April 2021

Views: 476

Ubuntu

Install bashtop in Ubuntu and Ubuntu based distributions. Monitor your cpu, memory, disks, network and other processes

Posted: 21st of February 2021

Views: 587

Ubuntu

Ubuntu 20.10 Groovy Gorilla installation error, installer crashed

Posted: 3rd of February 2021

Views: 972

Ubuntu

Find out what version of Ubuntu you are running, using the terminal

Posted: 29th of January 2021

Views: 483

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

Ubuntu

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

Posted: 11th of November 2020

Views: 3753

Ubuntu

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

Posted: 9th of November 2020

Views: 585

Ubuntu

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

Posted: 30th of October 2020

Views: 671