AWS Thinkbox Discussion Forums

Job Conversion Script for ProRes and H264 using FFmpeg

Found this thread the other day while I was looking for a way to batch convert our rendered image sequences from Cinema 4D into ProRes .mov files. @chitty your conversion script was super helpful!

I spent a few days reworking that script for C4D. One of the issues we had is when the script loops through the source job(s) to create the file list for conversion, the JobOutputFileNames value returns empty. So instead, it seems we have to build the filepaths from the File Path and File Prefix in the Cinema4D job plugin settings. I’ve set it up to look in the output folder for image sequences, and then if there are multiple image sequences present that match the source job name (perhaps different render passes), it will encode them each separately.

I also added an option to burn-in the frame number at the bottom-center of the frame. (Just now realizing I took out the Rec.709 tagging, but I can add that back in later). This script should still work with multiple jobs selected too.

All of the different compression settings for the different flavors of ProRes have been moved into a dictionary, so pixel format, metadata, vtag, and profile:v will all be set appropriately for 422 HQ, 4444 and 4444XQ. Adding in completely different arguments for other codecs (like H.264, which I’ve included) should also be fairly easy.

Regarding H.264, I referenced this page on how to better encode H264 for frame-by-frame scrubbing. From my experience, scrubbing was not very performant while using “-tune stillimage” but worked better with “-tune zerolatency”. I’d love to know if other folks have thoughts or input on this.

My updated script is here:

Cheers,
Soren

2 Likes

One of the other things I figured out is how to get the progress bar to update for the FFmpeg jobs. In the conversion script, I pass the frame range to JobExtraInfo0 for the FFmpeg job to be able to reference. Then I modified the plugin script here: [repo path]/plugins/FFmpeg/FFmpeg.py

# add the below lines to existing InitializeProcess() function
self.HandleProgress = True
self.AddStdoutHandlerCallback( "\bframe=\s*(\d+)\b" ).HandleCallback += self.HandleStdoutProgress

# add this function to bottom of script
def HandleStdoutProgress(self):
    startFrame = int(self.GetJob().JobExtraInfo0.split("-")[0])
    endFrame = int(self.GetJob().JobExtraInfo0.split("-")[1])
    frameCount = abs( endFrame - startFrame ) + 1

    if (self.GetRegexMatch(1)):
        currFrame = int(self.GetRegexMatch(1))
        progress = 100 * ( currFrame - startFrame ) // frameCount
        self.SetProgress(progress)
1 Like

this looks cool.

I think I created everything as in your requirements, but the my monitor crashes right away when I launch it after the dialog window.

I installed ffmpeg

Privacy | Site terms | Cookie preferences