Then the file format is given by the blend file and the suffix is added to the file name. And, if one wanted to change the file format: bpy.context.scene.render.image_settings.file_format = 'PNG'
I use a separate project that’s just a video sequencer with a custom panel that searches a directory for .blend projects, creates a list, and gives options to render in background, view rendered sequence, or migrate rendered images of each of the projects. I can share if you are interested. Right now it’s pretty specific to my workflow, but not hard to tweak
Although I saw from your first post you are on Mac? So this might not work, I use on Windows, and the command line ops in python haven’t been set to be cross-platform. Basically you just fill out the directory of your .blend files, then your directory of your rendered sequences. Then click “refresh accessible files” - you’ll see a list of all your blend projects and a blender icon next to them (open the project), and a render icon next to that (render/rerender in background). After rendering with this button you will see additional options, view in image sequencer, copy rendered images to new directory, (and I linked this to use TexturePacker in the background as well, outside of blender).
The renders always take the name of the .blend file they are rendered from, and use render settings from the file they point to.
So basically this works as if you are rendering in the background from a console, but with a nifty little UI and a way to view the rendered sequences easily. The zip here contains a folder of 2 blend files with simple animations of a cube if you want to quickly test if it is working.
Not the cleanest code or anything, this was just for personal use, so let me know if you hit any snags and I can try my best to answer.
From the other answers, this is probably overkill for what you want to do, but might be insightful to read through the script. The panel should be visible in the properties UI of the video sequencer “render source control“ window. And is already registered, so if it didn’t run when opening the file might be a issue of your operating system not being windows. If you open a text editor window in the project, you’ll see the RenderControl.py (along with some others I might have had registered by default that don’t matter for this.) Run manually by selecting text>Run or the play button at the top of the text editor window
import bpy
# Render frames 1 to 90
for step in range(1, 91):
bpy.context.scene.frame_set(step)
# Render the current open scene
bpy.context.scene.render.filepath = 'PATH_NAME/frame_%d.png' % step
# Choose which scene to render
# bpy.data.scenes["Scene"].render.filepath = 'PATH_NAME/frame_%d.png' % step
bpy.ops.render.render(write_still=True)
print("Done")
I ran it and it rendered the frame(s) and printed “Done” in the console, so all should be good.
Thanks! Ignoring the rendering for the moment, are you pasting your code into Scripting > Text Editor or into the Python Console?
print(“done”) does not work for me in the Scripting > Text Editor.