Welcome to WSL!

Make yourself at home, but before posting, please may I ask you to read the following topics.


Posting 101
Server space, screenshots, and you

Thank you!

PS. please pretty please:


Image

Invoke command line after render completion

User avatar
bryanfordney
Fusioneer
Posts: 129
Joined: Tue Jan 29, 2019 1:10 pm
Location: Atlanta, GA
Been thanked: 2 times

Invoke command line after render completion

#1

Post by bryanfordney » Mon Mar 30, 2020 6:54 am

Hi all, well I'm stuck at home of course and trying to replicate some of my studio's render farm functionality with Fusion's built-in Render Manager.

I am confused about how "End Render Scripts" works. Can this be used to invoke a command line (like run FFMPEG), and does it run after a network render (after all slaves are done)?

Alternatively is it possible to setup a comp in Fusion that assembles your final render into a movie, using this built-in system? I'd honestly prefer that over FFMPEG.

User avatar
SirEdric
Fusionator
Posts: 2322
Joined: Tue Aug 05, 2014 10:04 am
Answers: 12
Real name: Eric Westphal
Been thanked: 46 times
Contact:

Re: Invoke command line after render completion

#2

Post by SirEdric » Mon Mar 30, 2020 10:09 am

Hey Bryan.

What do you son't like about ffmpeg? It's fast as hell...:-)
There's even an ffmpeg-saver available in Reactor that takes the rendered image sequence and ancodes it into a streaming format.

User avatar
Movalex
Sir Requestalot
Posts: 249
Joined: Fri Nov 03, 2017 5:36 am
Answers: 4
Been thanked: 44 times
Contact:

Re: Invoke command line after render completion

#3

Post by Movalex » Tue Mar 31, 2020 4:26 pm

@bryanfordney I was having some fun with ffmpeg in-tool script written by @AndrewHazelden. It even has a gamma correction option for linear images. I created a couple of presets for different mp4 and prores exports based on this script. These I will attach to the post. But now if I was to build a home based automated delivery server, I would start from other than Fusion software. Indeed, this in-tool script will not work with network renders. At least in my case it failed to render anything if network rendering was enabled. Probably it can be done with some advanced managers, like Deadline, tho.

My personal preference for such task would be FFAStrans software. It is relatively easy to set up, enormously customizable, node based solution for watchfolder operations. So if you are on Windows, it would be my option number one. Also community is very nice, and bugs are fixed almost immediately. The latest version has Image sequence watchfolder, so you can specify (among other things) a minimum number of frames before the conversion is started.

Image

saver_h264.setting
saver_intool_prores.lua
You do not have the required permissions to view the files attached to this post.

User avatar
bryanfordney
Fusioneer
Posts: 129
Joined: Tue Jan 29, 2019 1:10 pm
Location: Atlanta, GA
Been thanked: 2 times

Re: Invoke command line after render completion

#4

Post by bryanfordney » Thu Apr 02, 2020 7:17 am

My problem with FFMPEG is doing gamma correction like Movalex talks about. I've really tried to get it to do proper color space transformations and the result always looks wrong. Otherwise I love FFMPEG. I ended up writing my own tool that wraps around FFMPEG, doing color transformations with a Python library called colour, then piping the raw bitmap data into FFMPEG for encoding.

So is it true then that you can't - just with Fusion - invoke some command after the whole render is done?

User avatar
Movalex
Sir Requestalot
Posts: 249
Joined: Fri Nov 03, 2017 5:36 am
Answers: 4
Been thanked: 44 times
Contact:

Re: Invoke command line after render completion

#5

Post by Movalex » Thu Apr 02, 2020 9:47 am

