Avisynth using wine in Linux

Just a small guide about how to get avisynth to work in linux using wine.

If you run Lunar Linux like I do, you want to update your package list first followed by installing wine, if not already done. In Debian you’d do something like apt-get update and apt-get install wine.

# retrieve updates/new versions
lin moonbase; lin theedge
# install wine
lin -cr wine

When I initially wrote this article, I was using wine 1.2.2. Currently I’m using version 1.2.3. Right after installing wine, download the required files:


cp DirectShowSource.dll .wine/drive_c/Program\ Files/AviSynth\ 2.5/plugins/DirectShowSource.dll
cp DevIL.dll .wine/drive_c/windows/system32/devil.dll 
cp ILU.dll ILUT.dll .wine/drive_c/windows/system32/
cp fftw3win32mingw/fftw3.dll .wine/drive_c/windows/system32/
cp libfftw3-3.dll libfftw3f-3.dll libfftw3l-3.dll .wine/drive_c/windows/system32/
cp avs2yuv.exe .wine/drive_c/windows/system32/

You should have all basic things now. I’d suggest that you read through the import-filters on avisynth’s external-plugins page and install those you need. If such a filter is shipped with .exe files (like ffmpegsource‘ ffindex.exe) I’d suggest to place them into .wine/drive_c/windows/system32 because then they’ll be in wine’s PATH and issuing wine ffindex.exe will just work without the hassle to write down the whole path all the time.

Now you’re able to encode videos with avisynth. Here’s an example:

wine avs2yuv test.avs - | x264 --stdin y4m --crf 0 --fps 25 --output output.264 -

You might get one or some of the following errors:

Avisynth error: AVISource: couldn't locate a decompressor for fourcc xvid

Time to get winetricks from here.

# Now make it executable using:
chmod a+x winetricks
# and install some codecs:
./winetricks allcodecs

Another error:

Avisynth error: No compatible ACM codec to decode 0x2000 audio stream to PCM.

If you get that error, just use another Source filter, for example DirectShowSource() instead of AviSource(). Or you might use FFmpegSource.

fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.VC80.CRT" (8.0.50727.762)
err:module:import_dll Library MSVCP80.dll (which is needed by L"C:\\windows\\system32\\DevIL.dll") not found
err:module:import_dll Library DevIL.dll (which is needed by L"C:\\windows\\system32\\avisynth.dll") not found
failed to load avisynth.dll

Some plugins and above dll’s need a few things which you might obtain by winetricks. For example:
winetricks -> select the default wineprefix -> install a windows dll or component -> vcrun2003, vcrun2005 and vcrun2008

Another hint: use WINEDEBUG="-all" in front of wine or create a bash script for that. It will remove wine’s debug output. Just an example:


#  avisynth/avs2yuv/wine wrapper
#  author: Jean Bruenn <himself@jeanbruenn.info>
#  Syntax:
#    avisynth mode script.avs [output.264] [parameters]
#  Modes:
#    lossless (pipe to x264)
#      --crf 0
#    normal (pipe to x264)
#      --preset slower --tune film --ref 6 --bframes 5
#      --b-adapt 2 --direct auto --crf 18 --me umh
#      --subme 8 --trellis 2 --weightp 0
#    user (pipe to x264)
#    display (output using mplayer (realtime playback)
#    picture (output to /dev/null)
#  Explanation:
#    lossless and normal should be obvious, normal uses
#    the settings I'm usually using, you might want to
#    change them below. picture is a special case: sometimes
#    I'm using ImageWriter and thus I don't need x264 or
#    a pipe. You can use "user" to set your own settings.
#    display will just let mplayer
#    display the movie - useful for realtime playback.
#  Examples:
#    avisynth display test.avs 
#    avisynth lossless test.avs myfile.264 "--fps 50"
#    avisynth picture test.avs
#    avisynth user test.avs output.264 "--preset placebo --fps 25"
# general x264 parameters
genparm="--stdin y4m --thread-input"
# parameters for the normal/my usual x264 encode
normparm="--preset slower --tune film --ref 6 --bframes 5 --b-adapt 2 --direct auto \
    --crf 18 --me umh --subme 8 --trellis 2 --weightp 0"
if [ -z "$mode" ]; then
  echo " + Error: Mode needs to be given (display, lossless, normal, none, picture)";
  exit 1;
if [ -z "$avsf" ]; then
  echo " + Error: AVS needs to be given (path to your .avs file)";
  exit 1;
# x264 encoding
if [ "$mode" == "lossless" ] || [ "$mode" == "normal" ] || [ "$mode" == "user" ]; then
  if [ -z "$outf" ]; then
    echo " + Error: Given mode requires an output filename";
    exit 1;
  if [ "$mode" == "user" ]; then
    if [ -z "$parm" ]; then
      echo " + Error: Given mode requires additional parameters";
      exit 1;
      x264="$genparm $parm"
  elif [ "$mode" == "normal" ]; then
    x264="$genparm $normparm $parm"
    x264="$genparm --crf 0"
  WINEDEBUG="-all" wine avs2yuv $avsf - | x264 $x264 --output $outf -
  # mplayer display
  if [[ "$mode" == "display" ]]; then
    WINEDEBUG="-all" wine avs2yuv "$avsf" - | mplayer -cache 2048 -noidx -
  # picture part
  elif [[ "$mode" == "picture" ]]; then
    WINEDEBUG="-all" wine avs2yuv "$avsf" -frames 1 /dev/null
    echo " + Error: mode not implemented (yet?)";
    exit 1;

That’s all about it 🙂

No Comments

Post a Comment