Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 29th December 2019, 04:48   #1  |  Link
TomArrow
Registered User
 
Join Date: Dec 2017
Posts: 90
How to import 32 bit floating point EXR sequence in AviSynth+?

I'd like to import a linear 32 bit floating point EXR sequence in AVISynth. I succeeded importing as RGB24 or RGB64 with ImageSource, however it cuts off all the values above 1. It would need to go into a format like RGBPS I think, but ImageSource throws an error if I try using that as pixel_type. What are my options?
TomArrow is offline   Reply With Quote
Old 29th December 2019, 05:03   #2  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Currently, you cannot use this workflow with EXR in avisynth properly - because there are no source filters capable. AVS+ has the RGBPS capability now, but nothing to load it with

Your options are to use another program that can handle EXR sequences and float eg. Natron (open source) , or commercial ones like After Effects, Nuke . Perhaps convert them to a format AVS+ can handle importing

or Vapoursynth can load and handle them properly as float with it's imagemagick implementation (it's high bit depth, HDR) . Hopefully one day avisynth will get this too
poisondeathray is offline   Reply With Quote
Old 29th December 2019, 05:07   #3  |  Link
TomArrow
Registered User
 
Join Date: Dec 2017
Posts: 90
Ah, bummer.

I've never used VapourSynth, how would a script in VS look to import it correctly and then convert it to a HDR PQ Rec2020 color space? Or should I switch forums for that question?
TomArrow is offline   Reply With Quote
Old 29th December 2019, 06:13   #4  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
It's probably start a thread there
poisondeathray is offline   Reply With Quote
Old 29th December 2019, 06:38   #5  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
The following is incredibly janky and probably completely unsuitable for the purposes this was being asked for in the first place. But it was interesting getting this to 'work'.


VapourSynth can do it using imwri, as mentioned above.

I couldn't find any 32-bit EXR samples to work with, so I had to try generating some myself. It didn't work; the only thing that did was converting one of the 16-bit EXR frames from Big Buck Bunny to 32-bit TIFF. So I tested with that.

The corresponding VapourSynth script to test this out is something as simple as this:
Code:
#!/usr/bin/env python
import vapoursynth as vs
core = vs.get_core()

clip = core.imwri.Read('test32.tiff', alpha=False)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444PS, matrix_s="709")
clip.set_output()
(comment out the Bicubic invocation to preview directly in FFmpeg/mpv - FFmpeg only supports displaying RGB float; also, hopefully there's a better way than to use matrix_s="709", but that was just the easiest one to test with that didn't throw an error)

But what does this have to do with AviSynth, you ask? Well, you can load VapourSynth scripts in AviSynth. The newest build of VapourSource appears to be this one:
https://github.com/Beatrice-Raws/VapourSource/releases

There's a big caveat there, though: currently, none of the forks of VapourSource accept RGBPS, only float YUV. Hence that line in the example .vpy that converts to YUV444PS. But FFmpeg doesn't support that format. So we convert the RGBPS to YUV444PS to get it into AviSynth through VapourSource, and then inside of AviSynth+, we convert it back to RGBPS so FFmpeg can display it:
Code:
VSImport("Template.vpy")
ConvertToPlanarRGB()

Last edited by qyot27; 31st December 2019 at 00:14. Reason: imwri comes with vs, see correction below
qyot27 is offline   Reply With Quote
Old 29th December 2019, 06:54   #6  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
vapoursynth comes with imwri now

You have to use float_output=True for RGBPS, otherwise it will load as RGB48 . Wildcards are the same syntax as ImageSource, with respect to "placeholders" or padding eg. such as img_%05d.exr

vsedit can display things like RGBPS, and the color picker will display the values <0 or >1 for R,G,B in the status bar . It's a great editor for high bit depth, and until / if avspmod every gets this - I actually use it also to preview avs scripts >8bit. (You can go the other way and import avs scripts into vpy for some types of pixel formats)

Linear float to 10bit420 Rec.2020 PQ would look something like this

Code:
clip = core.resize.Bicubic(clip, format=vs.YUV420P10, matrix_s="2020ncl", transfer_in_s="linear", transfer_s="st2084", primaries_in_s="2020", primaries_s="2020", chromaloc=2, nominal_luminance=1000)

But there are bunch of other variables and stuff you probably have to do.

But what is your EXR sequence originally from? Likely you have to make adjustments and grade it before converting. The input primaries and the nominal_luminance might need to be set differently
poisondeathray is offline   Reply With Quote
Old 29th December 2019, 07:23   #7  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
Quote:
Originally Posted by poisondeathray View Post
vapoursynth comes with imwri now
That's strange, because despite having been relatively up-to-date, libimwri was not in any of the plugin directories. Oh well, reinstalling R48 fixed it.
qyot27 is offline   Reply With Quote
Old 30th December 2019, 22:15   #8  |  Link
TomArrow
Registered User
 
Join Date: Dec 2017
Posts: 90
Thanks guys.

@poisondeathray They're already graded, exported from a 32 bit floating point composition in After Effects.
TomArrow is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 17:52.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.