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 > NLE - Non Linear Editing

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th September 2019, 18:51   #1  |  Link
Stereodude
Registered User
 
Join Date: Dec 2002
Location: Region 0
Posts: 1,130
Avisynth+ <--> Davinci Resolve 16.

Does anyone else use Avisynth+ and Davinci Resolve 16 and try to move something back and forth between the two? Davinci Resolve of course can't open an Avisynth script. It has really poor AVI support as well. It doesn't support any of the lossless AVI codecs like HuffYUV, Lagarith, etc. Resolve also doesn't support lossless H.264.

So, my initial workaround is to use FFMPEG to export the .AVS to ProRes (not lossless) in a .mov container. Resolve will open that. Then export from Resolve into a .mov container using DNxHR since Resolve can't export ProRes. Then I can open the DNxHR .mov with LWLibavVideoSource (L-SMASH-Works) back into Avisynth+.

It works, but it's quite kludgy. It also has two lossy compression conversions, and they're different codecs.
Stereodude is offline   Reply With Quote
Old 10th September 2019, 23:20   #2  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,975
Quote:
Originally Posted by Stereodude View Post
Does anyone else use Avisynth+ and Davinci Resolve 16 and try to move something back and forth between the two? Davinci Resolve of course can't open an Avisynth script. It has really poor AVI support as well. It doesn't support any of the lossless AVI codecs like HuffYUV, Lagarith, etc. Resolve also doesn't support lossless H.264.

So, my initial workaround is to use FFMPEG to export the .AVS to ProRes (not lossless) in a .mov container. Resolve will open that. Then export from Resolve into a .mov container using DNxHR since Resolve can't export ProRes. Then I can open the DNxHR .mov with LWLibavVideoSource (L-SMASH-Works) back into Avisynth+.

It works, but it's quite kludgy. It also has two lossy compression conversions, and they're different codecs.




1) Did you need truly lossless ? Very high bitrate AVC such as x264 CRF or QP 1 intra or short GOP's is going to be 99.9% lossless, significantly higher PSNR/SSIM than Prores HQ or even Prores 4444XQ


2) Physical uncompressed AVI's still work in Resolve using v210 (10bit 422) and UYVY (UYVY) configurations


3) AVFS frameserving "fake" AVI works with YUV422P10, but only with vapoursynth , because of the enable_v210 = True switch (not available in avs+ )

RGB30 also works, also for avs+ (ConvertToPlanarRGB(matrix="XX").ConvertBits(10)
) but you might have to interpret the clip attributes as full range depending on how you have resolve project and timeline settings set up .

The command line AVFS that you need to use is a modified version and bundled with Vapoursynth. You can download the "portable" version and extract the avfs.exe to use with avisynth if you don't want to install vapoursynth


4) For exporting out, the uncompressed AVI and MOV options work
poisondeathray is offline   Reply With Quote
Old 11th September 2019, 04:42   #3  |  Link
Stereodude
Registered User
 
Join Date: Dec 2002
Location: Region 0
Posts: 1,130
I don't know that I need lossless, but I'd like to avoid unnecessary quality losses. Uncompressed UHD 10-bit files are very large hence my interest to avoid them.

I tried an x264 encode with a CRF of 1 and that opened in Resolve. I wasn't sure how the quality of that would compare to Prores or DNxHR.
Stereodude is offline   Reply With Quote
Old 11th September 2019, 06:44   #4  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,975
Quote:
Originally Posted by Stereodude View Post
I don't know that I need lossless, but I'd like to avoid unnecessary quality losses. Uncompressed UHD 10-bit files are very large hence my interest to avoid them.

I tried an x264 encode with a CRF of 1 and that opened in Resolve. I wasn't sure how the quality of that would compare to Prores or DNxHR.
--qp 1 will give you larger filesizes /less loss than --crf 1

