Convert60ito24p

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(add categories and one more link)
m (link fix)
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
 
{{FilterCat4|External_filters|Scripts|Adjustment_filters|Frame_Rate_Conversion}}
 
{{FilterCat4|External_filters|Scripts|Adjustment_filters|Frame_Rate_Conversion}}
I've made a script that converts 60i video to 24p avoiding jerkyness in motion using blending. <br>
+
{{Filter3
since I am a PAL - man I cannot test on a wide spectrum of NTSC - sources.
+
|scharfis_brain
 +
|
 +
|[http://home.arcor.de/scharfis_brain/convert60ito24p.avs convert60ito24p.avs] [http://web.archive.org/web/20121102063915/http://home.arcor.de/scharfis_brain/convert60ito24p.avs]
 +
|Frame Rate Converters
 +
|
 +
|6=[http://forum.doom9.org/showthread.php?s=&threadid=63368  Doom9 Thread]}}
  
are there any volunteers, who can do tests with my script? <br>
+
== Description ==
I think, especially mode 2 of this script could be useful on non decimatable animes...
+
This function converts 60fps video into 24fps avoiding jerky motion.
 
+
*'''Note:''' this method is rather old (2003), better alternatives are available.
== usage: ==
+
<br>
 
+
== Requirements ==
import(convert60ito24p.avs)
+
* AviSynth 2.5.8 or later
loadplugin(your 60fps deinterlacer like dgbob or tomsbob)
+
* [[Interlacing_and_deinterlacing|Progressive]] input only
xxxsource("clip")
+
* Supported color formats: [[RGB24]], [[RGB32]], [[YUY2]]
your60fpsdeinterlacer()
+
<br>
convert60ito24p(2,0)
+
== [[Script variables|Syntax and Parameters]] ==
 
+
{{Template:FuncDef|convert60ito24p (clip video, int mode, int offset)}}
=== mode - parameter: ===
+
<br>
------------------
+
<br>
0 uses simple 24 out of 60 selection -> jerky motion
+
:{{Par2|video|clip| }}
 
+
::Input clip.
Code:
+
<br>
 
+
:{{Par2|mode|int| }}
.A B C D E F G H I J K L M N O P Q R  <- input sequence
+
::Mode 0 does a simple 2 out of 5 selection, which results in jerky motion. Use this mode for comparing purposes.
 +
::Modes 1 to 3 are using blending of nearby Frames to avoid jerkyness and "simulate" motionblur. The higher the mode-number the more motionblur will be made and thus the motion gets smoother. Modes 2 and 3 are only recommended with a shutterspeed of 1/60sec. With shorter shutter speeds use Mode 1.
 +
::*<code>mode=0</code> : uses simple 24 out of 60 selection -> jerky motion.
 +
<ul><DD><DD><pre style="width: 100%;">
 +
A B C D E F G H I J K L M N O P Q R  <- input sequence
 
   |    |  |    |  |    |  |    <- | = direct copy
 
   |    |  |    |  |    |  |    <- | = direct copy
 
   1    2    3    4    5    6    7    <- resulting output sequence
 
   1    2    3    4    5    6    7    <- resulting output sequence
 
+
</pre></ul>
1 introduces a blending of every other frame from its nearest neighbors
+
::*<code>mode=1</code> : introduces a blending of every other frame from its nearest neighbors. This mode delivers a non-jerky motion and should be used with shutter speeds below 1/60sec! ie. 1/120 or shorter.
 
+
<ul><DD><DD><pre style="width: 100%;">
Code:
+
A B C D E F G H I J K L M N O P Q R  <- input sequence
 
+
.A B C D E F G H I J K L M N O P Q R  <- input sequence
+
 
   |  \ /  |  \ /  |  \ /  |    <- | = direct copy ; \ / = 50:50 blending
 
   |  \ /  |  \ /  |  \ /  |    <- | = direct copy ; \ / = 50:50 blending
 
   1    2    3    4    5    6    7    <- resulting output sequence
 
   1    2    3    4    5    6    7    <- resulting output sequence
 
+
</pre></ul>
this mode delivers a non-jerky motion and should be used with shutter speeds below 1/60sec!
+
::*<code>mode=2</code> : uses blending on every frame, ideal for shutter speed of 1/60 sec since it simulates very close the 24p (1/24sec) motion blur and thus giving a really smooth 24p - motion as a positive side-effect, this mode reduces noise and nearly completely  eliminates remained line flickering of the deinterlacing!
ie. 1/120 or shorter
+
<ul><DD><DD><pre style="width: 100%;">
 
+
A B C D E F G H I J K L M N O P Q R   <- input sequence
2 uses blending on every frame like this:
+
 
+
Code:
+
 
+
.A B C D E F G H I J K L M N O P Q R <- input sequence
+
 
   \|/  \ /  \|/  \ /  \|/  \ /  \|/  <- \|/ = 25:50:25 blending ; \ / = 50:50 blending
 
   \|/  \ /  \|/  \ /  \|/  \ /  \|/  <- \|/ = 25:50:25 blending ; \ / = 50:50 blending
 
   1    2    3    4    5    6    7    <- resulting output sequence
 
   1    2    3    4    5    6    7    <- resulting output sequence
 
+
</pre></ul>
mode 2 is ideal for shutter speed of 1/60 sec
+
::*<code>mode=3</code> : similar to mode 2 but with more motion blur.
since it simulates very close the 24p (1/24sec) motion blur
+
::*Any other number given to mode just returns the original (60fps) input clip.
and thus giving a really smooth 24p - motion
+
<br>
as a positive side-effect, this mode reduces noise and nearly comletely
+
:{{Par2|offset|int| }}
eliminates remained line flickering of the deinterlacing!
+
::Apply an offset for selecting the 2 out of 5 frames - pattern.
 
+
<br>
every other number given to mode delivers the the input directly to the output (60fps)
+
== Examples ==
 
+
  Import("convert60ito24p.avs")<br>
=== offset - parameter: ===
+
  [[AviSource]]("blah.avi")
--------------------
+
  QTGMC() # or any other double frame rate deinterlacer
here you can apply a offset for selecting the 2 out of 5 frames - pattern.
+
  convert60ito24p(2,0)
 
+
<br>
function convert60ito24p(clip video, int mode, int offset)
+
{
+
work = assumefieldbased(video)
+
+
out = (mode==3) ? interleave (
+
  \  selectevery(
+
  \  overlay(trim(work, 1, 0),
+
    \  overlay(work, trim(work, 2, 0), mode="blend", opacity=0.5),
+
    \  mode="blend", opacity=0.5), 5, 0 + offset),
+
  \  selectevery(
+
  \  overlay(
+
    \  overlay(work, trim(work, 3, 0), mode="blend", opacity=0.5),
+
    \  overlay(trim(work, 2, 0), trim(work, 1, 0), mode="blend", opacity=0.5),
+
    \  level = 170), 5, 2 + offset)) :
+
+
\ (mode==2) ? interleave(
+
  \ selectevery(
+
    \  overlay(trim(work, 1, 0),
+
    \  overlay(work, trim(work, 2, 0), mode="blend",opacity=0.5),
+
    \  mode="blend",opacity=0.5), 5, 0 + offset),
+
  \  selectevery(
+
    \  overlay(work, trim(work, 1, 0), mode="blend",opacity=0.5), 5, 3 + offset)) :
+
+
\  (mode==1) ? interleave(
+
  \  selectevery(trim(work, 1, 0), 5, 0 + offset),
+
  \  selectevery(overlay(work, trim(work, 1, 0), mode="blend",opacity=0.5), 5, 3 + offset)) :
+
+
\  (mode==0) ? selectevery(work, 5, 1 + offset, 4 + offset) : work
+
+
assumeframebased(out)
+
}
+
 
+
 
==External Links ==
 
==External Links ==
* [http://forum.doom9.org/showthread.php?s=&threadid=63368 Convert60ito24p thread in doom9]
+
* [http://forum.doom9.org/showthread.php?s=&threadid=63368 Doom9 Forum] - Convert60ito24p discussion.
* [http://home.arcor.de/scharfis_brain/60ito24p.html scharfis_brain's 60ito24p webpage]
+
* [http://home.arcor.de/scharfis_brain/60ito24p.html scharfis_brain's website][http://web.archive.org/web/20121101034135/http://home.arcor.de/scharfis_brain/60ito24p.html] - Convert60ito24p webpage.
 
<br>
 
<br>
 
<br>
 
<br>
 
-----------------------------------------------
 
-----------------------------------------------
 
'''Back to [[External_filters#Frame_Rate_Conversion|External Filters]] &larr;'''
 
'''Back to [[External_filters#Frame_Rate_Conversion|External Filters]] &larr;'''

Latest revision as of 08:56, 12 November 2015

Abstract
Author scharfis_brain
Version
Download convert60ito24p.avs [1]
Category Frame Rate Converters
License
Discussion Doom9 Thread

Contents

[edit] Description

This function converts 60fps video into 24fps avoiding jerky motion.

  • Note: this method is rather old (2003), better alternatives are available.


[edit] Requirements


[edit] Syntax and Parameters

convert60ito24p (clip video, int mode, int offset)

clip  video =
Input clip.


int  mode =
Mode 0 does a simple 2 out of 5 selection, which results in jerky motion. Use this mode for comparing purposes.
Modes 1 to 3 are using blending of nearby Frames to avoid jerkyness and "simulate" motionblur. The higher the mode-number the more motionblur will be made and thus the motion gets smoother. Modes 2 and 3 are only recommended with a shutterspeed of 1/60sec. With shorter shutter speeds use Mode 1.
  • mode=0 : uses simple 24 out of 60 selection -> jerky motion.
     
     A B C D E F G H I J K L M N O P Q R  <- input sequence
       |     |   |     |   |     |   |    <- | = direct copy
       1    2    3    4    5    6    7    <- resulting output sequence
    
  • mode=1 : introduces a blending of every other frame from its nearest neighbors. This mode delivers a non-jerky motion and should be used with shutter speeds below 1/60sec! ie. 1/120 or shorter.
     
     A B C D E F G H I J K L M N O P Q R  <- input sequence
       |   \ /   |   \ /   |   \ /   |    <- | = direct copy ; \ / = 50:50 blending
       1    2    3    4    5    6    7    <- resulting output sequence
    
  • mode=2 : uses blending on every frame, ideal for shutter speed of 1/60 sec since it simulates very close the 24p (1/24sec) motion blur and thus giving a really smooth 24p - motion as a positive side-effect, this mode reduces noise and nearly completely eliminates remained line flickering of the deinterlacing!
     
    A B C D E F G H I J K L M N O P Q R   <- input sequence
      \|/  \ /  \|/  \ /  \|/  \ /  \|/   <- \|/ = 25:50:25 blending ; \ / = 50:50 blending
       1    2    3    4    5    6    7    <- resulting output sequence
    
  • mode=3 : similar to mode 2 but with more motion blur.
  • Any other number given to mode just returns the original (60fps) input clip.


int  offset =
Apply an offset for selecting the 2 out of 5 frames - pattern.


[edit] Examples

Import("convert60ito24p.avs")
AviSource("blah.avi") QTGMC() # or any other double frame rate deinterlacer convert60ito24p(2,0)


[edit] External Links




Back to External Filters

Personal tools