Easy Processing > Illustrator Export (bonus SVG export)

After a long time playing with ideas for an easy Processing to Illustrator tool that would allow fancy coding to be piped directly into Illustrator for further layout (and was vector-based the whole way through – no terrible rasterization allowed), I now have a really easy solution that doesn’t involve any fancy code, external libraries, or command-line nonsense.  The process:

1. Write your code as usual, but add PDF export

 

2. Run once and use File > Place… to insert the PDF into your AI document (do not simply open the document, as changes will not be reflected) — NOTE: be sure “Link” is clicked when placing

 

3. The resulting PDF, placed into the document as a single unit

 

4. Make changes in Processing and re-save the pdf – here we reduce the number of lines from 1,000 to 10

 

5. Back in AI, you will be prompted to update the pdf – easy!  No need to ask it, simply moving between programs updates your work

 

6. Awesome, done.

A dead end for this process was SVG export from Processing, which is not super easy (surprisingly).  Here’s my hack that uses Inkscape’s command line tools:

Creating Video With Processing and FFMPEG

Max/MSP users: look familiar?

For the past week I have been wrangling with getting ffmpeg (the open-source, command line video utility) to run in a Processing sketch and preserve the hard edges of graphical and/or intentionally pixelly video. It now works!

Details are listed in the code itself, but it is most important to note that the codec is likely the most important factor in getting good quality.   The “png” codec is great, but will create rather large files; mjpeg (MotionJPEG) also works well for graphics and hard edges (pixellated images, etc); H.264 is all-around good for photgraphic images.

The sketch below runs ffmpeg’s commands within Processing (as covered before) and exports a video from a series of still files.  Processing’s built-in video library seems ok, but offers little in the way of control as compared to ffmpeg.  Questions or suggestions are welcomed – feel free to use but please give credit!

UPDATE:
While I really don’t know why, the previous sketch seems to break with a Java IOException error.  It appears that ffmpeg can’t be found, but the solution is simple: specify the path to your ffmpeg install.  For example:

    /usr/local/bin/ffmpeg filename.mov etc...

The “-c:v” option to specify the codec is also updated to “-vcodec” and “-acodec”

[ download the updated sketch here ]

 

 

Installing ffmpeg (and LAME) on Mac Snow Leopard and Lion

A video still created programmatically; thousands of these can be combined into video using the ffmpeg library – faster and cleaner than a clunky Final Cut project

UPDATE 2: I ran into an error trying to install ffmpeg using these instructions yesterday.  However, installing using MacPorts worked like a charm! I suggest following the instructions for installing LAME first, then use MacPorts to install ffmpeg using the following command:

UPDATE: Having switched recently to Lion, the install below didn’t quite work.  With a small tweak, it appears to be ok – see below for details.

Well, it might not be Lion (doing live musical performance with my laptop makes me leary of new operating systems) but after finding little recent info on installing ffmpeg on a Mac, I’ve put together this basic outline.  For someone who isn’t great at installing libraries using Terminal, it wasn’t completely straightforward, but it works!  You will need the Apple Developer Tools to make this work (so far as I can tell).

UPDATE: I did a fresh install of XCode and had to do one small addition to get everything to compile.  For details, see this post.

This tutorial is based on the tutorial by Stephen Jungels, with some explanation and consolidation targeted at noobs (like myself).  Definite hat tip, Stephen!

The basic steps are as follows, full details after the break:

  1. Install Git
  2. Download LAME
  3. Download ffmpeg
  4. Find or create folder to install to
  5. Install LAME
  6. Install ffmpeg
  7. Test

Continue reading “Installing ffmpeg (and LAME) on Mac Snow Leopard and Lion”