From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert MPEG to multiple JPEGs

Solved!
Go to solution

Hello everyone,

 

I have been working on a project in which I have to analyze individual frames in jpeg format.  The problem is that I am given these frames in an mpeg clip of approximately 30 seconds.  I was wondering if anyone knows a way, or has any suggestions as to how I could extract the individual frames from the mpeg file and save all of them using the jpeg format.

 

Thanks in advance,

Justin

Message 1 of 6
(4,598 Views)

Don't know if the Vision Module software can do that, but I'd guess your best option is just to Google for a tool to do this.

0 Kudos
Message 2 of 6
(4,580 Views)

Maybe you can try to use VLC with command line option ("System Exec.vi" with LabVIEW).

In this way you can extract a JPG file for every frame. After this you can analyze these single JPG frame.

 

Regards

Golziante

0 Kudos
Message 3 of 6
(4,572 Views)
Solution
Accepted by topic author jutayo23

Hi,

 

There are two possible ways to do this.

 

First way - just "stand alone" solution (without LabVIEW) as mentioned above. You can use ffmpeg  for conversion, something like that:

 

ffmpeg -i TEST.MP4 -r 1 -s 1280x720 -f image2 foo-%03d.jpeg

 

Another way - If you want to do this in LabVIEW, then first you have to convert your MPEG video to RAW video (as far as I remember, NI VIsion AVI functions have troubles with MPEG files, at least with my files).

You can convert your video with mencoder something like that:

 

mencoder TEST.MP4 -ovc raw -oac copy  -vf format=yv12 -o out.avi

 

Then you should be able to read this video with AVI functions with VDM (these functions have troubles with large HD videos) or ADV into IMAQ Image and saving images in JPEG format.

 

Best regards,

 

Andrey.

 

Message 4 of 6
(4,539 Views)

Thank you for your help everyone.

 

The solution I decided to go with was to convert the mpeg file to an avi using command line, then access the files through labview and separate the individual frames to analyze.

 

Thanks again,

Justin Yost

0 Kudos
Message 5 of 6
(4,494 Views)

Hi Justin, hope you're still out there six years later.

What did you actually use to convert the files using the command line, mencoder?

Thanks,

BG

0 Kudos
Message 6 of 6
(3,230 Views)