Archive for the ‘AviSynth’ Category

RE:Vision’s FieldsKit ReInterlacer

Friday, May 16th, 2014

In Summary:

Purpose of FieldsKit ReInterlacer:

  • Transforms progressive video (e.g. HDp25 frames/sec) into spatio-temporal interlaced video (e.g. SDi50 fields/sec).  It achieves this by estimating the fields that would have been shot (had the original video itself been shot as interlaced) between each frame of the progressive video, via a process of motion estimation.
    •  Most NLEs do not use this “perfectionist” method, instead they at best simply combine (ghost-blur) successive frames, with no compensation for time/motion.
    • On an interlaced display, such as an old analog TV or projector,
      • The “NLE-simple” approach may lead to dynamic (changing e.g. moving) scenes and objects appearing flickery.
      • The “perfectionist” approach will instead typically avoid such flicker.

Configuration of  FieldsKit ReInterlacer:

  • Field Order: [Lower First]
  • Output Type: [= Create motion estimated fields]
    • This is not the default (oddly).  But it is the only proper way to get the expected “perfectionist” reinterlacing to happen!
  • Source Layer: [Video 1]

Supplier’s website:


Best Workflow for High-resolution Master (e.g. HD or HDV) to Multi-Format Including SD-DVD

Saturday, July 13th, 2013

What is the best workflow for going from a high-resolution footage, potentially either progressive or interlaced,  possibly through an intermediate Master (definitely in progressive format) to a variety of target/deliverable/product formats, from the maximum down to lower resolution and/or interlaced formats such as SD-DVD ?

Here’s one big fundamental: Naively one might have hoped that long-established professional NLEs such as Premiere might provide high-quality optical processing based downscaling from HD to SD, but my less optimistic intuition, about the un-likelihood of that, proved correct.  In my post I note the BBC Technical standards for SD Programmes state: <<Most non linear editing packages do not produce acceptable down conversion and should not be used without the broadcaster’s permission>>.

Having only ever used Adobe (CS5.5 & CS6) for web-based video production, early experiences in attempting to produce a number of target/deliverable (product) formats proved more difficult and uncertain than I had imagined…  For a current project, given historical footage shot in HDV (1440×1080, fat pixels), I wanted to generate various products from various flavors of HD (e.g. 1920x1080i50,  1280x720p50) down to SD-DVD (720×576).  So I embarked on a combination of web-research and experimentation.

