My Computer Tips

Home | About | Categories | All Tips & Tutorials

Convert .mkv video to .png images using ffmpeg

ID: 92

Category: Ubuntu

Added: 24th of May 2018

Updated On: Tutorial updated and rechecked on 25th of November 2023

Views: 7,663


If you need a way to convert .mkv video to images install 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.