Hello,
anyone knows how to deinterlace this video properly with Handbrake and encode to progressive H.264 with no visible generation loss ? Will the proper result FPS be 25 or 50 ?
The source is a 1988 PAL 25fps VHS animation, converted 15 years ago with pioneer VCR to VR_MOVIE.VRO and VR_MANGR.IFO files.
I used MPEG Streamclip (no re-encoding) only to fix the timestamps (was an incorrect 19min 26secs duration, real duration is 4h 23mins) and to produce this clip:
Sample video: https://fastupload.io/Ncn4EKtM0Dks5eW/file
Mediainfo:
Code:Format : MPEG-PS ID : 224 (0xE0) Format : MPEG Video Format version : Version 2 Format profile : Main@Main Format settings : CustomMatrix / BVOP Format settings, BVOP : Yes Format settings, Matrix : Custom Format settings, GOP : Variable Format settings, picture structure : Frame Duration : 12 s 880 ms Bit rate mode : Variable Bit rate : 1 949 kb/s Maximum bit rate : 9 400 kb/s Width : 352 pixels Height : 576 pixels Display aspect ratio : 4:3 Frame rate : 25.000 FPS Standard : PAL Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Interlaced Scan order : Top Field First Compression mode : Lossy Bits/(Pixel*Frame) : 0.385 Time code of first frame : 00:27:21:03 Time code source : Group of pictures header GOP, Open/Closed : Open Stream size : 2.99 MiB (86%) Color primaries : BT.601 PAL Transfer characteristics : BT.470 System B/G Matrix coefficients : BT.470 System B/G
+ Reply to Thread
Results 1 to 25 of 25
-
Last edited by Danic; 14th Jul 2023 at 19:05.
-
Hello!
I am not familiar with Handbrake, but the way I do it is using VirtualDub. I open the video in VirtualDub, then go to Video-->Filters and select Smart Deinterlace by Donald Graft. I select Frame and Filed differencing and also Cubic Interpolate. These give the best results fom most cases. If you don't have this filter, you can select the internal Deinterlace filter included with VirtualDub. Select Blend fields and Keep top field for good results. After that you can choose the Resize filter. I know the video is already 720x576, but selecting this filter allows you to then crop any black margins around the image and also the tracking noise at the bottom of the image. So in Resize filter set 720x576, New size absolute and Ascpect ratio disabled. These settings will ensure the picture size remains 720x576 after cropping. Now you can select Cropping and crop and unwanted black margins plus the tracking noise at the bottom. You can then pick a Compression, such as x264vfw (for original VirtualDub) or x264 8-bit (for VirtualDub2). For audio I usually select AC3 ACM codec and set a bitrate of 192Kbit which is adequate and leaves bandwidth for higher video bitrate (important if you want to fit a movie on DVD).
If you don't have these codecs you can download them or download K-Lite codec pack which has them all. Make sure you enable VFW codecs from settings after installation if you want to use the original VirtualDub.
TIP: x264 (h.264) gives better image for the same bitrate as Divx (h.263). In Divx a variable bitrate (VBR) of about 1000Kbps (1Mbps) was good. So in x264 you can use 1000Kpbs for SD content. If I need to create a master with all processing from VirtualDub for conveting to another format, or for archiving a video, I use 2500Kbps just in case. Anything higher should not make any perceptible difference. Also AVI files with x264vfw video and AC3 audio are compatible with AVCHD and can be used in MultiAVCHD to create BD-R discs or AVCHD-DVD disks without re-enconding.Last edited by spapakons; 14th Jul 2023 at 02:41.
-
anyone knows how to deinterlace this video properly
-
If you see the video data in the first post you will see it is interlaced. Otherwise why asking? I tried handbrake but I find it too limited in features and it outputs only in MKV and MP4. One good point is it can add subtitles to the file, but it is not that important if your device can use SRT subtitles. I prefer SRT subtitles so text always appears nice and sharp even for low resolution videos such as 320x240.
TIP: Some applications (such as MultiAVCHD) don't interpret non-Latin characters (such as Greek) correctly if the SRT is saved as UTF8. In that case open the SRT file in Notepad and Save as changing to ANSI before saving. -
If you see the video data in the first post you will see it is interlaced.
-
No, it is progressive video as lollo said.
It was just encoded and flagged as interlaced, probably to make it DVD (half D1) standards compliant. That's why tools report it as interlaced. But the video is actually progressive as the 2 fields of a frame are from the same instant in time, means there is no motion between the even and odd field. -
The original video has interlacing lines so it needs deinterlacing, I got good results with the following settings:
Dimensions tab: crop bottom 8 pixels, right 4 pixels
Video tab: H.264 NVEnc, CQ 18, Framerate 25FPS, Encoder Preset Slowest, Encoder Profile Auto, Encoder Level Auto
Filters tab: Interlace detection default, Deinterlace: Yadif Default
Audio tab: Audio AC3 passthrough (no loss).
Any improvement suggestions ?Last edited by Danic; 14th Jul 2023 at 10:35.
-
Any improvement suggestions ?
Eventually use QTGMC in single frame rate mode to fix problems in the progressive source.
Edit: QTGMC(inputType=1/2/3, …)Last edited by lollo; 14th Jul 2023 at 11:21.
-
Thank you, I applied your settings:
https://fastupload.io/QIZ8VcfufyMxZ3S/file
Here's the Handbrake H.264 (Nvenc) encoding with yadif & CQ18:
https://fastupload.io/yP1XsxFM7hLKBge/file
Which encode looks better to you? -
I tried this guide:
https://forum.videohelp.com/threads/401770-Quick-simple-guide-to-QTGMC-deinterlacing-%...for-newbies%29
Output: https://fastupload.io/XrjWmLpijUSr6gV/file
Not sure if the original file has correct aspect ratio, or should it be converted to 4:3 (like in the vdub & handbrake output files of my previous post) ?
With hybrid I don't know how to convert to 4:3 properly (I guess input PAR must be changed to something from the default 2134x1000), I used these settings:
[Attachment 72411 - Click to enlarge]Last edited by Danic; 14th Jul 2023 at 15:04.
-
I do not use Hybrid, I can't help. Selur will probably give you some good indications. if he's reading.
Your processed files has artifacts, you should read http://avisynth.nl/index.php/QTGMC, in particular chapter "Progressive Input" and find the best settings for your source.
On the other hand, the jagged lines are better corrected by QTGMC compared to your Vdub attempt. Try also to reduce its denoise effect, because the output is smoothed:
https://imgsli.com/MTkxODE3 -
That artifact is fixed if I check the "overwrite input scan type to: progressive" checkbox in Hybrid.
But then interlacing(?) artifacts are seen in other frames:
https://imgsli.com/MTkxODI1
Also Hybrid encoding crashes if I add anything to the "Addition:" line:
[Attachment 72418 - Click to enlarge]Last edited by Danic; 14th Jul 2023 at 17:34.
-
With the following settings the result is pretty good, no more artifacts and no more interlacing lines either in any frame:
[Attachment 72421 - Click to enlarge]
Video: https://fastupload.io/cgCt5MZaCB2YfmI/fileLast edited by Danic; 14th Jul 2023 at 18:06.
-
Even better with "Source matching: 2x refined" and "Lossless: after temporal smoothing" selected in QTGMC custom mode, also x264 2pass changed to 1-pass constant rate factor 19:
https://fastupload.io/PPPqzlg5ek9tPEu/file -
The video isn't interlaced. The comb artifacts are from horizontal time base errors. Sample attached with no deinterlacing, just some cleaning...
-
Last edited by Danic; 14th Jul 2023 at 19:24.
-
I wasn't sure of you would like it or not. Obviously, you can go higher or lower filter settings.
Code:Mpeg2Source("VR_MOVIE_clip.d2v", CPU2="ooooxx", Info=3) # for the deringing filter vInverse() # may not be needed Dehalo_alpha(rx=2.0, ry=2.0) MCTemporalDenoise(settings="high") TurnRight().nnedi3(dh=true).TurnLeft() aWarpSharp2(depth=5) Sharpen(0.5, 0.3) # maybe CAS instead prefetch(16)
-
Thank you,
haven't used avisynth scripts before, took me an hour to install 30+ plugins to get the script to load the video in mpc-hc.
Any reason to use cpu2 for deringing without deblocking? cpu2 can be only used with 32-bit avisynth.
Also, how to properly resize (assuming the original 4:3 width is correct) ?
I tried the following but the output is too narrow (near 5:4 instead of the original 4:3):
Code:Crop(0, 0, -4, -10).Spline16Resize(720,576)
Last edited by Danic; 14th Jul 2023 at 22:46.
-
Mpeg2source's deblocking is a little too strong and blurs details. Of course the deringing filter sometimes removes some details too. I had forgotten that those filters don't work in the 64 bit version. Thanks for reminding me. I use an old batch file to run DGIndex and create a basic script -- and that batch file adds the CPU2 options.
-
Yeah if there's 64-bit alternative for cpu2, would be cool. Now gotta use 32bit ffmpeg.
This is what the megui avisynth script creator gave when selecting 4:3 as the input display aspect ratio and cropping 4 pixels at right and 10 at the bottom:
Code:global MeGUI_darx = 85 global MeGUI_dary = 63 Import("jagabo.avs") crop(0, 0, -4, -10) Spline64Resize(696,560) # Changed from Megui's default LanczosResize
Seems good to me ?Last edited by Danic; 15th Jul 2023 at 00:00.
-
As alternative to what master jagabo proposed in his usual excellent way, you can give a try to DeblockPP7:
Code:# cropping crop_left=2 crop_top=0 crop_right=6 crop_bottom=8 video_org_crop=video_org.crop(crop_left,crop_top,-crop_right,-crop_bottom,align=true) deblocked=video_org_crop.DeblockPP7() dehalohed=deblocked.Dehalo_alpha(rx=2,ry=2,darkstr=0.0,brightstr=1.2,lowsens=150,highsens=500) denoised=dehalohed.TemporalDegrain2(degrainTR=3) sharpened=denoised.LSFmod(defaults="slow") restored=sharpened.addborders(crop_left,crop_top,crop_right,crop_bottom) return(restored)
Code:ffmpeg.exe -i ty.avs -c:v libx264 -crf 17 -preset slow -aspect 4:3 -c:a aac -b:a 128k ty.mp4
Comparison: https://imgsli.com/MTkxOTMz (dehaloing is less effective in 2nd script)
Be careful that both scripts soften a lot the original backgrounds,
https://imgsli.com/MTkxOTI5
so play with the parameters of the filters, trying to find the best compromize (i.e. temporal radius of the denoiser limited to just 1 frame)
Concerning the crop/resize, in general I do not use it, to do not alter the proportion (you should always calculate exact numbers), but that's your choice and preference -
Classic AviSynth 2.60 32-bit filters
-
Felt like the greatest project in human history but finally got it done.. total time spent 15 hours+ with avisynth & ffmpeg learning, plugin issues, 32-bit vs 64-bit issues, video crop & resize issues, video/audio sync issues, file type and codec problems etc...
Thank you all for your great advice !
FYI: RTX Video Super Resolution (VSR) AI upscaling further increases video quality during playback in MPC-BE/MPC-HC with this one:
https://github.com/emoose/VideoRenderer/releases
Comparison of RTX VSR on/off: https://imgsli.com/MTkyMDg5Last edited by Danic; 15th Jul 2023 at 23:43.
Similar Threads
-
Trying to Deinterlace VHS, Hybrid says it’s BFF, MeGUI says it’s TFF
By macramore in forum Video ConversionReplies: 9Last Post: 23rd Aug 2023, 12:31 -
Deinterlace or not?
By leed17 in forum Newbie / General discussionsReplies: 5Last Post: 30th Sep 2022, 17:42 -
deinterlace help
By maudit in forum Newbie / General discussionsReplies: 7Last Post: 13th May 2022, 22:40 -
deinterlace nightmare
By maudit in forum Newbie / General discussionsReplies: 3Last Post: 13th May 2022, 20:53 -
Dual VHS/VHS-C VCRs to play VHS-C tapes wthout adapter
By Bsmarado in forum RestorationReplies: 7Last Post: 18th Mar 2021, 05:04