Timelapse with faster frame rate
Question
I am trying to use motion for timelapse recordings to replace a timelapse VCR we have so we can file the videos on DVD. I would like to use Motion but the framerate is not enough to do the counts we need. I was wondering how difficult it would be to change the rate from N seconds per frame to something like N/10 seconds per frame. I would think that would allow me to do 6 to 1 hour recordings with a setting of 2/10 seconds per frame or 5 fps. This is assuming that the playback is 30 fps which I believe is correct.
Thank you in advance for your help,
Daniel
Environment
Motion version: |
3.1.18 |
ffmpeg version: |
0.4.9pre1 |
Libraries: |
curl, xmlrpc, ffmpeg, mysql, postgresql |
Server OS: |
SuSE 9.1 |
--
DanielSmith - 24 Feb 2005
Answer
In motion-3.1.19_snap3 file motion.c round line 897 you find this code.
if (cnt->shots == 0 &&
time_current_frame % cnt->conf.timelapse <= time_last_frame % cnt->conf.timelapse)
event(EVENT_TIMELAPSE, cnt, newimg, NULL, cnt->currenttime);
This would have to be changed a bit.
The normal timer counts seconds. So we would have to use something different from the time.
I would perhaps set the framerate to what you want and then simply make a timelapse frame for each and every frame taken from the camera.
So simply remove the if () and just always run the event(...)
If you also use a higher framerate from something else you can save every second frame by doing a if (cnt->shots%2 == 0).
cnt->shots is the frame number which starts over from 0 at the start of a new second.
--
KennethLavrsen - 25 Feb 2005
Question
If I understand you correctly, would this hardcode the timelapse rate into the software? I would prefer if possible to keep the ability to change the rate in the config file. What do you think of this change?
if (((time_current_frame * 30) + cnt->shots) % cnt->conf.timelapse <=
((time_last_frame * 30) + cnt->shots) % cnt->conf.timelapse)
event(EVENT_TIMELAPSE, cnt, newimg, NULL, cnt->currenttime);
I would think that this would let me change the setting in the config file which would be N to 1 ratio. This is of course based on NTSC. I think a variable could be used instead of 30 which could be set to either 30 or 25 based upon the format. Is this correct? Would this negatively impact the program anywhere else? Or am I completely off?
Thanks for your help,
Daniel
--
DanielSmith - 25 Feb 2005
Motion does not always run with NTSC or PAL framerates. It runs with the rate given by the option
framerate or slower if the computer is busy.
There are many ways of doing it. As long as you do not change variables nothing should break by doing what you do. But I do not plan to change this feature to run faster then 1 fps. However Motion is open source so that gives you the oppertunity to hack your own very special version and I am happy I could help you.
--
KennethLavrsen - 25 Feb 2005