How to Install FFmpeg and Analyze a Video

Installing FFmpeg is simple now, thanks to chocolatey.org. This video goes through the process of installation and then shows how to get frame timing and other information using a batch file, which can be downloaded here.


A rough transcript of the video can be found below.

(00:07):

All right. In this video we are going to go through the process of installing FFmpeg, which has become infinitely easier now with the introduction of Chocolatey. And then we're going to go through the process of extracting some really useful information from a video.

(00:23):

So the first step is going to be to go to chocolatey.org/install. And once you're there, if you scroll down a little bit, under step 2 you'll see "Install Chocolatey For Individual Use". And here there's some code. If you click this little button here, you will copy that code. Now we're going to go into PowerShell. So in the start menu just type in "PowerShell" and then right click to run as an administrator, which you'll need to do. Now with that code copied, if you just hit Ctrl+V, it'll set it there, and if you hit enter it'll start the installation process. So that will take just a couple seconds, probably 30 seconds or so. And once it's done, if you just type in "choco" then you should get a response like this, and that will help you to determine whether or not that installed properly.

(01:19):

So now we are going to install FFmpeg via Chocolatey. So here we're just going to type in "choco", then "install ffmpeg", and we are going to install the full version. And that is all that is necessary. At this point we're going to hit enter and it'll run through the process. So here we are going to type "A" to accept all and that will finish up. So now we are good. If we type in "ffmpeg", we should get a response that looks like this, that indicates that FFmpeg is now installed on this machine.

(01:58):

So now the next step is going to be to use this program to analyze a video. So I have a folder here, ffmpeg, and within it I have a text file and then I have a dashcam video from a Tesla. So we're going to open up this text file just to take a peek at what's inside of it. Ultimately we're going to turn this into a batch file so that we can use it to run the analysis. But in here you can see that it's referencing the install location of ffmpeg, ffplay, ffprobe. And then there's some code down here that's asking ffprobe to analyze the video and spit out a bunch of very useful information into a CSV. The only thing, if you installed FFmpeg like we just did, then these addresses should work just fine. However, if you installed using a different methodology, you'll just have to figure out where you have it installed and replace these addresses with that installation address. And one way that you can do that, if you go into the command prompt, right click, run as administrator, and then just type in "where ffmpeg". So here you can see that this is where it's installed.

(03:12):

So now we're good with that. We are going to turn this into a BAT file and that will make it a functional file. So turn the .txt into .bat, and then hit enter and accept that. So again, this is a dashcam from a Tesla. We're going to just drag that and drop it into here. You'll see ffplay will be playing the video. This is stationary for a second here, but you can see now it's working, and I'm going to close out of this and then it will finish the process. So now we see here we have debug.txt that talks about the process a bit. And then we are going to get what we're really after, which is the CSV file.

(03:57):

So this is what you're going to get in the CSV file. You're going to get the media type, whether or not it's a key frame, the packet duration, you're going to get the best effort timestamp, the width and height of the image or the frame, whether or not it's a intra-frame or predicted. There's other types available as well. Very useful information, especially for us in the forensic world when we're trying to determine frame timing for video analysis of any sort, especially like vehicle speed determination.

(04:32):

So if you want more information on what each one of these columns means, you can head to ffmpeg.org and go to the documentation section. Here's the web address for that. And in here you can just search for any one of those column titles and there will be a description of what that is giving you. So hopefully you found that helpful and you can implement that in your analysis.