Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

NI created AVI plays slow through WMP

The video I am creating using AVIOutputSession is playing back too slowly when I use Windows Media Player.  When I time the recording, I record for 10 seconds.  When I look at the file properties, they say the video duration is 10 seconds.  When I play the video in WMP, WMP states the video will last 10 seconds.  When I time it, it plays for 20 seconds.

 

I am creating an AVI using AVIOutputSession.  I am writing the frames at 120 Hz.  Each image is 100x100 pixels.  I am not currently using a Codec (though I did try it once with a codec with no change in the results).  Metrics in the code do tell me that I am writing frames at 120 Hz.

 

As an experiment, I did slow down the recording frame rate to 60 Hz.  When I played that back thru WMP, the video lasted the expected 10 seconds.

 

 

My sneaking suspicion is that WMP cannot play any video back at that high of a frame rate.  But, it seems to me that if I can write frames at that frame rate, WMP ought to be able to play them back at that rate.

 

Any thoughts?

 

Thanks,

 

Rick B.

0 Kudos
Message 1 of 5
(3,792 Views)

Hi Rick,

 

Does the AVI file play back at the proper speed in LabVIEW (or whatever environment you are playing this in)?  I do know that whatever speed you specify in the Create AVI VI (again, in LV, but translate to your environment) is instrumental in properly playing back the VI.  

 

I couldn't find much on how fast you could play back videos in WMP; most content related to how much you could speed up the video (x2, x3, etc).  

 

Cheers,

 

Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 2 of 5
(3,764 Views)

Marti

 

Unfortunately, I have not yet written the code to play the video back.  We are using C#, MeasurementStudio, and VDM.

 

There is a user requirement to play the video back within the code.  As I am able to write the frames to the file at 120 Hz, I suspect I will be able to play them back at that rate as well.

0 Kudos
Message 3 of 5
(3,760 Views)

I was trying to save AVIs with 100 fps and had the same problem.  I seem to remember that when writing an AVI the fastest frame rate is 60 fps.  Even if you try to write a larger number on the input, the largest value it saves is 60.  If you read the AVI using LabVIEW, check and see what frame rate is stored in the AVI.

 

The only solution I know is to set the FPS to 60 and only write every other frame.  Screens can't really update any faster than that anyway.

 

Bruce

 

 

Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 5
(3,752 Views)

As far as I can understand, the following happened:

 

Most players will play "non-tearing" video. It means that each frame synchronized with VSync signal from monitor. So, it means that you can't get more FPS for playback than monitor does. Currently most of TFT monitors are 60 Hz, and this is possible reason why you can't get more than 60 FPS.

 

What you can do is the following: You should create your own player (can be done with AVI functions from NI), then play it in vision display (you can also using IMAQ Draw - try it with enabled or disabled Non-Tearing flag and see differences). So, you will get 120 FPS (if PC and videocard are fast enough), but you will get probably tearing effect (but it depends from video). Also you can write each second frame for reducing FPS to 60 Hz (and I believe - user will see no differences in comparison with 120 FPS).

 

Andrey.

 

0 Kudos
Message 5 of 5
(3,717 Views)