Automatically stop rendering at the last animation frame.

Hi all,

I’m implementing a batch process to render a bunch of animations using the command line interpreter.

I want to know if there is a way to tell the renderer to render up to the last keyframe of an animation, instead of providing the start and end times.

Each animation has different length and I don’t know exactly it (well, yes if I open synfig studio and take a look :slight_smile: ).

Something like a special key to tell the renderer to stop, or something similar will be also valid.

Thank you very much,

Unfortunately there is not interface to know the last keyframe (or waypoint) of the document. There is not option rather than open the composition in Synfig Studio…
… or create a parser that opens the sif file and search for the last waypoint or keyframe… :slight_smile:

carlos@pcnuevo:~/Animación/commandline$ grep 'keyframe' anim1.sif <keyframe time="0f"/> <keyframe time="1s 3f"/> <keyframe time="1s 11f"/> <keyframe time="1s 15f"/> carlos@pcnuevo:~/Animación/commandline$
I’m not so good at bash language but I’m sure that it is possible to create a script that extract the latest keyframe. They are listed in order :wink:

Thanks for the clue Genete!
I’ve just got it working correctly with the following command lines:

Extract and send to stdout the time of the last key frame:

REM contents of keyext.bat:
gzip -d -c %1 | grep "keyframe" | tail -n 1 | sed "s/.*\"\(.*s\)\( \)*\(.*f\)*\".*/\1\3/"

Render the animation properly using the retrieved information:

for /F "tokens=*" %%i IN ('call keyext.bat anim.sifz') DO SET KEYFRAME=%%i "C:\Archivos de programa\Synfig\bin\synfig.exe" --start-time 0 --end-time %KEYFRAME% anim.sifz -o frame.png

Although we should recognise this is hardcore stuff :mrgreen:

Probably this is something that can be done by default in further releases, don’t you think?

Thank you!


Yeah! it is not a extremely difficult modification. Maybe you dare to code it? What’s your C++ background?
(my bash background is awful!)

I learnt from one of those books called “teach yourself c++ in 25 days”, I started last week! :mrgreen:

I must admit, I downloaded the code and took a look at it yesterday :slight_smile: but preparing the environment to compile and develop is something that can take some time so I quit it :neutral_face:

Ok, Whenever I had time i’ll try to make the fixes by myself, and send them to the comunity.