# Proxynator – a script to link multiple files to proxies in After Effects

I’ve been working with 6K footage from our new Kinefinity Terra camera. To stop things grinding to a halt I’ve written a script for After Effects to allow me to set a whole folder’s worth of proxies at once.

While After Effects lets you create a proxy for a file, it’s pretty slow compared to ffmpeg (especially if you’ve got lots of cores–see below). What’s more, you can’t work on the project while you’re rendering the proxies whereas ffmpeg can run in the background. So for an efficient workflow it would be much better to use ffmpeg.

The problem you then face is that you have to manually link the files it creates, and After Effects will only let you link a proxy one file at a time. If you have dozens and dozens of files, that’s going to be really tedious and fraught with errors.

### Well not any more…

So there I was setting proxies for all of the source files one… by… one… and thinking that this kind of repetitive task is the kind of thing best left to a computonator. So here’s my script to speed up the process. To use it you select some footage items in your comp window, run the script (from File>Scripts>Run Script File) and then specify the folder where your proxies are. Then each one of the selected items will have its proxy set to the file with the same name as it from the specified folder.

If you want to have the script appear in the scripts menu, put it in the Scripts folder in the After Effects install folder (on Windows the Scripts folder is in a folder called Support Files, on Mac the Scripts folder is in the top level of the application folder). Next time you restart AE it will appear in the file>Scripts> menu.

### Maximising ffmpeg performance with multiple instances

If you’re on Windows and you want to batch-encode files, usingseveral instances of ffmpeg at once, here’s the powershell script I’ve been using

ls|%{
$fcount = (Get-Process "ffmpeg" -ErrorAction SilentlyContinue|Measure-Object).count while ($fcount -ge 4){
sleep 1;
$fcount = (Get-Process "ffmpeg" -ErrorAction SilentlyContinue|Measure-Object).count Write-Host ("{0}." -f$fcount) -NoNewline
}
$ArgumentList = ('-n -i "{0}" -c:v prores -profile:v 3 -vf scale=-1:1080 "{1}"' -f$_.fullname, ("\path\to\proxies\"+$_.name)) start-process "ffmpeg" -ArgumentList$ArgumentList
}

This will run 4 instances of ffmpeg at a time (change the number 4 on the line  while ($fcount -ge 4){to set how many you want to run), and it converts every file in the current folder to a proRes movie with 1080 lines (how wide it is depends on the aspect ratio of the source). You can change the encoding settings in the line $ArgumentList = etc. etc. Note that you also need to specify the full path to your proxy folder—at the end of that same line change  "\path\to\proxies" to whatever the full path is.