Ultimately, this is the workflow that worked (and satisfied my demands):

  • Master: Produce a 50 fps (if PAL) progressive Master at the highest resolution consistent with original footage/material.
    • Resolution: The original footage/material could e.g. be HD or HDV resolution.  What resolution should the Master be?
      • One argument, possibly the best one if only making a single format deliverable or if time is no object, might be to retain the original resolution, to avoid any loss of information through scaling.
      • However I took the view that HDV’s non-standard pixel shape (aspect ratio) was “tempting fate” when it came to reliability and possibly even quality in subsequent (downstream in the workflow) stages of scaling (down) to the various required formats (mostly square-pixel, apart from SD-Wide so-called “16:9” pixels, of 1.4568 aspect ratio (or other, depending where you read it).
      • So the Master resolution would be [1920×1080].
    • Progressive: The original footage/material could e.g. be interlaced or progressive, but the Master (derived from this) must be progressive.
      • If original footage was interlaced then the master should be derived so as to have one full progressive frame for each interlaced field (hence double the original frame-rate).
        • The concept of “doubling” the framerate is a moot point, since interlaced footage doesn’t really have a frame rate, only a field rate, because the fields are each shot at different moments in time.  However among the various film/video industry/application conventions, some people refer to 50 fields/second interlaced as 50i (or i50) wile others refer to it as 25i (or i25).  Context is all-important!
    • Quality-Deinterlacing: The best way to convert from interlaced fields-to-frames is via motion/pixel/optical -based tools/techniques:
      • I have observed the quality advantage in practice on numerous projects in the distant past, e.g. when going from HDV or SD (both 50i) to a variety of (lower) corporate web-resolutions.
      • This kind of computation is extremely slow and heavy, hence (for my current machines at least) more an overnight job than a real-time effect… In fact for processing continuously recorded live events of one or two hours, I have found 8 cores (fully utilised) to take a couple of 24-hour days or so – for [AviSynth-MultiThread + TDeint plugin] running on a [Mac Pro > Boot Camp > Windows 7].
      • But (as stated) this general technique observably results in the best quality, through least loss of information.
      • There are a number of easily-available software tools with features for achieving this, Adobe and otherwise:
        • e.g. AviSynth+TDeint, (free) After-Effects, Boris.
        • e.g. FieldsKit is a nice convenient deinterlacing plugin for Adobe (Premiere & After Effects), and is very friendly and useful should you want to convert to a standard progressive video (e.g. 25fps), but (at this time) it can only convert from field-pairs to frames, not from fields to frames.
          • I submitted a Feature Request to FieldsKit’s developers.
    • Intermediate-File Format: A good format for an Intermediate file or a Master file is the “visually lossless” wavelet-based 10-bit 422 (or more) codec GoPro-Cineform (CFHD) Neo
      • Visually lossless (such as CFHD) codecs save considerable amounts of space as compared to uncompressed or mathematically lossless codecs like HuffYUV and Lagarith.
      • I like Cineform in particular because:
        • It is application-agnostic.
        • It is available in both VFW [.avi] and QuickTime [.mov] varieties (which is good because I have found that it can be “tempting fate” to give [.mov] files to certain Windows apps, and indeed not to give it to others).  The Windows version of CFHD comes with a [.avi] <-> [.mov] rewrapper (called HDLink).
        • Another advantage is that CFHD can encode/decode not only the standard broadcast formats (and not only HD) but also specialized “off-piste” formats.  I have found that great for corporate work. It’s as if it always had “GoPro spirit”!
        • CHFD Encoder Settings from within Sony Vegas 10:
          • These settings worked for me in the context of this “Sony-Vegas-10-Initially-then-Adobe-CS6-centric” workflow:
    • Technical Production History of a Master for an Actual Project:
      • This is merely for my own reference purposes, to document some “project forensics” (while I still remember them and/or where they’re documented):
      • This was a “Shake-Down” experience, not exactly straightforward, due to an unexpected “hiccup” between Sony Vegas 10 and AviSynth-WAVSource.  Hiccups are definitely worth documenting too…
      • The stages:
        • Sony Vegas Project: An initial HDV 50i (to match the footage) Intermediate file, containing the finished edit, was produced by Sony Vegas 10 Project:
          • [Master 021a (Proj HDV for Render HDV)  (veg10).veg] date:[Created:[2013-07-01 15:30], Modified:[2013-07-03 20:07]]
          • Movie duration was about 12 minutes.
        • Audio & Video Settings:
          • Project Settings:
            • HDV 1440×1080 50i UFF 44.1KHz
              • The audio was 44.1KHz, both for Project and Render, since most of the audio (music purchased from Vimeo shop) was of that nature.
          • Render Settings:
            • I believe I will have used the following Sony Vegas Render preset: [CFHD ProjectSize 50i 44KHz CFHD (by esp)] .
              • Though I think there may have been a bug in Vegas 10, whereby the Preset did not properly set the audio sampling frequency, so it had to be checked & done manually)
            • The CFHD Codec settings panel only offered two parameters, which I set as follows: Encoded format:[YUV 4:2:2], Encoding quality:[High]
          • The result of Rendering from this Project was the file:
            • [Master 021a (Proj HDV for Render HDV)  (veg10).avi] date:[Created:[2013-07-01 15:30], Modified:[2013-07-01 18:58]]
              • Modified date minus creation date is about 3.5 hours, which I guess accounts for the render-time (on a 2-core MacBook Pro of 2009 vintage winning Windows 7 under Boot Camp).
        • The next stage of processing was to be by AviSynth.
          • However AviSynth had problems reading the audio out of this file (it sounded like crazy buzzes).
          • To expedite the project, and guessing that Vegas 10 had produced a slightly malformed result (maybe related to the audio setting bug?), and hoping that it was just a container-level “audio framing” issue, I “Mended” it by passing it through VirtualDub, in [Direct Stream Copy] mode, so that it was merely rewrapping the data as opposed to decompressing and recompressing it.  The resulting file was:
            • [Master 021a HDV Mended (VDub).avi], date:[Created:[2013-07-08 18:22], Modified:[2013-07-08 18:30]]
          • Since that time, I have discovered the existence of the Cineform tool CFRepair, from forum post at DVInfo: which itself provided a download link as
            • Worth trying it out sometime, on this same “broken” file…
        • This was processed into full HD progressive (one frame per field, “double-framerate”) by an AViSynth script as follows, its results being drawn through VirtualDub into a further AVI-CFHD file, constituting the required Master.
          • AviSynth Script:[HDV to HD 1920×1080.avs] date:[Created:[2013-07-04 18:13], Modified:[2013-07-08 22:05]]
            • I used AvsP to develop the script.  It provides helpful help of various kinds and can immediately show the result in its preview-pane.
            • Multi-threaded:
              • To make best use of the multiple cores in my machine, I used the AviSynth-MT variant of AviSynth.  It’s a (much larger) version of the [avisynth.dll] file.  For a system where AviSynth (ordinaire) is already installed, you simply replace the [avisynth.dll] file in the system folder with this one.  Of course its sensible to keep the old one as a backup (e.g. rename it as [avisynth.dll.original]).
            • Audio Issue:
              • This particular script, using function [AVISource] to get the video and and [WavSource] to get the audio, only gave audio for about the first half of the movie, with silence thereafter.
              • Initially, as a workaround, I went back to VirtualDub and rendered-out the audio as a separate WAV file, then changed the script to read its [WAVSource] from this.
              • That worked fine, “good enough for the job” (that I wanted to expedite)
              • However afterwards I found a cleaner solution: Instead of functions [AVISource] and [WAVSource], use the single function [DirectShowSource].  No audio issues.  So use that in future.  And maybe avoid Vegas 10?
          • The script was processed by “pulling” its output video stream through VirtualDub which saved it as a video file, again AVI-CFHD.  Since no filters (video processing) was to be performed in VirtualDub, I used it in [Fast Recompress] mode.  In this mode, it leaves the video data in YUV (doesn’t convert it into RGB), making it both fast and information-preserving.  Possibly (not tested) I could have simply have rendered straight from AvsP:[Tools > Save to AVI].  When I first tried that, I got audio issues, as reported above, hence I switched to rendering via VirtualDub, but in retrospect (having identified a source, perhaps the only source,  of those audio issues) that (switch) might have been unnecessary.
      • The resulting Master file was [Master 021a HDV 50i to HD 50p 1920×1080 (Avs-VDub).avi] date:[Created:[2013-07-08 21:55], Modified:[2013-07-08 22:47]]
        • “Modified minus created” implies a render-time of just under an hour.  This was on a [MacBook Pro (2009) > Boot Camp > Windows 7] having two cores, fully uitilised.
  • Quality inspection of Master:
    • Check image quality, e.g. deinterlacing, via VirtualDub.
      • VirtualDub is great in a close-inspection role because its Preview can zoom well beyond 100% and, vitally, it displays the video as-is, with no deinterlacing etc. of its own.
        • e.g. zoom to 200% to make any interlacing comb-teeth easily visible.  There should not be any, since this Master is meant to be progressive.
  • Premiere Project: Make a Premiere project consistent with the Master, and add chapter markers here.
    • Make Premiere Project consistent with the Master, not the Target.
      • …especially when there is more than one target…
    • Don’t directly encode the master (by Adobe Media Encoder), but instead go via Premiere.
      • I have read expert postings on Adobe forums stating that as of Adobe CS6, this is the best route.
      • This appears to be the main kind of workflow the software designers had in mind, hence a CS6 user is well-advised to follow it.
        • It represents a “well-trodden path” (of attention in CS6’s overall development and testing).
        • Consequently, (it is only in this mode that) high-quality (and demanding, hence CUDA-based) algorithms get used for any required scaling.
        • Not knowing the application in detail, hence having to adopt the speculative approach to decision-making, it feels likely that this workflow would have a greater chance of reliability and quality than other, relatively off-piste ones.
    • Premiere is the best stage at which to add Chapter Markers etc.
      • Chapter markers etc. get stored as ??XMP?? and are thereby visible to Encore (Adobe’s DVD-Builder)
      • Better to place such markers in Premiere rather than in Encore, since:
        • In Encore, Chapter markers act as if they are properties of Assets, not Timelines.
          • If you delete an asset from a timeline, the chapter markers disappear also.
        • Encore (CS6) Replace Asset has some foibles.
          • In Encore, if you were to put an [.avi] file asset on a timeline, then add markers then try to replace that asset with a [.mpg] file, you would be in for a disappointment; if the file extension differs then the markers disappear. If required, then the markers would have to be re-created from scratch. Same again if you subsequently replaced back to a new [.avi] file.
          • The Foibles of Encore (CS6)’s Replace Asset function, in more detail:
            • Good news: If the new asset has the same file extension then any existing markers are retained.
              • This possibly suggests that they are transferred from the old asset to the new one.
            • Bad news: If the new asset file extension differs from the old one, then:
              • You get an error (popup): ???
                • e.g. it refused my attempt to replace an [.avi] file by a [.m2v] file).
              • Partial-workaround:
                • You can instead delete the existing asset from the timeline, prior to dragging another asset there..
                • ..BUT as a side-effect that deletes any of the old asset’s markers also…
                • …and furthermore Encore has no way to copy a set of markers from one asset to another
                  • …which would otherwise have been a nice work-around for the above side-effect.
  • Premiere Export: Export / Render to Target Format.
    • You may wish to render to a number of formats, e.g. SD-Wide DVD, Blu-Ray Disk (BD), YouTube upload format, mobile phone or tablet.
      • The most efficient strategy is to Queue a number of jobs from Premiere onto Adobe Media Encoder (AME.
        • AME can run some things in parallel (I think).
        • AME has a [Pause] button, very useful for overnight silence or prior to travel (Windows Sleep/Hibernate).
    • Menu:[File > Export > Media]
    • Export Settings:
      • For targets of differing aspect ratio (e.g. SD-Wide derived from HD master):
        • Source Scaling:
          • e.g. for HD -> SD, use [Scale to Fill] since this avoids “pillarboxing” i.e. black bars either side.
      • For DVD Target, use inbuilt preset MPEG2-DVD
        • Ensure [Pixel Aspect Ratio] and interlace sense etc. are as required.
        • The [MPEG2-DVD] preset generates two files:
          • [.m2v] for the video
          • [Dolby Digital] or [MPEG] or [PCM]
            • [PCM] option results in a [.wav] file of 16 bits, 48 KHz (there is no 44.1 KHz option).
      • Maximum Render Quality
        • Use this if scaling, e.g. down from HD Master to SD Target.
      • File Path & Name.
        • Where you want the export/encode result to go.
    • Click the [Queue] button, to send the job to the Adobe Media Encoder (AME)
  • Quality Inspection of Result (intermediate or target file):
    • Check the quality of the encodes via VirtualDub, e.g. for DVD-compatible video media, the correctness of interlacing and for progressive media the quality of deinterlacing.
      • For interlaced downscaled material derived from higher resolution interlaced, the combs should be fine-toothed (one pixel in height).  A poor quality result (as expected for straight downscaling by any typical NLE such as Premiere, from HD interlaced to SD interlaced) would instead exhibit combing with thick blurry teeth.
      • VirtualDub is great tool for a a close-inspection role because its Preview can zoom well beyond 100% and, vitally, it displays the video as-is, with no deinterlacing etc. of its own.
        • In the past I have searched for and experimented with a number of candidate tools to be effective and convenient in this role.  VirtualDub was the best I could find.
        • e.g. zoom to 200% to make the teeth easily visible.
      • Plain VirtualDub is unable to read MPEG2 video, but a plugin is available to add that ability:
        • The [mpeg2.vdplugin] plugin by FCCHandler, from
          • It reads straight MPEG2 files, including [.m2v], but not Transport Stream files such as [.m2t] from the Sony Z1.
          • For [.m2v] files, VirtualDub may throw up an audio-related error, since such files contain no audio.  Fix: In VirtualDub, disable audio.
        • Its ReadMe file contains installation instructions.  Don’t just put it in VirtualDub’s existing [plugins] folder.
  • DVD Construction via Adobe Encore.
    • Name the Project according to the disk-label (data) you would like to see for the final product.
      • If you use Encore to actually burn the disk, this is what gets used for that label.
      • Alternative options exist for just burning the disk, e.g. the popular ImgBurn, and this allows you to define your own disk-label (data).
    • Import the following as Assets:
      • Video file, e.g. [.m2v]
      • If Video File was an [.m2v] then also import its associated Audio file – it does not get automatically loaded along with the [.m2v] file.
    • Create required DVD structure
      • This is too big a topic to cover here.
    • Quality Inspection: [Play From Here]
      • Menu:[File > Check Project]
        • Click [Start] button
        • Typical errors are actions [Not Set] on [Remote] or [End Action]
          • I plan to write a separate blog entry on how to fix these.
        • When everything is ok (within the scope of this check), it says (in status bar, not as a message): “No items found”.
          • A worrying choice of phrase, but all it means is “no error-items found”.
    • Menu:[File > Build > Folder]
      • Don’t select [Disk], since:
        • May want to find and fix any remaining problems prior to burning to disk.
        • May want to use an alternative disk burning application, such as ImgBurn.
          • From forums, I see that many Adobe users opt for ImgBurn.
      • Set the destination (path and filename) for the folder in which the DVD structure will be created.
        • At that location it creates a project-named folder and within that the VIDEO_TS folder (but no dummy/empty AUDIO_TS folder).
          • I once came across an ancient DVD player that insisted on both AUDIO_TS and VIDEO_TS folder being present and also they had to be named in upper-case, not lower.
      • Under [Disk Info] there is a colored bar, representing the disk capacity
        • Although the Output is to a folder, the Format is DVD, single-sided, which Encore realizes can hold up to 4.7 GB.
      • The [DVD ROM] option allows you to include non-DVD files, e.g. straight computer-playable files e.g. ([.mp4])
        • These go to the root of the drive, alongside the VIDEO_TS folder.
      • Finally, click the [Build] button.
        • On one occasion, it failed at this stage, with a “Encode Failed” or “Transcode Failed” (depending where I looked) error.  Solution: Shorten the file name.
          • Ok it was long-ish but I didn’t realize Encore would be so intolerant to that.  The suggestion of it only struck me later (the appearance of this guess was thanks to years of experience with computing etc.).
  • Quality Inspection of the DVD
    • I have found Corel WInDVD to show results representative of a standard TV with a DVD Player.
    • I have found popular media player such as VLC and Windows Media Player (WMP) to behave differently to this, hence not useful for quality-checking.   Problems I found included:
      • False Alarm: Playing went straight to the main video, didn’t stop at the Main Menu (as had been intended).  However it worked fine on a standard physical DVD player.
      • Hidden Problem: In one case I deinterlaced improperly, resulting in “judder” on movements when played on TV (via physical DVD player).  However it appeared fine on both VLC and WMP.
  • Metadata
    • In the case of WMV files, just use Windows Explorer:[aFile >RtClk> Properties > Details] and edit the main items of metadata directly.
    • For DVD generated by Adobe Encore, the Disk label (data) is the same as the Project name.
      • ImgBurn, a popular alternative to Encore as regards actually burning a disk, provides a way of changing this disk-label.

AviSynth Scripting Basics / Overview

Monday, July 8th, 2013

Multi-Threading in AviSynth

Monday, July 8th, 2013

Enabling multi-threading in AviSynth is dead-easy!


  • Get Modified AviSynth MT
  • Make a copy of the existing [avisynth.dll] on your system
  • Replace the original [avisynth.dll] with the one from “Modified AviSynth MT”
  • Use SetMTMode (with appropriate parameters) at the start of your script.
  • In the case of my simple scripts, that appears to be sufficient!


VirtualDub’s [Fast Recompress] Option Maintains YUV Color-Space

Monday, July 8th, 2013

Be not afraid to use VirtualDub to save AviSynth script results to a file, provided VirtualDub is in its [Fast Recompress] mode.

I had read that for the benefit of its image-altering filters, VirtualDub operates in RGB color-space, as opposed to YUV color-space, a lightly-compressed alternative that can represent a subset of RGB-space, and is typically used for video storage and transmission.  Given this, when running VirtualDub to take the output of one file, pass it through some “Filters” (effects) and generate another, the implicit color-space transformations would be YUV->RGB->YUV, thereby losing some quality (e.g. quantization banding on smooth gradients such as skies).

In contrast, AviSynth generally maintains YUV-space, unless your script tells it otherwise.  It’s designed so that opening an [.avs] script is broadly equivalent to opening a file.

This initially caused me concern at the thought of using VirtualDub to “run” (open and stream) an AviSynth script file (or rather, AViSynth’s result from that script) and save to a result file (as an [.avi] file).  Was there a way of avoiding the intermediate RGB color-space?  The answer is YES.

When VirtualDub is in its [Fast Recompress] mode, it gains not only “Fast” speed but also avoids quality-loss by maintaining the YUV color-space of the AviSynth video-stream..

AviSynth and Motion-Estimation-Related Processing by QTGMC & MVtools 2

Thursday, January 5th, 2012

Looking for some user-friendly top-down explanation of sensible uses of AviSynth.

See Web-Research further below.

I expect to update this post. (more…)

Velocity Remapping/Retiming by Motion Estimation: Alternative Tools

Thursday, January 5th, 2012

What tools are available for this?  What are their relative merits / costs (in all senses)?

  • First I tried Boris RED but encountered issues.
  • Next I investigated AviSynth, discovering two approaches:
    • MSU’s Frame-Rate Convertor (FRC)
    • MVTools2-based scripts; the latter was the more complex but for me it worked best.
  • Next I looked at MotionPerfect, which I purchased years ago from Dynapel back in Standard Definition days.
    • Nowadays sold by Gooder Video
      • They sell version 4.3.1
      • I have version 4.3.0
      • I updated it to 4.3.1
        • That shows a different icon/logo to the Dynapel version of that same product.
        • It works the same as far as I can see.
  • Another day(s):
    • Boris RED (4 & 5) via NLEs
      • Adobe
      • Avid
      • VegasAfter Effect
    • Kronos ??
    • Twixtor ??.
      • Some people claim this is the fastest motion-estimation-based method.
    • Avid ???
      • e.g. locate the (years-old) Avid velocity / warp envelope demo featuring a surfer ???


LightWorks with AviSynth (via AVFS)

Sunday, September 4th, 2011

Windows 7 Successful Use of [AviSynth > AvsPmod > avs2avi]

Sunday, September 4th, 2011

Made a simple AviSynth script to get an existing real HDV video (in Cineform format) and apply TDeint (motion-compensated deinterlace filter) to it.  Opened it in AvsPmod and it displayed OK.  Exported the result of that processing from AvsPmod via [Tools > Save to AVI].  This called up avs2avi.exe.  That executable’s menu of codec formats was as below.  NOTE the Cineform codec (following that company’s takeover) now comes under the name GoPro – I missed it the first time I scanned!  The test worked fine – deinterlaced video successfully exported to Cineform and subsequently played in Windows Media Player.

  •  Microsoft Video 1 (an ancient format – as explained at
  • Intel IYUV Codec (a very old format
  • Intel IYUV Codec (again)
  • Cinepak Codec by Radius
  • proDAD Saver for Mercalli (not sure it’s a real codec, maybe a “virtual” one, associated with the proDAD video stabilization plugin for Sony Vegas)
  • GoPro-Cineform Codec v7.3.2 (CINEFORM)
  • ffdshow Video Codec (several choices, shown when you hit Config button)
  • Intel Indeo Video 4.5 (From the “good old days”, I used it back then to compress PAL standard definition video from analog capture)
  • Full Frames (Uncompressed)

AvsPmod and x264.exe

Sunday, September 4th, 2011

Playing with AvsPmod, tried the [Tools > Save to MP4] option.  It prompted for a path to x264.exe.  Searched for one on my system – but there was none.  Searched in this blog but, although I’ve downloaded it before, I obviously didn’t blog it.  Web-search etc revealed where for my context and purposes the 32-bit app of 8-bit depth worked fine (the other variants did not)


avs2avi works fine under Windows 7 (W7)

Sunday, September 4th, 2011
  • Not sure why, but suddenly avs2avi.exe works fine on my W7 system.
    • Didn’t knowingly alter anything.
    • The only change I’m aware of is I uninstalled AviSynth 2.5.8 and installed AViSynth 2.5.7.
  • I’m using avs2avi as part of AvsPmod 2.2.0.
    • AvsPmod is itself in Compatibility Mode for WIndows XP-SP3 (otherwise it doesn’t work)
    • However I have not put avs2avi in compatibility mode.
  • It (avs2avi) works fine, both from AvsPmod and as standalone.
    • Just ensure it has write permission to its destination of course (no that wasn’t the problem before).

Virtualub wouldn’t open AviSynth .avs files – Fixed

Saturday, September 3rd, 2011

As described in, I was unable to successfully open .avs files in VirtualDub (1.9.11).  I had AviSynth 2.5.8 installed under Windows 7.  I tried uninstalling and reinstalling AviSynth, but this time stepped back to AviSynth version 2.5.7.  It worked – VirtualDub (1.9.11) can now open .avs files and display their images.  Not sure if it was just the clean reinstall or the step-back to 2.5.7.

AviSynth: Frameserve Virtual AVI: VFAPI & Alternatives on Windows 7

Saturday, September 3rd, 2011

Context & Problem:

  • I want a way to serve an AviSynth media stream into NLEs etc., e.g. Sony Vegas.  I have done this for years under Windows XP-SP3 (32-bit).
    • Partly just for the flexibility of having this option.
    • Partly (as explained at, as a workaround to another problem with old software under Windows 7.
  • However an attempt at installation in Windows 7 failed – because (I now know) the installer is obsolete (and hence incompatible) with respect to Windows 7.
    • VFAPI requires to be installed, via .bat/.inf files, so that for example it appears in the Registry.
    • But the installer fails under Windows 7.  It is compatible with XP but not Windows 7 (or Vista).
    • It is possible to manually “hack-install” VFAPI into Windows 7, but that causes me anxiety…

Possible Solutions:


AviSynth’s AvsP and avs2avi under Windows 7

Saturday, September 3rd, 2011

The context (AviSynth>AvsP>avs2avi):

  • The AviSynth greater community has developed a number of applications to simplify the development and use of AviSynth command-scripts.  One of these is AvsP, an AviSynth-script editor, has an option [Tools > Save using avs2avi].
  • Under Windows XP, this prompts for a location then prompts (in a separate popup) for codec details, then AviSynth renders (via avs2avi) to the required output-file.
  • There is a step-by-step tutorial at

A problem (works under XP but not W7):

  • Under Windows 7 Pro 64-bit (which can also run 32-bit apps), avs2avi merely produces an error message: <<AVIFileOpen failed, unable to open “f:\tmp.avs” : The operation completed successfully.>>  The last bit (“successfully”) merely indicates that the application (avs2avi) does not make a very thorough successfulness-check!
  • This issue was previously encountered & investigated back in March 2011:

Searching for a solution:

  • Experiments, unsuccessful:
    • After much web-trawling, I discovered a new version of AvsP, called AvsP(mod).  But it made no difference – same problem.
    • Next I tried running avs2.exe on its own, both with and without Compatibility mode enabled.  As well as XP-SP3 (which caused a further problem), I tried even older modes (that didn’t).  But no joy, the same error message was obtained.
    • I downloaded the latest version of avs2avi and also I tried the one that comes bundled with AvsP(mod), in its Tools folder,but again, no difference.
  • Asking for advice:


Cineform FirstLight: Interactive Grading for a Sony Vegas Project

Saturday, August 20th, 2011

The tutorial videos for FirstLight (linked in my previous post) made it look very simple.  And indeed it pretty-much is, but Sony Vegas introduces a “bijou problemette” (franglais) in teh form of its Video Preview cache, which lacks a corresponding “Clear Cache” button.  As a result, when I first tried using FirstLight with Vegas (10e), adjustments in FirstLight did not always show up in Vegas.  The possible solutions are:

  • In Vegas, set “Dynamic RAM preview (max) MB” to zero.  Then on each FirstLight change, just wiggle Vegas’s timeline cursor (playhead) at least couple of frames either way (moving it by just one frame is not sufficient).
  • Alternatively, if “Dynamic RAM preview (max) MB” is not set to zero,  then on the Preview window, try flipping between settings, like from Good/Half (my usual setting) to Good/Full.  It’s no good doing an open/close of that window or indeed changing its scale – these seem to have no effect on the cache.

AviSynth Scripts for 3D Stereoscopic Video

Friday, August 19th, 2011

Deinterlacing (De-Interlacing) Principles and Techniques

Friday, August 12th, 2011

I am not the only one wondering, of the various kinds of de-interlacing tools/algorithms available, what are their relative advantages and indeed which one provides the greatest quality (or maybe quality/computation ratio) ?  This subject has been raised repeatedly on the Sony Vegas forum.  Most recently, the following have been of note:

AviSynth – Multi-Threading Variant

Thursday, August 11th, 2011

AviSynth hasn’t changed in ages.  However there is a Multi-Threaded version, which responds appropriately to the MT() filter.

  • URL:
  • []
    • Includes MT(), a Multi-Threading “Meta-Filter”
    • Also includes associated MT-oriented version of AviSynth, v2.5.7.5.

AviSynth IResize Function

Monday, May 2nd, 2011

From [ ] referring to [ ].  Does low-pass filter “automatically” during resizing to reduce twitter/shimmer/aliasing etc.

  • source=AviSource(“d:\fs.avi”).ColorYUV(levels=”TV->PC”).AssumeTFF  #Expands levels if frameserved in YUY2
  • IResize(source,720,480)
  • function IResize(clip Clip, int NewWidth, int NewHeight) {
    •   Clip
    •   SeparateFields()
    •   Shift=(GetParity() ? -0.25 : 0.25) * (Height()/Float(NewHeight/2)-1.0)
    •   E  = SelectEven().Spline36resize(NewWidth, NewHeight/2, 0,    Shift)
    •   O  = SelectOdd( ).Spline36resize(NewWidth, NewHeight/2, 0,   -Shift)
    •   Ec = SelectEven().Spline36Resize(NewWidth, NewHeight/2, 0,  2*Shift)
    •   Oc = SelectOdd( ).Spline36Resize(NewWidth, NewHeight/2, 0, -2*shift)
    •   Interleave(E, O)
    •   IsYV12() ? MergeChroma(Interleave(Ec, Oc)) : Last
    •   Weave()
  • }

Spline36Resize can be replaced by another resizer if you wish.

Slow Motion in AviSynth (with or without Sony Vegas)

Sunday, March 20th, 2011

AviSynth TDeInt – Performance Tests

Sunday, March 20th, 2011

Performance results for deinterlacing by TDeint plugin within AviSynth (2.5.8 32bit single-thread).  Other versions of AviSynth exist, including 64bit multithread, though not all plugins are compatible with these.

  • SD 720×576 50i  → 720×576 25p, duration 14.5 minutes.
    • MBP (2010): 9 minutes.

AviSynth & AvsP & Avs2Avi on Windows 7 on MacBook

Sunday, March 20th, 2011

They all work fine.  Initially there were some teething problems, due to a bad installation of AviSynth, though that cause was not immediately apparent (meaning I spent hours experimenting and Googling before the moment of that realisation…).  Versions installed:

  • AviSynth 2.5.8 rev. 2
  • AvsP 2.0.2
  • Avs2Avi (Created 6 July 2004, size on disk 84 KB)

The main symptom of the teething problems: An AviSynth [.avs] script ran OK inside AvsP, to save to an AVI file, but before the dialog could ask me what codec, it failed with error message saying it could not open the source (.avs) file. (more…)

AviSynth FrameServer: Virtual AVI/WAV Files

Thursday, December 23rd, 2010

ffmpeg to transcode XDCAM-EX [.mp4] files to QT-DNxHD

Thursday, December 23rd, 2010

It is possible to use the open-source ffmpeg to transcode XDCAM-EX files to other formats, such as DNxHD.Information from as of 2010-12-23:

  •  ffmpeg -i input.mp4 -vcodec dnxhd -b 60Mb -acodec copy
    • 60Mbit is a 720p bitrate.
  • This is a good ffmpeg for pro users help site:
  • This is the command line I got from Baptiste who is developing the DNxHD stuff in ffmpeg.
    • Progressive:
      • fmpeg -i inputfile.mp4 -vcodec dnxhd -b 185Mb -acodec pcm_s16le
    • Interlaced: (The difference is the -flags +ildct)
      • ffmpeg -i inputfile.mp4 -vcodec dnxhd -b 185Mb -flags +ildct -acodec pcm_s16le
  • And this is a link to a DNxHD white paper:
  • We are thinking of using 36Mbit DNxHD but all people we talk to say to use 185Mbit or maybe 120Mbit and that 36Mbit is for offline.
  • But if you don’t have a problem using allot of GB on disc then go for Max Mbit for the specific resolution and framerate you use:
    • 1080p/25 DNxHD 185 1920 x 1080 8bit 25fps = -b 185Mb
    • 720p/50 DNxHD 175 1280 x 720 8bit 50fps = -b 90Mb
    • 1080i/50 DNxHD 185 1920 x 1080 8bit 25fps = -b 185Mb
  • More settings for other framerates:
    • http://www.itbroadcastanddigitalcine…#Encoding_VC-3
      • Had many commandlines and DNxHD settings, though sadly none for 1080p50 (as I require).
      • …and link is dead – as of 2016-08-18

Information from

  •  FFmpeg is now providing Avid DNxHD (SMPTE VC-3) encoding and decoding features

AviSynth usage in Adobe Premiere

Wednesday, September 1st, 2010

  •  We provide and maintain PremiereAVSPlugin – a plugin for Adobe Premiere that allows Avisynth scripts to be imported as normal video files

Getting AVCHD into AviSynth

Wednesday, September 1st, 2010
  • Google: [avchd avisynth]
    • []
      • My very own question, asked 15 Feb 2009, no replies since then.
      • Stated tha:
        • AviSynth via DgIndex etc. (as used by me) could read MXF files as far as their video was concerned, but not the audio.
    • []
      • Avisynth acts as a conduit for the mts files (you import as simple script into premiere).
    • []
      • *You’ll also need an AVCHD directshow codec installed. If you don’t have one, you can use the latest QTalternative
      • * You’ll also need to install Haali Media Splitter.
      • DirectShowSource(“myclip.MTS”) #use the name of the clip
      • DirectShow needs an MTS file reader/splitter to open MTS files. That’s what Haali Media Splitter is for.
      • There’s also the option of DGavcdecNV, which (if you have an Nvidia card) will use the GPU on the video card for decoding the AVCHD file. (See also
      • … links to two DirectShow AVC decoders: CoreAVC Proffdshow.
      • Deeper advice
        • When using DirectShowSource() AviSynth is asking Windows’ DirectShow subsystem to do all the file parsing, stream splitting, and audio/video decompression. If you can open your M2TS (or whatever) file with Windows Media Player then you have everything necessary for DirectShowSource() to work. If WMP will not play the file then you need to find and install the appropriate file reader, file splitter, and/or codecs.
        • (If) you are getting sound but no picture you probably just need a DirectShow decoder for the video. ffdshow includes MPEG 2 and h.264 decoders.
        • If you can’t get DirectShowSource() working you should try DgMpgDec (MPEG 2) or DgAvcDec (h.264). Run DgIndex or DgAvcIndex, and then use Mpeg2Source() or AvcSource() in the Avisynth script.
          • Sadly, at this time of writing (2010-09-01), it seems that DgAvcDec has been abandoned (due to uncomfortable “ride” along the licensed software approval process, with respect to used libraries ).
    • []
  • []
    • As DGAVCDec is withdrawn, this thread is now closed
      • Indeed I was unable to download it.  Also it was still in a state of development and testing, as far as I could see.   Shame.