Log in

View Full Version : Export to format OpenEXR or DPX


doctorkhv
29th April 2021, 00:53
Hi,

The issues of export to lossless formats have been repeatedly discussed, but OpenEXR or DPX has not found.

Plan. There is mp4. I want to delete the duplicate frames of the dedup, save it in OpenEXR or DPX format. Process it in Davinchi (Adobe...) and save it in mp4.

How to implement a plan?
What will the Avisynth script look like?

Thank you.

poisondeathray
29th April 2021, 01:36
Hi,

The issues of export to lossless formats have been repeatedly discussed, but OpenEXR or DPX has not found.

Plan. There is mp4. I want to delete the duplicate frames of the dedup, save it in OpenEXR or DPX format. Process it in Davinchi (Adobe...) and save it in mp4.

How to implement a plan?
What will the Avisynth script look like?

Thank you.




ffmpeg can read avs scripts if avisynth support has been included (it usually is with windows builds).

So 10bit RGB dpx can be written with ffmpeg using avs input

It would look something like this



#source filter for MP4

#dedup, etc...
.
#filtering, etc..
.
ConvertToRGB24(matrix="rec709")
ConvertToPlanarRGB()
ConvertBits(10)




The ffmpeg part would look something like this


ffmpeg -i input.avs -start_number 0 output%06d.dpx





avs+ supports float, and ffmpeg supports exr write now, but the ffmpeg avs demuxer does not support float formats, so it cannot be done in a similar way .

(Assuming you want the most common, standard EXR types - which are 16bit half float or 32bit float, sRGB, linear . EXR actually supports many more types, including integer types but float is the most common reason EXR is used. And if you were going to be using 16bit int - eg. RGB48 or RGB64(alpha) you might as use PNG instead)

You can use vapoursynth if you need proper EXR support for import/export using imwri

patul
29th April 2021, 01:59
@poisondeathray

Doesn't ImageWriter output .exr? Whether the output is a proper EXR or not, that's another issue. But this script does output .exr file that can be opened by IrfanView

ColorBars()

ImageWriter(file = "D:\App\AVS\AVSMeter290\Pic-", start = 5, end = 5, type = "exr")

FranceBB
29th April 2021, 02:00
EDIT: looks like other people with much more knowledge replied while I was writing, so my answer is no longer relevant, read poisondeathray's advice.

Well it's not actually the Avisynth script that's gonna be the problem but rather the BAT file to make the EXR or DPX image sequence.
To put some context here to those who might not be familiar, basically a DPX is essentially a TIFF with timecode metadata. What you would get after indexing and decimating in Avisynth and encoding in DPX is a series of folders in which there are a bunch of .dpx files (1 for each frame) usually in 10bit planar RGB in one folder, discrete 24bit 48'000Hz PCM audio tracks muxed in .wav in another and a .xml metadata file in another folder. They all make a DPX package.
The problem is that I've never encoded one.
I think that FFMpeg should be able to take the uncompressed A/V stream from Avisynth and encode it in DPX, but I'm not sure...

The Avisynth part is easy, you just need an indexer (FFMpegSource2 or LWLibavVideoSource), something to remove dups (TDecimate), something to convert bit depth (ConvertBits), something to convert to RGB (ConverttoPlanarRGB), something to bring the audio to 48000Hz (SSRC, ResampleAudio) and something to bring it to 24bit (ConvertAudioTo24Bit).

After that it's just a matter of writing a BAT to take the Avisynth output and encode to DPX.
If FFMpeg can do it, that's your best shot, otherwise if other command line open source encoders can do it you can use FFMpeg to open the Avisynth script and pipe the video to whatever encoder you'll end up using.

I'll let others reply, though, 'cause I've never encoded a DPX (I only received them), so I'm afraid I can't help you any further.

poisondeathray
29th April 2021, 02:24
@poisondeathray

Doesn't ImageWriter output .exr? Whether the output is a proper EXR or not, that's another issue. But this script does output .exr file that can be opened by IrfanView

ColorBars()

ImageWriter(file = "D:\App\AVS\AVSMeter290\Pic-", start = 5, end = 5, type = "exr")

Interesting, but it does not display properly in some programs intended for exr viewing such as djv, or AE (black screen), or ffplay . It's flipped in natron, and wrong color

If you convert to planarRGB and 32bits before imagewriter, there is error saying it supports 8bit and 16bit only

EXR is not listed either
http://avisynth.nl/index.php/ImageWriter

I do not thing it's a "proper" EXR , and imagewriter does not support half float or full float, which are the most common and main reasons for using EXR in the first place. You might as use PNG and be ensured that it will work in that case

Dogway
29th April 2021, 11:20
Why don't you frameserve it? I use AVSF and PismoMount and it will create an avi image that you can load on several other programs, I tested and it works on Resolve, not in Nuke though.

Frank62
29th April 2021, 14:56
Pismo with AVSF is the most compatible Avisynth-wrapper I know. We use it all the time. I am surprised to read that there is even one workflow where it doesn't work.