When I was testing this render script with option to sRGB gamma correcttion, rendered file looked completely correct for me. But probably you have to do a more complicated change...
BTW, I used -apply_trc iec61966_2_1 option for that. There's also a bunch of other options:
  1.  bt709                        .D.V.... BT.709
  2.  gamma                        .D.V.... gamma
  3.  gamma22                      .D.V.... BT.470 M
  4.  gamma28                      .D.V.... BT.470 BG
  5.  smpte170m                    .D.V.... SMPTE 170 M
  6.  smpte240m                    .D.V.... SMPTE 240 M
  7.  linear                       .D.V.... Linear
  8.  log                          .D.V.... Log
  9.  log_sqrt                     .D.V.... Log square root
  10.  iec61966_2_4                 .D.V.... IEC 61966-2-4
  11.  bt1361                       .D.V.... BT.1361
  12.  iec61966_2_1                 .D.V.... IEC 61966-2-1
  13.  bt2020_10bit                 .D.V.... BT.2020 - 10 bit
  14.  bt2020_12bit                 .D.V.... BT.2020 - 12 bit
  15.  smpte2084                    .D.V.... SMPTE ST 2084
  16.  smpte428_1                   .D.V.... SMPTE ST 428-1
End Render Script is for invoking commands after the rendering is done, so the problem is with distributed rendering only? Probably Fusion cannot track if the last frame has been rendered for particular render node? I think it is hardly possible, because it is always aware about the last frame. Maybe my rendering has failed because I had incorrect linking to ffmpeg distros. For instance, if rendering was completed on a server that had no access to ffmpeg directory, it could fail for sure... I wish there were more information in rendering logs about that.

howiem
Posts: 34
Joined: Fri Jun 07, 2019 3:08 am
Been thanked: 6 times

Re: Invoke command line after render completion

#6

Post by howiem » Thu Apr 02, 2020 12:03 pm

bryanfordney wrote:
Thu Apr 02, 2020 7:17 am
My problem with FFMPEG is doing gamma correction
I've found the best solution (at least for my needs) is to just sort out the gamma in Fusion first, spit out EXRs or PNGs, then a dumb compilation with ffmpeg. I set up a couple of simple bash scripts (fired off by Automator on my Mac, though Windows / Linux has similar capabilities) so once a network render's done, it's just two-clicks to turn it into a ProRes file. Handy for any other situation where a quick compile-the-frames thing'd be handy. Drop me a line if you want 'em.

Screenshot 2020-04-02 at 19.55.18.png
You do not have the required permissions to view the files attached to this post.

User avatar
bryanfordney
Fusioneer
Posts: 129
Joined: Tue Jan 29, 2019 1:10 pm
Location: Atlanta, GA
Been thanked: 2 times

Re: Invoke command line after render completion

#7

Post by bryanfordney » Thu Apr 23, 2020 7:40 am

Thanks guys I am going to try to use FFMPEG again for EXRs and see what I come up with. My problem is that my EXRs are both in a different gamma and a different gamut. I need to go from P3_D65 to sRGB, and then add the sRGB gamma. But maybe I can specify those gamut XYZ coordinates into ffmpeg...

User avatar
bryanfordney
Fusioneer
Posts: 129
Joined: Tue Jan 29, 2019 1:10 pm
Location: Atlanta, GA
Been thanked: 2 times

Re: Invoke command line after render completion

#8

Post by bryanfordney » Thu Apr 23, 2020 9:11 am

Code: Select all

-apply_trc iec61966_2_1
does indeed seem to work perfectly for adding the sRGB gamma.

I looked into the "colorspace" filter to do Gamut conversions, but unfortunately all the primaries are hard-coded into the ffmpeg source. I wish it were possibly specify the x,y values for RGB and white for gamut conversions in ffmpeg.

Added in 58 minutes 39 seconds:
OK, for what it's worth, though it is not really related to my first post here, I found a way to encode P3-D65 linear EXRs into sRGB images.

add `-apply_trc iec61966_2_1` to the input to immediately add the sRGB curve to the incoming EXR files.

to do the chromaticities you have to use the colorspace filter, but you have to kinda "trick" it into only adjusting primaries.

`-vf colorspace=ispace=fcc:iprimaries=smpte432:itrc=srgb:primaries=bt709:trc=srgb:space=fcc`

For some reason the "fcc" colorspace seems to work to force FFMPEG not to mess with the luma coefficient when doing the primaries adjustment. smpte432 is apparently another name for P3-D65. Success.