02-27-2007 04:34 PM
02-28-2007 05:29 PM
Hello Adam,
Are you able to play the AVI file you generated in a stand-alone session of Windows Media Player (not ActiveX)? In other words, is a valid Windows Media Player compatible AVI file generated?
Regards,
Jasper S
02-28-2007 09:31 PM
03-01-2007 02:59 PM
Adam,
Is the error you are seeing a Windows error or a LabVIEW error? And is there an error code associated with it?
Can you play ANY AVI successfully in the ActiveX Windows Media Player control? Can you play the AVIs you create in a separate VI with an ActiveX control?
It may be helpful in this situation for you to post your code to the forum, so we can take a look at how your code is operating.
Regards,
Jasper S
03-01-2007 07:52 PM
The error I see is generated from LabView. I don't know off hand what the error code number is, but it complains that the Avi file can not be accessed, file accessed denied. I can stop the program and open the avi file in Media Player and play it. I can also play the created avi file from another vi that just opens the avi file and plays it. Here is the pseudocode I am using to run the program. I chopped out the image recongintion and anyalsis because it has no bearing on how the avi file is handled. The way I have the code structured now, I believe it will not append the avi file, but overwrite it with the newest image. What I am trying to do is take the newest image and added it the avi file, while LV is playing the avi file. I thought by stopping and closing media player, then writing the new image to the avi file, and then reopen Media player to play the new avi file would allow the file to "not beigning used."
Adam
03-02-2007 11:33 AM
Adam,
While you can continually play and write to an AVI file in LabVIEW, you will never be able to continually write to and play an AVI file in Media Player, even through ActiveX. LabVIEW can internally share the AVI file resources, but externally there is no way to manage the sharing of the AVI file between Windows applications (LabVIEW and Media Player). From looking at your code it appears you have the writing and viewing processes happening in parallel. And as you said, Media Player will have to release its hold of the file before LabVIEW can access it. You will need to make sure that you know the order in which these independent portions of code (acquisition and playback) will be happening. Knowing the order of operation will allow you to ensure that you have closed all your references before you pass the file on to be played or appended.
Regards,
Jasper S
03-02-2007 02:12 PM
I thought the flow of the opening and closing the media player would go like:
1. Open the file to play until the new picture is ready
2. Stop media player
3. Close media player reference
4. Write frame to avi file
Then repeat.
The problem is, if I use the "Open avi" vi, it opens the avi file fine, but will not write a new frame to it. LabView gives the error "Avi file is open, but only for read." If I try the "Create avi" vi, that will rewrite the the avi and not append the avi file. Is it possible to do this.
Adam
03-05-2007 04:33 PM
Adam,
We have been discussing this issue in the CVI forum, and I believe it would be very beneficial for you to start a thread in the Machine Vision forum, linked here, so that other readers of the forums can contribute to our discussion. Make a new thread, and we will link it back to this one.
Regards,
Jasper S