How to process a large batch of images in Siril for a timelapse video?

I’m starting to experiment with making widefield timelapse videos, and I’m trying to find a way to harness the power of Siril for automating final processing steps of the individual frames. So far I’ve used Sequator to do pre-processing and stacking steps, then GIMP/BIMP to run a basic curves adjustment to all of the images. But Siril offers much better options which cater to astrophotography than GIMP. I want to make a .bat file that includes few basic Siril-cli commands (rmgreen, denoise, and asinh specifically), that I can drag and drop a large group of images on and let it go to work. But I keep getting the error “GLib-GIO-CRITICAL : This application can not open files”. I’ve tried the approaches as described in the tutorial “Apply a single-image command to a sequence” on the Siril documentation site, but I keep running into the same errors with that code as well. I’m on Windows 11.

Any ideas? I’m certainly open to other avenues if there’s a better way to process a large batch of images.

That sounds like an error in your bat file. Make sure you invoke directly siril-cli in your commands, not smthg like start siril-cli.exe.
If that’s not the case, pls share a bat file, I’ll have a look

C.

To help with isolating the issue, here’s a simple batch file that gives the same error:

@echo off

“C:\Program Files\SiriL\bin\siril-cli.exe” -s OSC_StDgDn.ssf test_image.tif

echo Done!
pause

Also, I installed Siril using the windows installer, didn’t build it from source code. Maybe I need to install the dependencies for siril-cli to function?

Hi,

not sure what you intend to do. But calling siril-cli with option -s and an image as argument is not a valid call. -s expects you will pass a script file, not an image. There are a few examples in our tutorial on scripting: Siril - Advanced Siril scripting with bash or DOS

No need to build from sources to use siril-cli, the installer installs it with all the necessary dependancies.

C.

Thanks for setting me straight there, I was using the Siril Man Page synopsis to come up with that, a batch file is not the right place for that syntax I guess. ChatGPT led me astray as well.

This works, though I’d like to be able to loop it through multiple files - this seems to only process one file when I drop multiple on it.

echo OFF
FOR /F "tokens=2 " %%g IN (‘siril --version’) do (SET version=%%g)
set ext=fits

(
echo requires version
echo setext ext
echo load %1
echo rmgreen 0 1
echo asinh -human 6 0.044
echo denoise
echo save %1
echo close
) | siril-cli -s - >nul 2>&1

pause

Sidenote for any other amateurs like me: I added the siril-cli.exe directory to the Windows environment variables to avoid having to put the full path to it.

I’ve got a decent working solution below, but it’s limited on how many files can be drag and dropped on it, due to the character limits for command arguments. Depending on the length of the file path, the limit is usually around 100 files. I tried a nested FOR loop to cycle through all files in a directory, but the only way I could get siril-cli to work was by using the SHIFT and GOTO way of looping. Any ideas for how to change this to run on all files in the current folder?

::This is a batch file that will loop through multiple images and apply the same processing steps to each individual file
::the number of files that can be dropped is limited to between 100 and 200 files due to command argument character limits
::try placing the photos to be processed in a temp directory with a short path to maximize the characters available

@echo OFF

:loop
if "%1"=="" goto end
echo Processing...%1
FOR /F "tokens=2 " %%g IN ('siril --version') do (SET version=%%g)

set ext=fits
set newfile_dir=%~dp1
set newfile_name=%~n1
set newfile=%newfile_dir%processed_%newfile_name%

(
echo requires %version%
echo setext %ext%
echo load %1
	echo rmgreen
	echo mtf 0.10 0.35 0.79
	echo clahe 8 2.00
	echo subsky -rbf -samples=20 -tolerance=1.0 -smooth=0.5
	echo satu 1.00 0 6
	echo denoise -mod=0.65 -vst
echo savetif %newfile%	& ::save as a tif
echo close
) | siril-cli -s - >nul 2>&1

shift
goto loop

:end

echo All files done!
pause

I solved the issue I had with FOR loops. It had to do with delayed variable expansion and an inability to use variables set inside the FOR loop for echo commands inside the same loop. I rearranged the code to get around the issue. Working solution here:

::This is a batch file that will loop through all images in current folder
::apply the same processing steps to each individual file
::and save tif file renamed as processed_xxxx

@echo OFF
set ext=fits
FOR /F "tokens=2 " %%g IN ('siril --version') do (SET version=%%g)

::change desired file extension to process here if tif not desired

FOR %%f in (*.tif) do (	

echo Processing...%%~dpfxf

(
call echo requires %version%
echo setext %ext%
echo load %%~dpfxf			& ::adjust desired processing commands and parameters below here
echo rmgreen
echo mtf 0.10 0.35 0.79
echo clahe 8 2.00
echo subsky -rbf -samples=20 -tolerance=1.0 -smooth=0.5
echo satu 1.00 0 6
echo denoise -mod=0.65 -vst
echo savetif %%~dpfprocessed_%%~nf	& ::save as a tif renamed as processed_xxxx
echo close
) | siril-cli -s - >nul 2>&1
)

echo All files done!
timeout /t 3
exit

There are many ways you can script siril. We’ve given examples in the bash tutorial, with cmd and powershell. If you use python, there’s another tutorial:Siril - Automating with pySiril
I prefer python for doing this kind of things but that’s just my personal preferences. There are other examples at the end of the comet tutorial as well.

1 Like