doctorkhv
2nd May 2021, 23:38
Thank you Frank62
Thank you Dogway
Thank you poisondeathray
Thank you FranceBB
Thank you patul

poisondeathray
5th May 2021, 05:34
For EXR, you can send 8 or 10bit avs script to ffmpeg, and use -vf zscale to linearize, and scale to 32bit float, and to write the exr sequence

#8 or 10bit YUV input avs script
#assume hd or 709, otherwise use matrixin=170m


ffmpeg -i input.avs -vf zscale=matrixin=709:transferin=iec61966-2-1:transfer=linear,format=gbrpf32le -compression zip16 -start_number 0 out_%06d.exr

doctorkhv
5th May 2021, 12:47
Thank you poisondeathray
Sometimes, mediainfo reports about 709, but this is not true.
What are the modern diagnostic methods for examining the color space of a video file?

poisondeathray
5th May 2021, 14:51
Sometimes, mediainfo reports about 709, but this is not true.
What are the modern diagnostic methods for examining the color space of a video file?

You run known patterns and colors such as colorbars end to end through the workflow, examine each stage

doctorkhv
8th May 2021, 07:06
I had to use not color patterns, but my own physiological vision and convert to 24 fps
https://youtu.be/UTXZSVIIk-c

doctorkhv
25th May 2021, 06:45
Hello,

I have tried applying color correction, ColorMatrix, Levels, HDRAGC, RGBAdjust, ConvertToRGB32 (). Ccd (). ACOBW (). ConvertToYV12 ()
but the result did not satisfy me. Comparison https://youtu.be/hhP49HDNgFw

Source https://www.dropbox.com/sh/x8kd1gtj2c427mz/AADG2vroZ-JLNPanPR-k3Hf2a?dl=0

What is the most correct color correction?
What is the most correct resolution?
Which script to use?

Yours faithfully,
Evgeny

patul
25th May 2021, 08:19
Well, it wont be perfect, but I think you did a great job on cleaning & stabilizing the video. Can you share the script you use for that if it's okay to you?

Probably you can try DeOldify as in this FranceBB's thread (https://forum.doom9.org/showthread.php?t=181853). I know it colorizes grayscale, but I tried several frames and I think it looked okay and worth to try.

https://i.imgur.com/tJx6aTs.jpg

doctorkhv
25th May 2021, 09:17
To stabilize video (EXR), you can use both Moka Pro and Nuke...

I wanted to colorize the video "Die Pest in Florenz" (1919) https://youtu.be/vYZZbapThk8 but DeOldify does not export EXR)

poisondeathray
25th May 2021, 18:35
Hello,

I have tried applying color correction, ColorMatrix, Levels, HDRAGC, RGBAdjust, ConvertToRGB32 (). Ccd (). ACOBW (). ConvertToYV12 ()
but the result did not satisfy me. Comparison https://youtu.be/hhP49HDNgFw

Source https://www.dropbox.com/sh/x8kd1gtj2c427mz/AADG2vroZ-JLNPanPR-k3Hf2a?dl=0

What is the most correct color correction?
What is the most correct resolution?
Which script to use?

Yours faithfully,
Evgeny


The main issue is the red channel, so adjust that separately

Often color manipulation is subjective , but some things are less subjective and critical assuming you want a more natural look (ie you're not purposefully createing a stylized grade) -

1) Shadow detail is crushed in the "after" version - I would spread the shadow tonal range, while keeping the darkest blacks for contrast. When you see a solid line in a waveform (when there wasn't one before) it indicates crushed detail problem

eg. you can see the top left detail im the glass is all "black" crushed detail, and it correlates with the "line" in the waveform
https://i.postimg.cc/Pq5r93yS/Bielefeld-1980-hh-P49-HDNg-Fw001728.png

2) Red channel is unbalanced . You can check red reference objects, like "red" woolworth letters ~1:33, red railing ~ 3:16, red flowers ~ 3:53. Adjust the red channel separately

Look at RGB histogram for source - it's all shifted to the right. The main thing you need to do is adjust the red input black level, or use red curves

Check other scenes that Red, Blue, Green reference objects look correct (check "blue" sky)

eg. I'm not saying this is perfect, but it's "less bad" , more natural, and a better starting point
https://i.postimg.cc/nL9hYd1g/5588comp.png

You can massage it to how you want for final look, but those 2 things are major issues. For most people, adjusting color in RGB is easier and more intuitive than YUV corrections.

You have total control in resolve, but these are basic manipulations that you can do in almost any program. Curves is the most powerful , because of non linear changes

doctorkhv
25th May 2021, 23:20
poisondeathray Thank you so much

My mistakes were:
1. Edits with two views, the left is the source, and the right view (my right eye) physiologically added information from the red channel of the source (my left eye)
2. I wanted to edit one scene so that it fits (identically) all scenes.