-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quicken FastMovieWriter? #1
Comments
Hi there! Hmm.. I'll take a look at that stuff. Yes, I probably can be improved dramatically, for sure. I think when I developed this there was no threading in matlab... 5 seconds per frame is abysmal. Wow. Is it spending most of its time in FastMovieWriter ?? |
Wow that link you pasted is very sexy C++ code. I hadn't realized matlab updated their api to be so C++-friendly. As for build instructions -- I forgot how to build this thing! I seem to remember mostly the matlab bits required just "mex file.c" or whatever -- is that not working? |
Indeed it appears to spend a majority of its time in AddFrame: However, I will be doing more Profiling in the coming days to see if there is any 'badness' on our side. Ahaha, yes MATLAB does have quite a few useful features that are terribly documented. If you are interested, there is an article by the godly Yair Altman, which you might find interesting: I did try the |
I believe I found the cause, the StimulateOpenGL_II/Matlab/FastMovieWriterMex/FastMovieWriterMex.cpp Lines 168 to 205 in 827a645
Might be better to do it in the MATLAB call itself.
e.g. Or throw a warning of sorts. The Profiler now says I found some other inefficiencies in our main script, so I'll look into those to further speed up our rendering. |
Nice job!! Oh wow. That should be way better documented. You are right -- it should throw an exception. It's useless to accept those values if the slowdown is so large. Thanks for catching this. I honestly forgot how this code works -- I'm super glad you managed to get it working!! |
Hmm. It might be spending most of its time compressing. Try passing a third argument to AddFrame,
I think if compression is set to 0, it should be very fast. |
So try compression 1, 2, 3, etc. 9 is the maximum (and the default!). I bet even with 1 or 2 it will be much better. Sadly I should have used a real movie format to do this -- a lossless one such as FFv1. But at the time integrating a real movie encoder like ffmpeg was beyond the scope of this project. I |
Ok, cool. Yeah if you come up with changes, do let me know. For your information: you can probably compile the mex file if you specify all the .cpp files it depends-on on the command-line .. I know it pulls in dependencies from |
I actually tried running the |
Gaah! Really. That.. shouldn't be the case. Data is data. Very strange that it would do that. Are you sure I'm sorry I don't really have time to work on this now .. I would perhaps fix up the code. It's strange to me that the data would produce bad movie files in that case.. it makes little sense... |
Just double check that the dimensions of the casted |
Here we can see our black and white image matrix
No worries, I am just posting here in case anyone else finds it useful too. If we find a solution I will post that on here too. |
Just found out it was a big yikes on our side. StimulateOpenGL_II/Matlab/FastMovieWriterMex/FastMovieWriterMex.cpp Lines 184 to 185 in 827a645
Which is in line with the documentation for the AddFrame function, where it expects intensity values:StimulateOpenGL_II/Matlab/@FastMovieWriter/AddFrame.m Lines 3 to 4 in 827a645
So if you are going to make a backwards compatible fix, it might be something like:
instead of:
|
Oh wow. That should have at least been documented. GRRR. Yeah to my developer mind "of course it would be scaled to 255" -- but that fact is not obvious -- esp since the documentation is WAYY misleading. It also doesn't talk about the performance impact and how uint8 is the fastest. I agree this needs to be updated. I'm leaving this issue open and may get to it soon. So .. I take it now it works, right? |
Yep, it now correctly displays the stimulus after typecasting with |
Ok, cool. I'm leaving this issue open. I may find time soon to go in and better document the behavior and also give this code a little love.. Thanks for posting and do use this issue tracker. It's probably the best way to get a hold of me and to document things for others. |
Just inquiring if there are any plans to improve the speed of FastMovieWriter?
At the moment we are able to add a frame every 5 seconds, which results in tediously long
.fmv
creation time for our high frame rate system.I had a look at some of the source code and it seems that speed ups could be done in:
I would also be excited to try these out myself, but cannot seem to find current build instructions?
Cheers
The text was updated successfully, but these errors were encountered: