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 1st February 2022, 12:44   #1  |  Link
Mitra
Registered User
 
Join Date: Mar 2021
Posts: 31
How to blend video frames and place them between mainframes

I have an interlaced video stream and need blend video frames and place them between mainframes like this :

Code:
 Input frames:  [1]             [2]             [3]  .....>  FPS=25   
                 |  \         /  |  \         /  |
                 |   \       /   |   \       /   |
Output frames:  [1]  [Bl(1,2)]  [2]  [Bl(2,3)]  [3]  .....>  FPS=50
Please tell me how to do this?
Mitra is offline   Reply With Quote
Old 1st February 2022, 14:56   #2  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 517
If you create blends of interlaced field-based frames it will blend 4 phases of motion into single frame. Do you want to keep output FPS=50 interlaced ?

With 2 input frames (1st frame = field1+field2, 2nd frame = field3+field4) simple 2D full-height blending will create interlaced frame with field1+3, field2+4 fields. May be you need first to make deinterlacing to make 25fps frame-based stream ?

If you need simply more smooth video - it is better to make motion-compensated interpolation on a sequence of separated fields and pack back to 50fps interlaced frames. The more complex and possibly better quality is to make
1. 25i->50p double rate deinterlacing (QTGMC like complex plugin)
2. 50p->100p double rate mc-interpolation (mvtools2 like mc-engine)
3. 100p->50i interlaced packing/compression (script-based transform with built-in AVS commands)

Last edited by DTL; 1st February 2022 at 14:59.
DTL is offline   Reply With Quote
Old 1st February 2022, 14:58   #3  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 1,948
Is this ok?
Code:
blend = Merge(selectevery(1, 0),selectevery(1, 1))
interleave(last,blend)
EDIT: oops sorry, you meant interlaced!
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 1st February 2022, 15:50   #4  |  Link
Mitra
Registered User
 
Join Date: Mar 2021
Posts: 31
Quote:
Originally Posted by DTL View Post
.... Do you want to keep output FPS=50 interlaced ?

.... May be you need first to make deinterlacing to make 25fps frame-based stream ?
Thank you for your reply.

I need to get real-time smooth slow motion from i50 sources. the scan type of output does not matter, but the higher frame rate is better (I think).

I tried different frame interpolation methods (like SVP , Ai ,...), but to be honest, today I realized that none of them are as smooth as vMix real-time slowmotion output.
I think vMix uses a simple blending method, but I'm not an expert , if possible an expert please try vMix and tell me what method it uses?

Last edited by Mitra; 1st February 2022 at 16:04.
Mitra is offline   Reply With Quote
Old 1st February 2022, 16:01   #5  |  Link
Mitra
Registered User
 
Join Date: Mar 2021
Posts: 31
Quote:
Originally Posted by Dogway View Post
Is this ok?
Code:
blend = Merge(selectevery(1, 0),selectevery(1, 1))
interleave(last,blend)
EDIT: oops sorry, you meant interlaced!
Thank you for your reply.

Do you have any ideas about interlaced or vMix that i mentioned above?
Mitra is offline   Reply With Quote
Old 1st February 2022, 16:14   #6  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 517
May be vMix simply uses NVIDIA Optical Flow HWacc mc-interpolation so it outperform in quality and speed the old SVP ? NVIDIA promises good progress in Optical Flow in latest chips.

"from i50 sources. "

If it is 50 fields per second - to get even smoother you need 100 fields/frames per second or more. Not very easy to make in realtime even with latest end-user CPUs for big enough frame size.

Last edited by DTL; 1st February 2022 at 16:17.
DTL is offline   Reply With Quote
Old 1st February 2022, 16:16   #7  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 1,948
So you want it deinterlaced I guess, you should run first QTGMC as DTL suggested and then my code snippet. But yes, probably you want frame interpolation so you can try MysteryX's FrameRateConverter, there are better AI interpolators in VapourSynth though but haven't used them.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 1st February 2022, 16:33   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,223
Whats this look like to you ? [output 100p]
Code:
# Simple realtime
AssumeTFF() # or BFF
Bob() # Or alternative bob like realtime, out doublerate 50p
ConvertFPS(100.0)  # Blended (alternate) frames(originally fields), or some fast doublerate interpolator
EDIT:
Code:
# Alternative Simple realtime
AssumeTFF() # or BFF
NED=NNedi3(Field=-2, nns=2)                 # Field -2 = double rate, internal parity value to start
YadifMod2(Order=-1,Mode=1,edeint=NED)        # Order -1 = Internal Parity.  Mode 1=double rate do spactial check (3=no spatial check).
ConvertFPS(100.0)  # Blended (alternate) frames(originally fields), or some fast doublerate interpolator
EDIT:
Code:
# Alternative Simple realtime
AssumeTFF() # or BFF
QTGMC(Preset="fast",NoisePreset="Fast",SourceMatch=2,Lossless=2,EZKeepGrain=0.4,Sharpness=0.1, tr2=0) # Boulder
ConvertFPS(100.0)  # Blended (alternate) frames(originally fields), or some fast doublerate interpolator
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 1st February 2022 at 17:02.
StainlessS is offline   Reply With Quote
Old 1st February 2022, 16:38   #9  |  Link
Mitra
Registered User
 
