
Error with PlayMovieAction open

pmazzoni
Wed, 01/13/2021 - 08:19 am
I am trying to open a video file with the command:
playmovieaction open = "fullpath"
but I get the error "No movie". I tried including the file name with the path and I tried including only the path, without the filename, but I get the same error.
- Does fullpath need to be an Igor path instead?
- Can it be an Igor path?
Pietro
...sorry, I forgot to include version info: MacOS 10.14.6 (Mojave), Igor 8.0.4
January 13, 2021 at 08:20 am - Permalink
Hi Pietro,I just tried this on my system IP9 (Beta) Mac 10.15.7 (Catalina)
•PlayMovieAction gotoEnd, getTime
•Variable tEnd = V_Value
•PlayMovieAction step=-1, getTime
•Print "frames = ", tEnd/(tEnd-V_value)
frames = 3900.02
So I used the full path. I used option-right click "Copy -... as PathName" to get the full path and then copy pasted with added quotes.
Andy
January 13, 2021 at 08:32 am - Permalink
Thank you Andy, I got it to work using your code as a starting point. My mistake may have been that the path included escape codes for spaces but was also in quotes. Your example included spaces and that reminded me of the proper handling of spaces in macOS.
The playMovieAction command will be useful for extracting video frames, but it looks like Igor for Mac can no longer play video files. Is this correct? Or can I get Igor to control an external video player?
January 13, 2021 at 10:33 am - Permalink
Hi,
On my system when a play movie command is issued, Quicktime launches and plays the movie.
Andy
January 13, 2021 at 05:36 pm - Permalink
In reply to Thank you Andy, I got it to… by pmazzoni
For the PlayMovie operation, Igor Pro 8.04 and Igor Pro 9 will open a movie file using the application on the machine that is associated with the file type of the movie.
For the PlayMovieAction operation, the documentation of Igor Pro 9 explicitly states that the stop and start keywords are obsolete. I suspect that these keywords are also obsolete in versions of Igor Pro 8 released after macOS 10.15 because Apple removed the functionality Igor relied upon.
January 14, 2021 at 09:34 am - Permalink
Thank you both for clarifying this. Just opening and starting the movie will not be enough for my purposes. I wrote functions that allowed the user to review a video by starting, stopping and jumping to various frames, all within Igor. This will no longer be possible. Time to learn a little more Python.
January 14, 2021 at 09:48 am - Permalink
In reply to Thank you both for… by pmazzoni
Potentially you could use PlayMovieAction extract to extract the frames from the movie into Igor and then display the frames in a graph. You would need to add controls to allow the user to move forward and backward. Actually playing the video (at least at typical video speed) might be possible but isn't necessarily straightforward.
I'm curious to know which Python module you'd use to play the movie. My guess is that the module is using something open source under the hood that isn't practical for a commercial application like Igor to use. You could install ffmpeg on the machine and then call that using ExecuteScriptText. I don't know if ffmpeg provides a way to control playback of the movie.
January 14, 2021 at 10:21 am - Permalink
Can you post the video somwhere?
January 14, 2021 at 01:27 pm - Permalink
Adam: I explored using the OpenCV library in Python and got it to half-work (my Python code opens and plays video, but hangs when trying to close it). However, I followed your suggestion for what to try with the playMovieAction in Igor and it works! I open the video with playMovieAction, extract the first frame, plot is as an ImagePlot, and then extract subsequent frames and update the graph each time.
By some coincidence, the computer I am using plays through the frames at a a very similar rate to the actual frame rate. I could later add code to make the loop progress at the same rate as the video's frame rate, regardless of CPU speed. But for my current needs the frame rate does not matter--I just need the user to see the next n frames in the video, at whatever speed. I include the code below.
Thank you Adam!
Thomas: the video was not the problem. It is a simple MP4 clip that was opened with no problem by Igor in earlier macOS versions. And I've been able to open it using playMovieAction.
Here is the code:
January 15, 2021 at 08:27 am - Permalink
...sorry about the horrible formatting of the code in my last post. I just learned about "Insert Code Snippet". Here is the code again in the proper format:
//Open video file
playMovieAction open="/Users/pietro/Desktop/IMG_0003.mp4"
variable refNum = V_value
print "refNum", refNum
//Just curious to see how this number behaves. I think it
//is incremented at each call and is reset after Igor quits
playMovieAction gotoBeginning
//Redundant for now but I will need it later when I want
//to find out the number of frames in the video clip
playMovieAction extract
wave M_MovieFrame
display
AppendImage M_MovieFrame
SetAxis left 719.5,-0.5 //Flips the vertical axis so the video is not upside down
//The numbers are determined by the clip's height in pixels (800), which I happen to know
doUpdate
variable counter
for (counter = 0; counter < 500; counter += 1)
//At present I want to show the first
//500 frames of the clip. Later I will add code to determine the number of frames
//in the clip
playMovieAction step = 1
playMovieAction extract
doUpdate
endFor
playMovieAction kill
End //PlayVideo
January 15, 2021 at 08:29 am - Permalink