The Place Where Wishes Come True

Keep Fighting

How to Use 64-bit X264 With 32-bit AviSynth

For some reason I had to use AviSynth 2.6, of which I could’t seem to find a 64-bit build. But I did’t want to use 32-bit x264, because the 64-bit version had much better performance on 64-bit machines.

After some research, I found avs2pipemod. avs2pipemod is a program that pipes the output of AviSynth to other programs, with which we are able to connect 64-bit x264 and 32-bit AviSynth.

Because we will be piping raw video, we have to specify the parameters of the video manually. Fortunately avs2pipemod is able to generate those arguments for us. First we execute the following command:

avs2pipemod -x264raw SCRIPT.avs

And we will get something like this:

- --demuxer raw --input-csp bgr --input-depth 8 --input-res 1920x1080 --output-csp rgb --frames 24429 --fps 30030/1001

Of course the values will change depending on your source. So now we can call x264 with those arguments

avs2pipemod -rawvideo SCRIPT.avs | x264 - --demuxer raw --input-csp bgr --input-depth 8 --input-res 1920x1080 --frames 24429 --fps 30030/1001 --preset veryslow --crf 23 -o OUTPUT.mkv

It’s just copying the arguments generated by the first command, plus the arguments you would like to use for encoding.

For some reason when I tried this, I got my encoded video upside down. I am not quite clear what caused that. However the problem can be easily solved by changing the previous command a little bit:

avs2pipemod -rawvideo=vflip SCRIPT.avs | ...

The x264 part remains the same. I only tried once, so I don’t know if this happens to just some or all videos. You definitely want to check your result to know if it is necessary for you to use vflip.

So far we’ve done the video part. For audio, use the following command:

avs2pipemod -wav SCRIPT.avs | flac -8V -o OUTPUT.flac -

Here we are piping the audio in WAV format, therefore we don’t need to specify the parameters of the audio. Of course you can use whatever encoder you want.

Now just mux the two streams and you are good to go.

Comments