Here is some sample data from a native UHD 10bit422 source (it's very clean, more easily compressible, you can tell from the results because ProresHQ typically scores ~ 45-55db on slightly noisy sources )

ProresHQ (ffmpeg)
591Mb/s
psnr_avg:68.73 psnr_y:67.46 psnr_u:69.74 psnr_v:71.49

x264cli --crf1 --keyint 1
356Mb/s
psnr_avg:73.20 psnr_y:70.83 psnr_u:78.08 psnr_v:79.68

x264cli --qp1 --keyint 1
512Mb/s
psnr_avg:82.08 psnr_y:79.72 psnr_u:86.44 psnr_v:89.33




x264 Intra will give you higher quality at a given bitrate, at the expense of higher seek latency compared to Prores or DNxHR or Cineform (--qp 1 will yield higher quality than even at cineform filmscan2)

But with x264 you have the option to use short GOP's to significantly reduce the filesize, while still keeping higher quality than Prores , DNxHR, Cineform .

Or you can tweak it to perform faster using fast decode options at the expense of quality, or tune it in other ways, etc..




But the resolve export side is quite limited - you don' t have access to x264 or various options. You're right - uncompressed 10bit UHD is no fun, but that's almost your only option for getting lossless material back out

A fairly common workflow people use is AAF/EDL/XML import into resolve and export that back into their editor. It's basically a type of frameserving. But avisynth/vapoursynth do not support it Maybe one day...

Another lossless import/export option that people use with resolve is EXR . It's usually used for higher end workflows. Virtually all formats (YUV, subsampling, any bitdepth, RGB) can be converted back/forth losslessly with EXR float . But you need vapoursynth because it can import/export float formats and do lossless colorspace transforms properly (avs+ currently cannot import/export float) . 16bit half float is all that is required for most sources or consumer formats. If using EXR piz compression, they are only slightly larger than typical 16bit PNG, but some types of sources are actually smaller than if using 16bit PNG (content dependent). But that's still going to be much larger than a --qp 1 encode, but smaller than uncompressed UHD 10bit422 or 420. And some people don't like using image sequences
poisondeathray is offline   Reply With Quote
Old 11th September 2019, 13:23   #5  |  Link
Stereodude
Registered User
 
Join Date: Dec 2002
Location: Region 0
Posts: 1,130
Thanks for the numbers and additional insight. What's the psnr for lossless compression / what's the theoretical maximum? Is it infinite / undefined or is there a max value?
Stereodude is offline   Reply With Quote
Old 11th September 2019, 16:03   #6  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,975
Quote:
Originally Posted by Stereodude View Post
Thanks for the numbers and additional insight. What's the psnr for lossless compression / what's the theoretical maximum? Is it infinite / undefined or is there a max value?
Yes infinity . It's a log scale

PSNR has various issues with being used as a "quality" measurement, but one thing everyone will agree on - is that it's good at testing lossless vs. not

In the higher bitrate ranges, such as with these production codecs - the "subjectively" influenced metrics are less useful . For example, VMAF wasn't even trained at those bitrates (much lower delivery bitrates), and it cannot even distinguish accurately between mathematically lossless vs. not
poisondeathray is offline   Reply With Quote
Old 11th September 2019, 18:24   #7  |  Link
Stereodude
Registered User
 
Join Date: Dec 2002
Location: Region 0
Posts: 1,130
Thanks! If only Blackmagic would add VFW support on Windows for AVI codecs.
Stereodude is offline   Reply With Quote
Old 11th September 2019, 18:55   #8  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,975
Quote:
Originally Posted by Stereodude View Post
Thanks! If only Blackmagic would add VFW support on Windows for AVI codecs.
Or, if avisynth / vapoursynth could develop a MOV wrapper / emulator / virtual file system , instead of VFW/AVI based which is largely limited to Windoze environment
poisondeathray is offline   Reply With Quote
Old 11th September 2019, 19:42   #9  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 204
Quote:
Originally Posted by poisondeathray View Post
x264 Intra will give you higher quality at a given bitrate, at the expense of higher seek latency compared to Prores or DNxHR or Cineform (--qp 1 will yield higher quality than even at cineform filmscan2)
You mean x264 long GOP instead of intra.
Cary Knoop is offline   Reply With Quote
Old 11th September 2019, 19:44   #10  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 204
Quote:
Originally Posted by poisondeathray View Post
Or, if avisynth / vapoursynth could develop a MOV wrapper / emulator / virtual file system , instead of VFW/AVI based which is largely limited to Windoze environment
Older versions of Blackmagic's Fusion had an FFmpeg calling interface, it is a shame this is not available in Resolve.
Cary Knoop is offline   Reply With Quote
Old 11th September 2019, 20:00   #11  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,975
Quote:
Originally Posted by Cary Knoop View Post
You mean x264 long GOP instead of intra.
Both, actually

It's just that Intra is usually used for intermediates / editing scenarios

And x264 intra with --tune fastdecode is still waaaaay slower on the timeline, high latencies compared to cineform, even prores
poisondeathray is offline   Reply With Quote
Old 11th September 2019, 20:08   #12  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 204
Quote:
Originally Posted by poisondeathray View Post
And x264 intra with --tune fastdecode is still waaaaay slower on the timeline, high latencies compared to cineform, even prores
Slower yes. Way slower? I suppose is a matter of interpretation.
Isn't CABAC the main slowdown here?
Cary Knoop is offline   Reply With Quote
Old 11th September 2019, 20:27   #13  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,975
Quote:
Originally Posted by Cary Knoop View Post
Slower yes. Way slower? I suppose is a matter of interpretation.
Isn't CABAC the main slowdown here?
Substantially slower; you can "feel" it in all editors, just scrub the timeline on some UHD footage . Enough to not like editing it if there weren't other reasons to use it

Yes, CABAC

The factors affecting AVC decoding speed list is here
https://forum.doom9.org/showthread.p...824#post961824
poisondeathray is offline   Reply With Quote
Old 11th September 2019, 20:34   #14  |  Link
Atak_Snajpera
RipBot264 author
 
Atak_Snajpera's Avatar
 
Join Date: May 2006
Location: Poland
Posts: 7,161
Quote:
Originally Posted by Cary Knoop View Post
Slower yes. Way slower? I suppose is a matter of interpretation.
Isn't CABAC the main slowdown here?
Yes. CABAC is a lot slower than CAVLC. I use --crf 10 --preset superfast --fastdecode --keint 1 and I do not see any problems with decoding speed in NLE.
Atak_Snajpera is online now   Reply With Quote
Old 11th September 2019, 20:59   #15  |  Link
Stereodude
Registered User
 
Join Date: Dec 2002
Location: Region 0
Posts: 1,130
Isn't setting the Keyint = 1 going to give you an all I frame H.264 file which should decode very easily / quickly?

Is Cineform set to Best the highest quality lossy output from Resolve 16? I saw some mentions around the web that Cineform is better than Pro-res and DNxHR in terms of PNSR.

Last edited by Stereodude; 11th September 2019 at 21:02.
Stereodude is offline   Reply With Quote
Old 11th September 2019, 21:09   #16  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 204
Quote:
Originally Posted by Stereodude View Post
Isn't setting the Keyint = 1 going to give you an all I frame H.264 file which should decode very easily / quickly?
Yes, much faster than using long GOP but still not as fast as ProRes, DNxHR and Cineform.

Quote:
Originally Posted by Stereodude View Post
I saw some mentions around the web that Cineform is better than Pro-res and DNxHR in terms of PNSR.
I would say it is fractionally better but not significantly.

On the web there are claims that Cineform is more than twice as efficient as ProRes, obviously, that is nonsense but then many other things that are claimed "around the web" are nonesense.
Cary Knoop is offline   Reply With Quote
Old 12th September 2019, 02:32   #17  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,975
Quote:
Originally Posted by Stereodude View Post
Resolve also doesn't support lossless H.264.

Just double checking this...

x264 1920x1080p24 10bit422 --qp 0 imports into Resolve here . Checking the export uncompressed (video levels, retain subblack, superwhite checked in the export settings) shows no diff (my test clip was normal range, but had superdarks/brights, they are retained)






PSNR wise cineform , dnxhd/dnxhr , prores - they are quite close at similar bitrates, some score slightly higher on certain types of content, slighly lower on others . If anything, subjectively there is a tendency towards cineform being slightly more cleaner (wavelet based) , but prores and DNxHD being slightly more noisy (dct based). Prores typically scores slighly higher than DNxHD in objective measurements (no, it's not just Apple marketing, I've confirmed it many times) .


On Windows, cineform decodes the fastest out of those . On Mac, prores . It might partially depend on the software/hardware setup you are using too - some editors use GPU assisted decoding for AVC , and for some operations (like scaling for display)

Absolute fastest editing codec by a long shot is the GPU powered Cinegy Daniel2 . You can edit 8K natively on a laptop with a consumer GPU.

But there are other workflows you can argue that are better in certain situations than using full resolution intermediates - such as proxy editing





I like x264 , because it's highly configurable to whatever situation you need . PP is one of the few commercial editors that accepts x264 lossless and treats it correctly as lossless YUV (many programs convert YUV "lossless" codecs to RGB; so they are not actually "lossless" in that program) . I have no problems with x264 per se....but it could decode faster. My only gripe. You can feel the sluggishness with higher resolutions, multiple layers (even with fastdecode, I-frame) . Note once you start tuning x264 to decoding faster, the compression advantage becomes lower. It's a trade off like everything in video compression

Another thing I like about x264, is it's minimum quality level. People don't talk about this often. But for me, I'd rather have a certain minimum level of quality , than some high average, or some sections that are very high. Here is an old comparison (you can tell by era of the graphics LOL) , 1080p24 8bit source, but notice the drop in quality near the end section which was difficult to compress / high content complexity. IIRC x264 was constrained VBR with fastdecode. I've done many of these tests and this is representative of these codecs behaviours.

https://i.postimg.cc/vmgtgK25/PSNR-Y-1080.png

Some naysayers in the Mac camp said "oh it's "hacked" ffmpeg prores, not certified." But I did many tests with certifed prores too, and guess what - ffmpeg prores always scores higher. Not a single test shows certified prores produces higher quality when accounting for bitrate differences.

It should be mentioned in the past, Resolve had serious issues with the ffmpeg prores flavour. Things like black and corrupted frames, seemingly random. And not just Resolve either, but Resolve was especially picky. The ffmbc prores variant had far fewer issues. And certified prores no issues at all - rock stable.
poisondeathray is offline   Reply With Quote
Old 12th September 2019, 04:37   #18  |  Link
Stereodude
Registered User
 
Join Date: Dec 2002
Location: Region 0
Posts: 1,130
Quote:
Originally Posted by poisondeathray View Post
Just double checking this...

x264 1920x1080p24 10bit422 --qp 0 imports into Resolve here . Checking the export uncompressed (video levels, retain subblack, superwhite checked in the export settings) shows no diff (my test clip was normal range, but had superdarks/brights, they are retained)
I exported a UHD clip using VD2 and picked the lossless 8-bit x264 setting into either .mp4 or .mov and resolve didn't recognize it. I think I also tried a crf 0 encode that I did from the command line as well with no success.

I found some discussion on the blackmagic forum complaining that lossless x264 wasn't supported as well.
Stereodude is offline   Reply With Quote
Old 12th September 2019, 05:19   #19  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,975
Quote:
Originally Posted by Stereodude View Post
I exported a UHD clip using VD2 and picked the lossless 8-bit x264 setting into either .mp4 or .mov and resolve didn't recognize it. I think I also tried a crf 0 encode that I did from the command line as well with no success.

I found some discussion on the blackmagic forum complaining that lossless x264 wasn't supported as well.


LOL "Not recognizing some video" is something people are very used to in Resolve. Very picky

- x264 lossless 8bit 4:2:0 , 10bit 4:2:0, 10bit 4:2:2, they all import
- tried some older archived lossless encodes from old x264 versions, they import too
- could it be resolution related? Nope , UHD imports too.
- tried re-encoding some videos with vdub2 , x264 8bit lossless mp4 with or without faststart , both work

But I've only verified so far that 10bit 4:2:2 is lossless in/out, partly because 4:2:2 is what the uncompressed export option is (You can do 4:2:0 => 4:2:2 => 4:2:0 losslessly in avisynth when using pointresize, but you have to account for the chroma shift)

Not sure what's going on . I should mention I'm on Resolve 15 still, because I'm in the middle of few projects, and I never upgrade in the middle of something
poisondeathray is offline   Reply With Quote
Old 12th September 2019, 05:21   #20  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 204
Only Resolve Studio supports H.264 4:2:2 10 bit.
Cary Knoop is offline   Reply With Quote
Reply

Tags
avisynth, resolve

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 08:32.


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