Join Date: Mar 2021
Posts: 31
Quote:
Originally Posted by DTL View Post
May be vMix simply uses NVIDIA Optical Flow HWacc mc-interpolation so it outperform in quality and speed the old SVP ? NVIDIA promises good progress in Optical Flow in latest chips.

"from i50 sources. "

If it is 50 fields per second - to get even smoother you need 100 fields/frames per second or more. Not very easy to make in realtime even with latest end-user CPUs for big enough frame size.
I think it does not use the GPU, but how to check it?
Mitra is offline   Reply With Quote
Old 1st February 2022, 16:40   #10  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,979
Quote:
Originally Posted by Mitra View Post
I think it does not use the GPU, but how to check it?
You use a software based hardware monitor to measure GPU % usage like GPU-z, while performing the task
poisondeathray is offline   Reply With Quote
Old 1st February 2022, 16:55   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,223
Quote:
Originally Posted by DTL View Post
May be vMix simply uses NVIDIA Optical Flow HWacc mc-interpolation
If so, then would be a requirement of vMix [no idea if it is a requirement, vmix ad should say if so].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 1st February 2022, 17:06   #12  |  Link
Mitra
Registered User
 
Join Date: Mar 2021
Posts: 31
Thanks everyone, I will try now and let you know.
Mitra is offline   Reply With Quote
Old 1st February 2022, 22:14   #13  |  Link
Mitra
Registered User
 
Join Date: Mar 2021
Posts: 31
Thanks to all again.

Now I'm sure vMix does not use NVIDIA Optical Flow.

@StainlessS, Thank you so much!

QTGMC seems to be what I need, your script result is great and so better than vMix output, but so slow for real-time.

I tried the "Ultra Fast" preset, but it was not fast enough yet.

Do you have an idea to speed it up or improve the quality of the other your scripts?
Mitra is offline   Reply With Quote
Old 1st February 2022, 22:22   #14  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,979
Are you using multithreading ? Prefetch(x) where "x" is some value .
poisondeathray is offline   Reply With Quote
Old 1st February 2022, 22:36   #15  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 517
If the simple double-rate deinterlace 25i to 50p is enough smooth for you and you need more speed - you can again look into NVIDIA (may be AMD too) motion-adaptive hardware deinterlace. May be already having some way to download 50p frames back to host memory and feed into your application. For simple realtime playback you can just run any player with hardware double-rate deinterlace. I typically use MPC-HC player.

There are many double-rate deinterlace onCPU plugins. I sometime use yadif (yadifmod2) http://avisynth.nl/index.php/Yadifmod2 to get double-rate deinterlaced inside AVS environment because QTGMC too complex for me to setup infinite number of required plugins.
DTL is offline   Reply With Quote
Old 1st February 2022, 22:41   #16  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,223
QTGMC is inherently slow,
Those settings were provided by Boulder as producing little processing/denoising, and so reasonably fast,
maybe not fast enough for your machine.

What machine are you playing with ? [just so the boys/and girls, have some idea]

Maybe try the YadifMod2 deinterlacer thingy instead, perhaps with a HQDN3D afterwards, its fast.

ConvertFPS would be about as fast as you can get for uprate 50p to 100p,
if Yadifmod2 with HQDN3D is fast enough, perhaps SvpFlow might be better quality doublerater than ConvertFPS,
is supposed to be better for realtime, but I dont really use it.

You could always forget about 50p -> 100p, and look for better denoise. [FFT3DFilter(Sigma=1.8,Plane=0) is pretty fast, increase sigma for more denoise]

The boys & girls always like a sample to play with.

EDIT: And yes of course Prefetch(4) or therabouts would be a good idea at end of script [before Return Last]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 1st February 2022 at 22:45.
StainlessS is offline   Reply With Quote
Old 1st February 2022, 22:50   #17  |  Link
Mitra
Registered User
 
Join Date: Mar 2021
Posts: 31
@poisondeathray, Thanks, I had forgotten MT, I enabled Prefetch(4) now it's faster but still not enough for real time.

@DTL, Thanks for your recommendations, I will try them.
Mitra is offline   Reply With Quote
Old 1st February 2022, 23:04   #18  |  Link
Mitra
Registered User
 
Join Date: Mar 2021
Posts: 31
@StainlessS,

I use an i7 10700k + Nvidia 1660Ti and think it is fast enough.

Thanks for your recommendations,I will try them.

Last edited by Mitra; 1st February 2022 at 23:07.
Mitra is offline   Reply With Quote
Old 1st February 2022, 23:20   #19  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 1,178
Fast don't mean that quality. Too fast can detroy your details in video
kedautinh12 is offline   Reply With Quote
Old 1st February 2022, 23:30   #20  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,575
You can do this in any NLE (i.e., video editor). It's a lot easier. AVISynth is wonderful, but is a lousy tool for this. It takes me less than 1 second to do this in my NLE (Vegas), and I can instantly preview the effect.
johnmeyer is offline   Reply With Quote
Reply

Tags
avisynth, blending, video

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 11:42.


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