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. |
18th April 2019, 03:57 | #1 | Link |
Registered User
Join Date: Apr 2019
Posts: 17
|
Workflow from VapourSynth to DaVinci Resolve
Hello -
I'm working on an archival/ restoration project. I have a ton of MiniDV and VHS which I've captured to my PC via FireWire (60 hours approx). The video is all BFF interlaced, 720x480, 30000/1001 fps, yuv411 8bit dvsd in AVI. These are home videos shot with poor lighting, incorrect white balance, hand-held, etc., so I'd like to do some color correction and stabilization to make them more enjoyable to watch on a modern TV or mobile device. All playback will be done by a PC/ mobile device. I own Davinci Resolve, which I plan to use for editing, color grading, stabilizing, and so on, but the deinterlacing and scaling in Resolve compares poorly to what I've seen with VapourSynth. Here's what I'm thinking I'll do to deinterlace and resize the video. I'm looking for feedback on this, as I'm very new to this stuff. Code:
#!/usr/bin/env python # import the needed modules import vapoursynth as vs import havsfunc as haf import edi_rpow2 as edi core = vs.get_core() # read the clip, it's passed as a param named "INVID" by vspipe clip = core.ffms2.Source(source=INVID) # I believe this converts the clip colorspace from yuv411 to yuv420, at 8 bit depth, as required for QTGMC. clip = core.fmtc.resample (clip=clip, css="420") clip = core.fmtc.bitdepth (clip=clip, bits=8) # Use QTGMC to deinterlace - Are these good settings for my use-case?? These are your standard "home video" types of videos clip = haf.QTGMC(clip, Preset='Slower', TFF=False) # Use nnedi3_rpow2 to scale 2x # from 720x480 to 1440x960 clip = edi.nnedi3_rpow2(clip=clip, rfactor=2) # I believe this resizes to 1440x1080, with 4:3 DAR, with yuv422p8 colorspace and 709 color matrix. This part is way over my head, and I'd appreciate feedback # Also, I'm scaling from 1440x960 to 1440x1080. Is this distorting my image (stretching its height)? Or is this compensating for 4:3 pixel AR, because I gather it's being output in a 1:1 pixel AR now? I'm lost on this one. clip = core.resize.Spline36(clip, 1440, 1080, format=vs.YUV422P8, matrix_in_s='709') clip.set_output() As far as where this is being sent next, it's ffmpeg to encode into x264, crf 10, veryslow, as follows. Code:
vspipe --y4m ./DeinterlaceAndScale.py -a "INVID=$INVID" - | ffmpeg -nostdin -i pipe: -i "$INVID" -pix_fmt yuv422p -c:v libx264 -preset veryslow -crf 10 -tune fastdecode -x264opts keyint=1 -c:a copy -map 0:0 -map 1:1 "$OUTVID" From DaVinci Resolve, I'll output likely dnxhr-sq for archival, and x264 CRF 20 for posting to Youtube, using on Plex, and so on. I'd love some expert feedback on this workflow. Am I doing anything obviously wrong? Thanks |
18th April 2019, 04:37 | #2 | Link |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
You can mount your script into a fake avi using avfs.exe in your plugin folder. There's a avfs program in your vapoursynth/core64 path, just drag and drop your script into the program and it's mount it. The mount point will be C:\volume if you're using Windows.
|
18th April 2019, 15:59 | #3 | Link | |
Registered User
Join Date: Apr 2019
Posts: 17
|
Quote:
Any suggestions around the processing steps I'm applying to the SD video? Thanks! |
|
18th April 2019, 17:00 | #4 | Link | |||
Registered User
Join Date: Sep 2007
Posts: 5,435
|
Quote:
matrix_in_s="170m", matrix_s="709" Quote:
Quote:
|
|||
18th April 2019, 17:05 | #5 | Link |
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
Does this actually work with Resolve ? Resolve has native support for import and export of a very limited range of VFW codecs (Cineform, Grass Valley, Uncompressed) and tends to be very picky about the AVI formatting - won't import uncompressed 4:2:0 in any form and you need the licensed (paid) Studio version to import lossless x264 (Hi444Pred). No ffmpeg support either, although that has oft been requested.
__________________
Nostalgia's not what it used to be Last edited by WorBry; 18th April 2019 at 17:12. |
18th April 2019, 17:08 | #6 | Link |
Registered User
Join Date: Dec 2005
Location: Germany
Posts: 1,809
|
As far as I know CRF 0 is NOT lossless, only -q 0 is!
I always used a fast or faster preset and --tune fastdecode + mp4 for my lossess encodes. (you need to remux a mkv produced by x264 as it doesn't have a proper index --> seeking means read the whole file then)
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth VapourSynth Portable FATPACK || VapourSynth Database Last edited by ChaosKing; 18th April 2019 at 17:10. |
18th April 2019, 17:13 | #7 | Link |
Registered User
Join Date: May 2011
Posts: 336
|
QTGMC can work with 422, so there can be just one color space conversion:
Code:
clip = core.ffms2.Source(source=INVID) clip = core.resize.Bicubic(clip, format=vs.YUV422P8, matrix_in_s="170m", matrix_s="709") clip = haf.QTGMC(clip, Preset='Medium', TFF=False) clip = edi.nnedi3_rpow2(clip=clip, rfactor=2) clip = core.resize.Spline36(clip, 1440, 1080) clip.set_output() |
18th April 2019, 17:18 | #8 | Link | |
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
Quote:
Resolve does support field processing (free and Studio version) but applies title and transition macros as progressive frame. The Studio version supports in-program deinterlacing and its single-rate (same field) only.
__________________
Nostalgia's not what it used to be Last edited by WorBry; 18th April 2019 at 17:28. |
|
18th April 2019, 17:29 | #9 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,435
|
Quote:
Pros / cons either way But if he's complaining about filesizes , CRF 10 SD will consume less disk space, process faster, edit faster, compared to 1440x1080 Also, depending on the project, a lot of footage is cut out. It's a waste of disk space, time, QTGMCing, upscaling stuff that is going to be cut out anyways It might not matter much for DV/ VHS , but there are some decent , newer upscale methods on the horizon . NNEDI3 is a neural net trained (you can call it "AI") by tritical, but there are newer neural net scalers being developed. I wouldn't want to "lock" the coarse NNEDI3 method into the upscale at this point |
|
18th April 2019, 17:32 | #10 | Link | |
Cary Knoop
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 398
|
Quote:
Link to the BM forum thread: https://forum.blackmagicdesign.com/v...p?f=21&t=88796 |
|
18th April 2019, 17:39 | #11 | Link |
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
Yes, t'was I who gave the sagely, but redundant advice about preserving interlace fields if he intends to re-interlace...which he doesn't.
Resolve does also support native DV import but again tends to be picky about the AVI format (doesn't like Sony's) - may have to remux to MOV. No DV export though.
__________________
Nostalgia's not what it used to be Last edited by WorBry; 18th April 2019 at 17:49. |
18th April 2019, 17:53 | #12 | Link | |
Registered User
Join Date: Apr 2019
Posts: 17
|
My script is very heavily based on this post in Andrew's blog.
Like in his post, my input video is SD DV, yuv411 and 601 color matrix, so I just went with his approach. Much of this stuff is well over my head! Do the processing steps prior to that final resize affect the color matrix? Is there a way for VapourSynth to tell me the color matrix before and after a processing step? Quote:
Interesting idea! You mention bob deinterlacing. QTGMC produces such nice deinterlaced output, is there a reason I'd not want to use QTGMC? |
|
18th April 2019, 18:00 | #13 | Link | |
Registered User
Join Date: Apr 2019
Posts: 17
|
Quote:
I do have a paid-for Resolve Studio to work with, but its deinterlacing is not nearly as nice as QTGMC (to my untrained eye). Resolve does not like the AVI I'm working with (Sony MiniDV camcorder to PC via FireWire, using WinDV to create AVI), but seems to work fine in Resolve after I remux into MOV as you describe. |
|
18th April 2019, 18:02 | #14 | Link | |||
Registered User
Join Date: Sep 2007
Posts: 5,435
|
Quote:
In general SD is 601, HD is 709 Quote:
Quote:
|
|||
18th April 2019, 18:02 | #15 | Link | ||
Cary Knoop
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 398
|
Quote:
Quote:
QTGMC is way better than bob deinterlacing. Edited to add: poisondeathray made already clear he meant bob deinterlacing as part of QTGMC. Last edited by Cary Knoop; 18th April 2019 at 18:04. |
||
18th April 2019, 18:19 | #17 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,435
|
For vpy avfs mounting, resolve will accept 10bit422 with the v210 flag (enable_v210 = True)
But not a good idea IMO when you have many clips or larger project. Way too much trouble, way too slow in terms of overhead Not sure about other pixel formats in the v16 beta . |
18th April 2019, 18:27 | #19 | Link | |
Registered User
Join Date: Apr 2019
Posts: 17
|
Quote:
Code:
Size MB File PSNR 32007 MiniDV-47.SHORT.yuv NA 6621 MiniDV-47.SHORT.x264.crf0.veryslow.mov PSNR y:inf u:inf v:inf average:inf min:inf max:inf 4083 MiniDV-47.SHORT.x264.crf1.veryslow.mov PSNR y:53.512392 u:61.432235 v:60.652085 average:55.813724 min:53.405067 max:67.970034 3284 MiniDV-47.SHORT.x264.crf3.veryslow.mov PSNR y:51.757858 u:60.172675 v:59.398284 average:54.130656 min:51.885540 max:67.841050 2081 MiniDV-47.SHORT.x264.crf7.veryslow.mov PSNR y:48.699226 u:57.827356 v:57.149576 average:51.168932 min:48.984561 max:63.049205 1510 MiniDV-47.SHORT.x264.crf10.veryslow.mov PSNR y:46.652977 u:56.481528 v:55.907612 average:49.204670 min:46.846824 max:58.420081 1254 MiniDV-47.SHORT.x264.crf12.veryslow.mov PSNR y:45.362313 u:55.802922 v:55.325697 average:47.976095 min:45.501538 max:56.102836 957 MiniDV-47.SHORT.x264.crf15.veryslow.mov PSNR y:43.455688 u:54.798423 v:54.447722 average:46.145881 min:43.542113 max:53.632696 47 MiniDV-47.SHORT.x264.crf28.mov PSNR y:29.511193 u:46.680560 v:48.086853 average:32.450267 min:15.007240 max:41.752188 7104 MiniDV-47.SHORT.dnxhrhq.mov PSNR y:53.555803 u:61.071902 v:60.056131 average:55.772436 min:55.019938 max:56.028969 4701 MiniDV-47.SHORT.dnxhrsq.mov PSNR y:52.896759 u:60.668225 v:59.693643 average:55.158653 min:54.212876 max:55.469476 1498 MiniDV-47.SHORT.dnxhrlb.mov PSNR y:45.928688 u:56.024373 v:55.573581 average:48.512562 min:44.856081 max:51.501520 |
|
Tags |
deinterlace, qtgmc, resize, resolve, vapoursynth |
Thread Tools | Search this Thread |
Display Modes | |
|
|