Monday 14 June 2021

Quick and dirty guide to using ffglitch/ffgac in Windows 10




This post is in response to a question posted in r/glitch_art about using FFglitch in windows 10 . Now I generally use linux exclusively but I've become aware over the last few months that I have to be a bit more inclusive, not everyone wants to run linux for one reason or another and I'm trying to port some of my examples to windows for that reason. 

What is FFglitch? Ramiro Polla's FFglitch is basically the best tool for datamoshing there is, Kaspar Ravels tomato v2 is a beautiful and simple tool but it has limits , FFglitch is more complicated to use but gives much more fine grained control of the process. Where to get it - here https://ffglitch.org/ it comes in Linux , Mac and Windows flavors Download it and unpack it, there's no need to install it, as its a standalone binary, but to use it we will need to take a few steps first.

First things first, download notepad ++  to alter scripts and settings with ffglitch its easier if you have a good editor - I recommend either geany or notepad++ so download and install that first if you havent got it installed already https://notepad-plus-plus.org/

FFglitch is essentially a command line tool , and this is where windows sucks , powershell is okay but we need a bit more power and some unix like tools which is where the git bash terminal comes in ( I've written about that before in a previous post ) you want to install this from here https://gitforwindows.org/  and follow the onscreen prompts carefully , generally its okay to go with the default prompts except where it asks for your default editor  - I recommend you tick the box that says notepad++ . Once its installed you will notice if you right click in a folder you now have an option which says 'gitbash here' - and this is what we are after, bash is a terminal like powershell but way more powerful, more of that later.

Optional - if you want to use python scripts, though the developer Ramiro Polla states he is moving away from those in favor of js there's a lot you can do with those scripts ( see Jo Grys posts in the facebook group glitch artists collective - tooltime  and also Kaspar Ravel and Thomas Collets work on implementing the game of life as motion vectors  with ffglitch )  . Sooo download and install chocolatey from here https://community.chocolatey.org/ then after that open powershell as adminstrator and do this to install python - choco install python --pre

so all of that out of the way I'm going to walk through the example I was actually asked about - the move sink and rise example that Ramiro Polla has on his website . First things first we need to change the format of any file we are using so it suits ffgac ( the new version is called ffgac not ffglitch ) which handily there is an example script to do just that - now one of the misconceptions people have on using ffglitch / ffgac is that they can use standard ffmpeg to prep their files and this leads to a further misconception which leads to trying and failing to use ffglitch / ffgac - and I think that explains the renaming - ffgac is a standalone version of ffmpeg designed to be used with this set of tools , all the scripts reference it and not any other version you may have installed - this is why we work within the ffgac / ffglitch directory . 

so prep your file with the script Ramiro Polla has on his website but modified for use with windows - open notepad++ and copy pasta what is  below  from  #!/bin/bash to done , save that script in the folder where you have ffgac as ffgacprep.sh 

#!/bin/bash
mkdir mpeg2

#change mp4 below to whatever the file extension your source file has
for I in *.mp4;
  do
             ./ffgac.exe -i "$I" \
             -an -vcodec mpeg2video -f rawvideo \
             -mpv_flags +nopimb \
             -qscale:v 6 \
             -r 30 \
             -g 90 \
             -s 1280x720 \
             -y mpeg2/"${I/.mp4/.mpg}";
  done
 

open git bash terminal in that folder ie right click and click on Git bash here - the terminal window will appear - before we can use that script we have to make it executable so in the terminal type in exactly this  ( without quote marks) '  chmod u+x ffgacprep.sh  '  - if all goes well there will be no error messages and the command line returns . so to prep your file now type in exactly in the terminal :

 ./ffgacprep.sh 

The script will create a folder within that folder called mpeg2 and output your file all ready for the next stage move it into the main ffglitch folder .

You could also use the command line commands shown on the website. So in git bash terminal and with your video in the ffglitch folder copy and paste that command into git bash terminal ( to paste into git bash terminal press shift and ins ) - change where it says input file to the name of your file - leave temp_file.mpg as your output file name unless your working on a lot of files and alter the first part of the script from ffgac to ./ffgac.exe ( cos we are working on windows and not linux ) so it will look like this ( but as one long line) - using the left and right arrow keys to navigate through the command and change it .

./ffgac.exe -i input_file -an -mpv_flags +nopimb+forcemv -qscale:v 0 -g 1000 
-vcodec mpeg2video -f rawvideo -y temp_file.mpg

Go back to the ffglitch website and go here https://ffglitch.org/2020/07/mv.html look for the section about halfways down where he says ' With all that being said, here’s the script that we will be using' open notepad++ and copy the script and save it in the ffglitch folder as  'mv_sink_and_rise.js' (without the quotes ) .

Now for the magic run the command he has on his website but for windows we change it to ;

./ffedit.exe -i temp_file.mpg -f mv -s mv_sink_and_rise.js -o glitched_file.mpg

copy and paste ( or type !) the above into git bash terminal and press enter :

Once that has run succesfully look for the file in the ffglitch folder and play it!

Once we have this running and you are happy with this process go back to Ramiro Polla's tutorials and start messing about with values in the mv_sink_and_rise.js script.


  

 

 

 


 



 

 

 


ikillerpulse ( requires tomato.py in working directory)

I've been working on this script for the last week or so. What does it do? It takes an input video/s,  converts to a format we can use f...