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:05 | #4 | 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:32 | #5 | 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 | #6 | 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, 18:00 | #7 | 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, 21:57 | #8 | Link | |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
Quote:
|
|
18th April 2019, 17:00 | #9 | Link | |||
Registered User
Join Date: Sep 2007
Posts: 5,433
|
Quote:
matrix_in_s="170m", matrix_s="709" Quote:
Quote:
|
|||
18th April 2019, 17:18 | #10 | 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 | #11 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,433
|
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: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:02 | #13 | Link | |||
Registered User
Join Date: Sep 2007
Posts: 5,433
|
Quote:
In general SD is 601, HD is 709 Quote:
Quote:
|
|||
18th April 2019, 23:26 | #14 | Link | |
Registered User
Join Date: Apr 2019
Posts: 17
|
Quote:
The aspect ratio is incorrect, and the video looks off. AVI input file to VapourSynth: Code:
Width : 720 pixels Height : 480 pixels Pixel aspect ratio : 0.889 Code:
Width : 720 pixels Height : 480 pixels Pixel aspect ratio : 1.000 To correct this, I've updated my ffmpeg command with "setsar=sar=8/9,setdar=dar=4/3" as follows.. Did I do this correctly?! Code:
vspipe --y4m ./Deinterlace.py -a "INVID=$INVID" - | ffmpeg -nostdin -i pipe: -i "$INVID" -pix_fmt yuv422p -c:v libx264 -crf 0 -tune fastdecode -x264opts keyint=1 -c:a copy -map 0:0 -map 1:1 -vf setsar=sar=8/9,setdar=dar=4/3 "$OUTVID" Code:
Width : 720 pixels Height : 480 pixels Pixel aspect ratio : 0.889 |
|
19th April 2019, 00:51 | #15 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,433
|
Quote:
Without getting into a lengthy AR interpretation discussion, that's one way of getting 4:3 DAR . Typically I only set the SAR, because setting the DAR will only give you non ITU aspect ratio options But for analog sources like VHS, technically the SAR is actually 10:11 . DV too. And those are what you are using according to the 1st post. The central portion or active image area is 702 width (rounded to 704), and pillar boxed You can verify with some objects, such as a round clock or car tire shot straight on. 99% of the time 10:11 will give you the perfect circle, but 8:9 will give you slightly oval. It also depends on the lineage and what steps or types of transfers were done inbetween. It also depends on the software, you might have to interpret the AR in some software, but resolve can distinguish between the two (at least with the SAR flag) It's the same with upscaling to HD . The AR will be slightly off if you use the wrong AR interpretation. (But many people don't care about tiny AR error . I guess it depends on how picky you are, or if driving on "oval" tires is ok ) |
|
18th April 2019, 18:02 | #16 | 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, 19:04 | #17 | Link | |
Cary Knoop
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 398
|
Quote:
The resize command: Code:
clip = core.resize.Bicubic(clip, format=vs.YUV422P8, matrix_in_s="170m", matrix_s="709") |
|
18th April 2019, 17:08 | #18 | Link |
Registered User
Join Date: Dec 2005
Location: Germany
Posts: 1,807
|
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. |
Tags |
deinterlace, qtgmc, resize, resolve, vapoursynth |
Thread Tools | Search this Thread |
Display Modes | |
|
|