Movies Exported from OpenSim 3.3 Take 0 Time

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
B.J. Fregly
Posts: 51
Joined: Wed Mar 12, 2008 6:55 am

Movies Exported from OpenSim 3.3 Take 0 Time

Post by B.J. Fregly » Sat Oct 10, 2015 1:00 pm

When I animate a walking motion in OpenSim 3.3 and then click on the Movie icon to export a movie as a .avi file, OpenSim 3.3 exports the movie, but then when I play it back on my Mac, the total time is 0 seconds.

I have to go back to OpenSim 3.01 to be able to export movies that play back with non-zero total time.

I am running OpenSim (multiple versions) on Windows 7 through Parallels on a Macbook Pro.

Any thoughts on why OpenSim 3.3 and versions after 3.01 export movies lasting 0 seconds?

Thanks!

B.J.

User avatar
Ayman Habib
Posts: 2244
Joined: Fri Apr 01, 2005 12:24 pm

Re: Movies Exported from OpenSim 3.3 Take 0 Time

Post by Ayman Habib » Sat Oct 10, 2015 2:40 pm

Hi B.J.,

The story is a bit more complicated, as described here
http://simtk-confluence.stanford.edu:80 ... ing+Movies

The summary is that 32 bit versions will always export movies, while 64 bit versions can export a sequence of snapshots that you'll need to use a third party tool to make a movie (as a workaround).

Please let us know if that's different from the behavior you're observing.

Best regards,
-Ayman

User avatar
Vishal R
Posts: 47
Joined: Wed Oct 29, 2014 4:20 pm

Re: Movies Exported from OpenSim 3.3 Take 0 Time

Post by Vishal R » Sun Oct 11, 2015 5:07 am

Hi Ayman,

Thank you so much. I was having this problem and I used a third party screen capture application to record the simulation videos. :lol: I didn't know about the movie frame capture method.

Thanks
Vishal

User avatar
B.J. Fregly
Posts: 51
Joined: Wed Mar 12, 2008 6:55 am

Re: Movies Exported from OpenSim 3.3 Take 0 Time

Post by B.J. Fregly » Mon Oct 12, 2015 12:13 pm

Hi Dr. Habib,

Great! Makes total sense now.

Somehow I missed the OpenSim documentation explaining the issue with making movies in 64-bit OpenSim.

I'll install 32-bit OpenSim as well just for making movies in the future. It's good to know about the individual frame export option as well for 64-bit OpenSim.

Thanks for your help!

B.J.

User avatar
Brad Humphreys
Posts: 79
Joined: Thu Feb 03, 2011 11:32 am

Re: Movies Exported from OpenSim 3.3 Take 0 Time

Post by Brad Humphreys » Tue Oct 13, 2015 8:53 am

Here is some example MATLAB code (I use in a function) to fix the movies produced by OpenSim 64bit. Give it the filename to read, a new filename, and the desired length of the movie.

Code: Select all

filenameIn='test.avi';  %Movie to be read
filenameOut='testNew.avi';  %New filename
desiredDur=1;   %Desire Duration in Seconds


mInfo=VideoReader(filenameIn);
fps=mInfo.NumberOfFrames/desiredDur;

vid = VideoReader(filenameIn);
writerObj = VideoWriter(filenameOut);
writerObj.FrameRate = fps; 
open(writerObj);
nFrames = vid.NumberOfFrames;
vidHeight = vid.Height;
vidWidth = vid.Width;
mov(1:nFrames) = struct('cdata', zeros(vidHeight, vidWidth, 3, 'uint8'),'colormap', []);
for k = 1 : nFrames
    mov(k).cdata = read(vid, k);
    writeVideo(writerObj, mov(k).cdata);
end
close(writerObj);

User avatar
Ayman Habib
Posts: 2244
Joined: Fri Apr 01, 2005 12:24 pm

Re: Movies Exported from OpenSim 3.3 Take 0 Time

Post by Ayman Habib » Tue Oct 13, 2015 11:16 am

Brad,

Thanks much for sharing this code, I'm sure it'll come in handy for many of our users on 64 bit machines.

Best regards,
-Ayman

POST REPLY