Hello guest, if you like this forum, why don't you register? https://fanrestore.com/member.php?action=register (December 14, 2021) x


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AviSynth GrainPlate function
#1
Code:
############################################################################################
### GrainPlate 1.0: add real grains to your clip!                                        ###
###                                                                                      ###
### Usage:   GrainPlate(clip, strenght)                                                  ###
###          where strenght range goes from 0 (clip untouched) to 1 (max strenght)       ###
###                                                                                      ###
### Just add your own grain plate, there are many free to download over the web.         ###
### Hints: NEVER upscale/downscale a grain plate; choose one with the same size of your  ###
### clip, or bigger; choose only REAL film grain, and not recreated.                     ###
###                                                                                      ###
### AviSynth script made by spoRv (http://blog.sporv.com) - Created: 2014-06-18          ###
###                                                         Updated: 2016-12-29          ###
###                                                                                      ###
### Creative Commons 4,0 - Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)       ###
### Link to the licence page: https://creativecommons.org/licenses/by-sa/4.0/            ###
############################################################################################

function grainplate (clip clip, "strength") {
strength = default( strength, 0.25)
grain=avisource("putyourowngrainplatefilehere.avi")\
.crop(0,0,clip.width,clip.height).loop.trim(0,clip.framecount-1)
return overlay(clip.tweak(bright=1),grain,mode="softlight",opacity=strength) }

Warning: check the brightness settings with the grain plate you decide to use; it must be raised to be the same of the source without grain plate applied!
Reply
Thanks given by: jackjason , pipefan413 , bronan
#2
Thx! 

For those who only have monochrome grain plates like myself, I modified it a bit:
Code:
function grainplate (clip clip, "strength") {
strength = default( strength, 0.25)
g=AVISource("04-MED_CLEAN.avi")
g=MergeRGB(g,UnalignedSplice(g.trim(g.framecount/2-1,g.framecount-1),g.trim(0,(g.framecount/2)-1)),UnalignedSplice(g.trim(g.framecount/3-1,g.framecount-1),g.trim(0,(g.framecount/3)-1)))
grain=g.crop(0,0,clip.width,clip.height).loop.trim(0,clip.framecount-1)
return overlay(clip.tweak(bright=1),grain,mode="softlight",opacity=strength) }

Basically, this applies a delay to the grain plate, once by -50% and once by -33%. Then it merges the RGB from the normal grainplate, the -50% delayed one and the -33% delayed one. 

This is helpful because a monochrome grainplate doesn't really do much to help with chroma blocking. Also, a monochrome grainplate gives an unrealistic result for anything but black-and-white film, as we all know film consists of color layers.

This isn't 100% realistic, as film doesn't consist of RGB layers, but it's good enough for me.

Edit: Just make sure the duration of your grainplate is divisible by both 2 and 3, else some weird results may occur.
Reply
Thanks given by: jackjason
#3
I want to start playing with this script. Where can I find a nice grain plate video?
Reply
Thanks given by:
#4
It was A LOT of time ago when I got some nice free plates, so I can't remember, except for gorillagrain; some google-fu with "grain plates" should bring some, though! Big Grin
Reply
Thanks given by:
#5
Oh yes how very lazy of me. Google-fu should have been my first port of call! I found a free clip called "Holy Grain". Might not be the best but will get me started. Thanks.
Reply
Thanks given by:
#6
Yep, IIRC it was nice, too! Ok
Reply
Thanks given by:
#7
Thanks for this! Combined it with the free grain plates at https://tdcat.com/downloads/filmgrain and got some nice results! Uploaded a quick comparison using a Super 16mm plate here:

https://www.screenshotcomparison.com/comparison/11250

Those grain plates are at 24fps so for 23.976 films you will need to modify the one line to:
grain=avisource("putyourowngrainplatefilehere.avi").AssumeFPS("ntsc_film")\
Reply
Thanks given by:
#8
That grain plate for Dirty Pair looks ace! Wish the bozos at Q-Tec and Sunrise left the grainy scans alone instead of sandblasting them "to look closer to the cels".
Reply
Thanks given by:
#9
(2020-09-30, 07:48 PM)spoRv Wrote: It was A LOT of time ago when I got some nice free plates, so I can't remember, except for gorillagrain; some google-fu with "grain plates" should bring some, though! Big Grin

I have 8/16/35, fine/medium/coarse, 1080, 4k, literally hundreds. 23.976, 24, 25, 29.97, they were all free (incl. Gorilla Grain).
Let me know if you'd like them Smile
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
  AviSynth DeFade function spoRv 4 5,577 2017-01-23, 06:02 PM
Last Post: jerryshadoe

Forum Jump:


Users browsing this thread: 2 Guest(s)