Avisynth Basics - Resizing and Sharpening for Gifs
Prerequisites
Avisynth (Wikipedia)
How to Use Avisynth For Gif Making by MichieTuts
Installing Avisynth by brandinator
Tumblr Dashboard Image Display Sizes by Unwrapping Tumblr
This post details my process for using Avisynth to resize a video file. The video file can then be edited and converted to a gif.
I learned how to use Avisynth through the posts linked above. I highly recommend reading through them; they're very detailed and easy to follow. By comparison, this is a basic guide as it only offers one method for using Avisynth.
In this post, I cover the following:
Why use Avisynth?
Using Avisynth to resize a video clip
This post assumes that you've already installed Avisynth.
đĄ Why use Avisynth?
Avisynth is a frameserver that takes a video file as input and resizes it for editing. The width of a Tumblr post is 540 pixels (px); with Avisynth, we can resize video files so that they fit that criteria. (For context, a 1080p (HD) YouTube video is 1920 x 1080 px.)
While Photoshop is able to resize images (Image > Image Size), it's not as accurate as Avisynth is.
Here are two gifs that have been resized through different software:
The difference is subtle, but the left gif (Avisynth) appears more detailed to me!
However, please note that I didn't run any Photoshop sharpening on the right gif. When learning how to resize and sharpen gifs in Photoshop, I followed rubyredwisp's Gif Sharpening Tutorial.
đĽ Using Avisynth to resize a video clip
The following steps detail how I use Avisynth to resize videos. The final product, an .avi file, can be imported into your editor (eg. Photoshop) and edited there.
â Choose a video file that you'd like to gif.
For the purpose of this tutorial, I work with a screenrecording that I took of Dragon Age 2.
⥠Navigate to your Avisynth folder and locate the normalwebmrange script.
This may differ depending on how you installed Avisynth, but my Avisynth folder is located at \This PC\Windows (:C)\video.
normalwebmrange is a Windows batch file (.bat). I use this particular script because it allows you to clip out a few seconds of the video by specifying the start and end timestamps. These timestamps specify the video clip that will become your gif(s).
I recommend working with video clips that are 4-8 seconds long.
â This means that you may need to load your video file back into normalwebmrange to make a gif in a new timestamp range. While inconvenient, I recommend working with smaller video clips so that you're asking Avisynth to process multiple small videos rather than one large video. A larger video is more likely to crash the software.
⢠Load the video file into normalwebmrange.
To do so, select and drag your video file into normalwebmrange.
⣠Enter the timestamps of the portion of the video you want to clip out.
A pop-up window will appear that asks you for the "starting time in hh:mm:ss format."
For this example, I want my gif to start at about 3 minutes and 13 seconds into my video file. My start timestamp is therefore 00:03:13.
Enter this information, then hit the Enter key.
Next, enter the "ending time in hh:mm:ss format." (For this example, my end timestamp is 00:03:21.) Hit the Enter key.
normalwebmrange will then generate a bunch of log lines. After, it will automatically open two things:
A tab in your computer's default web browser.
An Avisynth window.
⤠Specify the resizing details for your gif.
Navigate to the browser tab that normalwebmrange opened. There are several fields for you to fill out here.
GIF Size - This is the width and height of your gif. For more details on Tumblr post sizes, see Tumblr Dashboard Image Display Sizes. After filling this out, you may have to adjust your video clip in the preview box (below the white textbox).
Opacity - Leave this value at 100.
Preprocessor - I always use qtgmc 30 slow for the framerate and debilinear sharpening. "30" refers to how many frames per second (fps) you want your gif to display; I find that the alternative, 60 fps, is overkill for Tumblr gifs. "Slow" means that Avisynth will take longer to process your video, but this results in better quality.
Extra Sharpening - I don't use this field, but feel free to experiment!
After filling out all of the fields, copy all of the text in the white textbox.
⼠Enter the resizing information in Avisynth.
Navigate to the Avisynth window that normalwebmrange opened.
Paste the text you just copied on line 17:
Your Avisynth window should now look something like this:
Select File > Save Script.
Close the Avisynth window.
This automatically launches another Avisynth window called VirtualDub. Here, you can watch Avisynth resize and sharpen your video clip in real time!
Once the VirtualDub window automatically closes, you'll know that your video clip has been fully processed and is now ready for editing.
? Where did my video clip save to? If you go back to your Avisynth folder (\This PC\Windows (:C)\video), open the \temp folder. The .avi file named "video" is your resized and sharpened video clip!
As a nice anon asked me how I make my gifs, I thought itâd be cool to create an in-depth tutorial :) Perhaps this can help some others enter the gif-ing world too!
What weâll be using for this tutorial:
Software: Bandicam, Avisynth, Photoshop CC 2018, Topaz Labs
File Format: .mp4
Operating System: Windows
Disclaimer: This is just my method. Every gif maker works differently and has different preferences. What works for me may not work for you, and thatâs completely okay!
Letâs get into it!
1. Find the best quality video you can find
This really depends on the content you want to gif. For variety shows, music videos or photoshoots, any video of [1080p] should be sufficient. Try not to use anything below 720p.
For stage performances, fancams tend to have higher resolutions [1440p, 4k]. Use these if your computer can handle it. If not, usually 1080p works fine. The best option would be to download .ts files, which provide clearer and less grainy videos.
For Seventeen, you can get .ts files from The Rosebay on Twitter :)
2. Screen recording
As a Windows user, I donât have a built-in screen recorder on my laptop. So, I use Bandicam, which is a free screen recording software. The only con to it is that it has a watermark.
To combat the watermark, I always have the boundary box a little bigger than the video itself so that I can crop it out of the gif.
This is what the recording would look like:
Just record the scene(s) that you want to gif so your video file doesnât end up too large! Your recording should be in .mp4 format.
(You may use pure .ts files in Avisynth but it never worked well for me so I usually screen record the .ts video and move on)
You can find your recorded videos in Documents > Bandicam.
3. Avisynth
I followed THIS tutorial to download Avisynth. This software is really helpful if you want sharp and clear gifs! I recommend to follow the steps in the tutorial as the below method stems from it.
- Once you have downloaded it, open up your recorded video from Step 2 and watch it. Take note of the duration you want to gif. (e.g. from 00:01 to 00:05)
- Drag your video file into normalwebrange.bat. On Windows, you can find this in File Explorer > Local Disk (C:) > video. For other .bat files, you may check out THIS tutorial.
- In the pop-up box, key in the start time for your gif (e.g. 00:00:01). It has to be in hh:mm:ss format. Press âenterâ.
- Key in the end timing and press âenterâ again. A resizer should pop up in an Internet Browser. I found that Firefox works best for me.
- In the resizer, you may indicate the size of the gif youâd like to make. You can also click and drag the video to resize and frame it to your liking. You may refer to THIS post for Tumblr dashboard sizing.
(These are some common gif sizes for stage performances):
1 gif - 540px by 540px (square)
2 gifs - 268px by 350px
3 gifs - 177/178px by 250px
- Under âPreprocessorâ, select âdebilinearâ for the second box. For the first box, you may pick between qtgmc 30 (same frame rate as video) or qtgmc 60 (doubles the frame rate; smoother).
- You will also see âfastâ or âslowâ options. These are just how long the video will take to render. âFastâ will give you slightly lower quality as compared to âslowâ, but usually is good enough.
(You can see that his features are sharper and more defined in the âslowâ gif as compared to the âfastâ one.)
- Copy the code in the white box. Navigate to the scripting window (it should have popped up with the resizer) and paste the code at line 17. Type a â#â before qtgmc on the same line. This will prevent the software from lagging.
- Click on the inverted triangle at the bottom of the screen. Your video will now appear in the scripting window. Drag the slider to the intended starting point of your gif and press the âhomeâ key on your keyboard.
- Drag the slider again to the intended ending point of your gif and press the âendâ key on your keyboard. This blue area you see is the duration of your gif.
- On an empty line (I usually go to line 8), place your cursor there and click âApplyâ in the mini pop-up window. Afterwards, remove the â#â from line 17.
- Go to File > Save or press Ctrl + S to save the code. Close the scripting window. The video renderer will pop up. When itâs done, it will automatically close by itself.
4. Using Photoshop and Topaz
Iâm using my school license for Photoshop 2018, but if you donât have that, there are plenty of cracked versions for free. I donât have any to recommend though so Iâm sorry about that :(
I followed THIS video tutorial to download Topaz plug-ins for free. I use Topaz DeNoise (the most helpful) and Clean, but you may use others if youâd like :)
Alright, letâs dive in to the steps!
- Open up Photoshop and go to File > Import > Video Frames to Layers.
- A pop-up will appear. You can find your deinterlaced Avisynth video in File Explorer > Local Disk (C:) > video > temp > video.avi. Follow the settings in the picture and click âOKâ.
- Go to Window > Timeline to open up the timeline. You should be able to see your gif spread out in frames. If you press the play button, it should play like a video.
- (Quick optional step I learned from THIS tutorial) Go to Image > Canvas and set the Resample option to âBicubic (smooth gradients)â.)
- Select the first frame of your gif in the timeline. Shift select the last frame. Go to Window > Layers. Shift select these layers as well.
- With everything selected, click the 3 lines at the top right corner of the timeline. Select âConvert to Video Timelineâ.
- At the top of the screen, select Filter > Convert for Smart Filters. Your layers will condense into one layer. Donât worry, your gif is fine.
- Now itâs time to sharpen the gifs. Go to Filter > Sharpen > Smart Sharpen. Play around with the settings to your liking!
- If youâve downloaded Topaz correctly, it should appear under Filter > Topaz Labs. If a pop-up asks you for an activation key, you may use THESE to activate it for free.
- Go to Filter > Topaz Labs > DeNoise and/or Clean and play with the settings until youâre satisfied.
5. Blurring
If your gifs have captions/logos that are distracting, youâd want to blur them out. Donât be like 2018 me that blurred out the logo frame by frame; itâs very tiring. Instead, using this method from @scoupsyâs tutorial, youâll save lots of time.
- In the Layers tab (Windows > Layers), select the âNew Layerâ icon. It should be blank.
- Select the Brush tool. Make sure the âHardnessâ setting is below 20%. This will blend the blurring nicely into the gif.
(For the sake of this tutorial, I will be blurring out the Bandicam logo to show you.)
- Paint over the captions/logos. Make sure this is on the blank layer!
- Duplicate (Right Click > Duplicate) the gif layer and drag it so that itâs on top of the blank layer.
- Right click on the duplicate layer and select âCreate Clipping Maskâ.
- Go to Filter > Blur > Gaussian Blur and play around with the settings until youâre satisfied with the level of blurring. Click âOKâ.
6. Flattening & Colouring
- Once youâre done with sharpening and/or blurring, click on the 3 lines on at the right corner of the video timeline and go to Convert Frames >Â Flatten Frames Into Clips.
- Topaz layers and blurring will take some time to render so you can just chill for now~
- When itâs done rendering, click again on the 3 lines and go to Convert Frames >Â Make Frames From Clips.
- Convert it back to the gif timeline by clicking on the 3-box icon at the bottom left of the timeline.
- Select the first frame of your gif. It must be the FIRST.
- Scroll to the top of the layers and select the layer at the top. Any other layers you add should be on top of this layer. VERY IMPORTANT!!
- In the Adjustments Tab (Window > Adjustments), there are many different things to play with. Thereâs a high chance you wonât use everything, but hereâs a few of my favourites.
Levels - Adjust the brightness and contrast of your gif in depth.
Hue/Saturation - Useful for changing colours, or switching it to black and white.
Color Balance - Tweak the colours to your liking.
Colour Lookup - Comes with built-in LUTs that you can use as a preset. Great starting point for colouring. Saves time too. You can even download plug-ins for this. 11/10 tool.
Selective Colour - Adjust the vibrancy of specific colours.
- Colouring is completely up to the gifmaker. Go crazy go stupid :D
7. Exporting
Weâre almost to the end!
- Set the timing for your gif.
If you used qtgmc30, the best timing would be 0.04s / 0.05s / 0.06s.
If you used qtgmc60, the best timing would be 0.02s / 0.03s / 0.04s.
- Once youâre satisfied with everything, go to File > Export > Save for Web (Legacy).
- Follow the settings in the picture below:
- Tumblrâs gif limit is 10mb per gif. Check the gif size at the bottom left of the pop-up window. Make sure itâs below 10mb; the smaller the better.
- Click âSaveâ. Choose where youâd like to save the gif.
- Done!
~~~~~~~~~~~~~~~~
And thatâs it! Youâve successfully made a gif! Good job you :D
I hope this tutorial was helpful! Please leave some feedback if it helped, or if you have other methods youâd like to share :)
Lastly, if you have any questions, feel free to send in an ask or DM me!! :)