1

I was unable to read MTS or MP4 files in AviSynth. Can AviSynth handle MTS files? pointed to the FFmpegSource2 filter, with information on the wiki. I downloaded the plugin and pointed to it from the first line

LoadPlugin("C:\path\to\ffms2\x64\ffms2.dll")
DirectShowSource("\path\to\MP4\file")

This threw error 0xc1. This thread mentioned different architectures, so I tried the x86 folder (C:\Program Files (x86)\AviSynth\plugins).

After a little while, Windows Media Player opens a dialog with this text (translated to English):

Windows Media Player is unable to open the file. It's possible that Media Player
does not support this type of file or that you need a codec that is not
installed. [Close] [Help online]

How can I enable FFmpegSource2 plugin in AviSynth?

1 Answer 1

1

The short answer, if you're familiar with AviSynth

You don't need to use LoadPlugin(), if you copy the four files in the plugin:

FFMS2.avsi
ffms2.dll
ffms2.lib
ffmsindex.exe

to the plugins directory of your AviSynth installation (see below for its location).

That's all. Then you directly use it in your AviSynth script calling its function(s), mostly the function

FFmpegSource2()

(or FFMS2(), which is the same, or FFMS2("your_file.ts", atrack=-1)) in concordance with documentation, but not DirectShowSource().


The long answer

If you're beginning with AviSynth, the rest of the answer will walk you through the pitfalls.

AviSynth versus AviSynth+

AviSynth has two versions, denoted AviSynth and AviSynth+, at the homepage:

Official builds
v.2.6.0 ST, 32-bit at SourceForge
...
Forks
AviSynth+: new features, backward compatible.

AviSynth 2.6.0 is a very old version, in spite of its title as an "Official build". You're better off with the new version for FFMS2. Download it from the official Github repo pointed to from the homepage.

The directory of plugins for AviSynth+

When you install the Github fork of AviSynth+, check the box Customize plugins directory to find the paths without changing them. Copy the four plugin files mentioned above to C:\Program Files (x86)\AviSynth+\plugins+ or to C:\Program Files (x86)\AviSynth+\plugins64+, depending on your version of Windows. The + at the end of the directory is for AviSynth+ instead of AviSynth.

The file FFMS2.avsi in the FFMS2 plugin is the same for both architectures.

If you copy it to the wrong directory, you may see this in Windows Media Player:

Cannot load a 64 bit DLL in 32 bit Avisynth: 
    'C:/Program Files (x86)/AviSynth+/plugins+/ffms2.dll'

which means that you should move those files to C:\Program Files (x86)\AviSynth+\plugins64+\.

Choose the appropriate media player

If you play the .avs file with Windows Media Player, you may see a .MP4.ffindex file for each file that you use with FFMS2() and the .avs file shows no image and no sound, only a musical note that looks like standard Windows.

Windows Media Player is not able to play back .avs files. Use Media Player Classic — you may get it with very useful K-Lite Mega Codec Pack — simply download and install it. Be sure to select the Mega pack, because the Basic pack doesn't contain the player.

Convert the script to a media file

Another possibility is to convert the .avs file into a media file, for example with FFmpeg:

ffmpeg -i your.avs output.mp4

FFmpeg chooses appropriate codecs automatically by the extension of the output file) and play back the result in (almost) any media player.

You may download the ready-to-use FFmpeg from Zeranoe's page — just unpack the downloaded archive file and add the path to ffmpeg.exe into your PATH environment variable.

10
  • You still used DirectShowSource filter. Use FFMS2 instead: FFMS2(your_file.ts, atrack=-1). You needn't use LoadPlugin(), it will be autoloaded by using FFMS2.
    – MarianD
    Commented Dec 29, 2019 at 0:23
  • 1
    It means that the directory into your copied file is NOT an autoload directory. I don't know which version of AviSynth do you use — see e.g. Plugin Autoloader. If you have a very old version, consider to download a newer one: Avisynth+ r2772-MT 64-bit + 32-bit (download links are at the end), or AviSynth+ 3.4.0 (only 32-bit IMHO).
    – MarianD
    Commented Jan 7, 2020 at 22:18
  • No, AviSynth+ 3.4.0 is both 64-bit + 32-bit, too.
    – MarianD
    Commented Jan 7, 2020 at 22:21
  • Which version of AviSynth do you have? (Put the version as a single row in your text editor, save it as version.avs and play it back.)
    – MarianD
    Commented Jan 11, 2020 at 19:13
  • It's very old version, in spite it's an "Official build" one. Use "Forks -> Latest release" (which is the same 3.4.0 as I already wrote in my previous comment) and download the .exe file (the installer).
    – MarianD
    Commented Jan 11, 2020 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.