Flamenco: add fps, output_file_extension, and images_or_video job settings

These are all needed to use FFmpeg on the worker to render a video from
rendered image sequences.

- fps: float, the scene FPS
- images_or_video: either 'images' or 'video', depending on what's being
  output by Blender. We don't support using FFmpeg to join chunked videos
  yet.
- output_file_extension: string like '.png' or '.exr', only set when
  outputting images (since doing this for video requires a lookup table and
  isn't even being used at the moment).
This commit is contained in:
Sybren A. Stüvel 2018-11-21 14:23:32 +01:00
parent 85f911cb59
commit 113eb8f7ab
2 changed files with 30 additions and 0 deletions

View File

@ -4,6 +4,8 @@
## Version 1.9.5 (in development)
- Fix crashing Blender when running in background mode (e.g. without GUI).
- Flamenco: Include extra job parameters to allow for encoding a video at the end of a render
job that produced an image sequence.
## Version 1.9.4 (2018-11-01)

View File

@ -53,6 +53,9 @@ log = logging.getLogger(__name__)
# Global flag used to determine whether panels etc. can be drawn.
flamenco_is_active = False
# 'image' file formats that actually produce a video.
VIDEO_FILE_FORMATS = {'FFMPEG', 'AVI_RAW', 'AVI_JPEG'}
@pyside_cache('manager')
def available_managers(self, context):
@ -240,6 +243,9 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
'filepath': manager.replace_path(outfile),
'frames': frame_range,
'render_output': manager.replace_path(render_output),
# Used for FFmpeg combining output frames into a video.
'fps': scene.render.fps / scene.render.fps_base,
}
# Add extra settings specific to the job type
@ -256,6 +262,28 @@ class FLAMENCO_OT_render(async_loop.AsyncModalOperatorMixin,
settings['cycles_sample_count'] = samples
settings['format'] = 'EXR'
# Let Flamenco Server know whether we'll output images or video.
output_format = settings.get('format') or scene.render.image_settings.file_format
if output_format in VIDEO_FILE_FORMATS:
# Currently we don't do any postprocessing for video, so we don't
# bother figuring out the final output filename.
settings['images_or_video'] = 'video'
else:
settings['images_or_video'] = 'images'
# The file extension is necessary to find the output files and
# render them to a video with ffmpeg.
settings['output_file_extension'] = scene.render.file_extension # like '.png'
# Always pass the file format, even though it won't be
# necessary for the actual render command (the blend file
# already has the correct setting). It's used by other
# commands, such as FFmpeg combining output frames into
# a video.
#
# Note that this might be overridden above when the job type
# requires a specific file format.
settings.setdefault('format', scene.render.image_settings.file_format)
try:
job_info = await create_job(self.user_id,
prefs.project.project,