Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Playing back an AVI with stored data using Windows Media Player

I am creating avi's using vision 7 that has data stored in avi. I would like to create a playback application that will control the avi and display the data. I thought I might use the ActiveX MediaPlayer, it has all the functions to control the playback of the movie. However is it possible to get the frame data the was stored with the avi out using the mediaplay or does anybody have another idea so the data would be sync'd with the movie.

Terry S.
0 Kudos
Message 1 of 8
(4,610 Views)
Mediaplayer will not allow you to extract the saved data, so you will need to use the Vision Controls VIs that allow you to do so. I haven't tried using media player in LabVIEW before, but you should be able to implement the basic funcitionality (play, stop, seek, etc.) with LabVIEW.
0 Kudos
Message 2 of 8
(4,610 Views)
The problem I am have with using labview to view the avi is the long amount of time it takes to read each frame of the file, display the images and extract the data. Maybe I am doing something wrong, but I have created an avi that has 150 frames @ 640 x 480 with Divx compression (doesn't matter which codec I use)and it takes forever to loop through the file frame by frame. But if I view the file using media player it loads and plays quickly.
0 Kudos
Message 3 of 8
(4,610 Views)
Try to buffer the AVI in memory before playing it- this will eleviate the problem of reading from disk each iteration of the while loop.
0 Kudos
Message 4 of 8
(4,610 Views)
Thanks for your sample code, but that is pretty much what I have tried. In the first loop were the frames are being buffered, for the 150-frame avi clip it takes 30 seconds to complete. Now I forgot to mention before that I would be creating a final avi that will consist of 10 or more of these clips. The way this is currently being done, the buffering loop would take up to 5 minutes to complete, kind of long don't you think?

Another thing that I notice is during the buffering loop my processor CPU usage is maxed out? Now I have noticed this with a lot of the Vision and IMAQ stuff that have been written by NI. I have inquired about this from NI before but they do not seem to think it is an issue, am I the only person that thinks it is po
or programming to create something that uses all the CPU resources? Performing imaging functions should not be an excuse as there are many other programs written in other languages that do not seem to chock the computer.

This is not mean't to sound bitter, it just an observation. I think NI has a good product here for capturing still images but seems to need alot of work yet with AVI's. And the option of adding data to the avi is great but again needs improvement. One of the reasons I may have to abandon my idea is the fact that if I cannot get the data out with anything other than using vision functions, means for every avi I produce and want to supply to a customer I need to sell him a $475.00CAN Vision license?
0 Kudos
Message 5 of 8
(4,610 Views)
One thing to try is to use uncompressed or a different compression codec. The decompression is pretty CPU intensive, and if you have the disk space it would probably go faster to not compress the images.

Vision 7.0 and NI-IMAQ 2.6 are NI's first releases that directly support AVIs in the driver and Vision Software. It is a vast improvement over the way we used to recommend saving out a series of images (separate files), however, we know that there is still room for improvement.

I know R&D is aware of the CPU usage issues, you are not the first to comment on it. They are currently investigating ways to improve this without compromising overall performance for the vision algorithms.
0 Kudos
Message 6 of 8
(4,610 Views)
Dustin W wrote in message news:<506500000005000000CC300100-1066448259000@exchange.ni.com>...
> One thing to try is to use uncompressed or a different compression
> codec. The decompression is pretty CPU intensive, and if you have the
> disk space it would probably go faster to not compress the images.
>
> Vision 7.0 and NI-IMAQ 2.6 are NI's first releases that directly
> support AVIs in the driver and Vision Software. It is a vast
> improvement over the way we used to recommend saving out a series of
> images (separate files), however, we know that there is still room for
> improvement.
>
> I know R&D is aware of the CPU usage issues, you are not the first to
> comment on it. They are currently i
nvestigating ways to improve this
> without compromising overall performance for the vision algorithms.

try movie player activex that support many function media player activex have not!
http://www.viscomsoft.com/movieplayer.htm
0 Kudos
Message 7 of 8
(4,610 Views)
Hi,
If you save the avi file and data in two separate files, then you can
playback avi file , query the index of the current frame and then
getting the correponding data for that frame using this index for the
video and data synchronization. Media player or my free vi
(http://www.geocities.com/irene_he/FunStuff.html)can be used to
playback avi file. If you need more help, you can e-mail me at
irene_he@hytekautomation.com
This method works good for my data and video synchronization
applications.
Irene

Terry S wrote in message news:<5065000000050000008E300100-1066448259000@exchange.ni.com>...
> Thanks for your sample code, but that is pretty much what I have
> tried. In the first loop were the frames are being buffered, for the
> 150-frame avi clip it takes 30 seconds to complete. Now I forgot to
> mention before that I would be creating a final avi that will consist
> of 10 or more of these clips. The way this is currently being done,
> the buffering loop would take up to 5 minutes to complete, kind of
> long don't you think?
>
> Another thing that I notice is during the buffering loop my processor
> CPU usage is maxed out? Now I have noticed this with a lot of the
> Vision and IMAQ stuff that have been written by NI. I have inquired
> about this from NI before but they do not seem to think it is an
> issue, am I the only person that thinks it is poor programming to
> create something that uses all the CPU resources? Performing imaging
> functions should not be an excuse as there are many other programs
> written in other languages that do not seem to chock the computer.
>
> This is not mean't to sound bitter, it just an observation. I think
> NI has a good product here for capturing still images but seems to
> need alot of work yet with AVI's. And the option of adding data to
> the avi is great but again needs improvement. One of the reasons I
> may have to abandon my idea is the fact that if I cannot get the data
> out with anything other than using vision functions, means for every
> avi I produce and want to supply to a customer I need to sell him a
> $475.00CAN Vision license?
0 Kudos
Message 8 of 8
(4,610 Views)