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 April 2021, 00:53   #1  |  Link
doctorkhv
Registered User
 
Join Date: Mar 2019
Posts: 48
Export to format OpenEXR or DPX

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.
doctorkhv is offline   Reply With Quote
Old 29th April 2021, 01:36   #2  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by doctorkhv View Post
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

Code:
#source filter for MP4

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

The ffmpeg part would look something like this

Code:
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

Last edited by poisondeathray; 29th April 2021 at 01:40.
poisondeathray is offline   Reply With Quote
Old 29th April 2021, 01:59   #3  |  Link
patul
Registered User
 
Join Date: Sep 2005
Posts: 130
@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

Code:
ColorBars()

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

Last edited by patul; 29th April 2021 at 02:03.
patul is offline   Reply With Quote
Old 29th April 2021, 02:00   #4  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
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.

Last edited by FranceBB; 29th April 2021 at 02:10.
FranceBB is offline   Reply With Quote
Old 29th April 2021, 02:24   #5  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by patul View Post
@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

Code:
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
poisondeathray is offline   Reply With Quote
Old 29th April 2021, 11:20   #6  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
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.
Dogway is offline   Reply With Quote
Old 29th April 2021, 14:56   #7  |  Link
Frank62
Registered User
 
Join Date: Mar 2017
Location: Germany
Posts: 234
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.
Frank62 is offline   Reply With Quote
Old 2nd May 2021, 23:38   #8  |  Link
doctorkhv
Registered User
 
Join Date: Mar 2019
Posts: 48
Thank you Frank62
Thank you Dogway
Thank you poisondeathray
Thank you FranceBB
Thank you patul
doctorkhv is offline   Reply With Quote
Old 5th May 2021, 05:34   #9  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
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

Code:
ffmpeg -i input.avs -vf zscale=matrixin=709:transferin=iec61966-2-1:transfer=linear,format=gbrpf32le -compression zip16 -start_number 0 out_%06d.exr
poisondeathray is offline   Reply With Quote
Old 5th May 2021, 12:47   #10  |  Link
doctorkhv
Registered User
 
Join Date: Mar 2019
Posts: 48
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?
doctorkhv is offline   Reply With Quote
Old 5th May 2021, 14:51   #11  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by doctorkhv View Post
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
poisondeathray is offline   Reply With Quote
Old 8th May 2021, 07:06   #12  |  Link
doctorkhv
Registered User
 
Join Date: Mar 2019
Posts: 48
I had to use not color patterns, but my own physiological vision and convert to 24 fps
https://youtu.be/UTXZSVIIk-c
doctorkhv is offline   Reply With Quote
Old 25th May 2021, 06:45   #13  |  Link
doctorkhv
Registered User
 
Join Date: Mar 2019
Posts: 48
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/x8kd1gtj2...PR-k3Hf2a?dl=0

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

Yours faithfully,
Evgeny
doctorkhv is offline   Reply With Quote
Old 25th May 2021, 08:19   #14  |  Link
patul
Registered User
 
Join Date: Sep 2005
Posts: 130
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. I know it colorizes grayscale, but I tried several frames and I think it looked okay and worth to try.

patul is offline   Reply With Quote
Old 25th May 2021, 09:17   #15  |  Link
doctorkhv
Registered User
 
Join Date: Mar 2019
Posts: 48
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)
doctorkhv is offline   Reply With Quote
Old 25th May 2021, 18:35   #16  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by doctorkhv View Post
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/x8kd1gtj2...PR-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/Bielef...g-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
poisondeathray is offline   Reply With Quote
Old 25th May 2021, 23:20   #17  |  Link
doctorkhv
Registered User
 
Join Date: Mar 2019
Posts: 48
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.
doctorkhv is offline   Reply With Quote
Reply

Tags
avisynth, dpx, openexr

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 16:14.


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