stib's guff

 

Radio

Poison
This is just a bookmark for me really.

Seems the ABC website uses some lame flash based player or even worse, Real Player to deliver its live streams now. But buried on the site are links to aac+ streams (as well as windows media and mp3 if you're that way inclined).

Here, mainly for my benefit are the links to the AAC+ streams for my favourite stations.

ABC Classic FM
http://www.abc.net.au/res/streaming/audio/aac/classic_fm.pls

ABC News Radio
http://www.abc.net.au/res/streaming/audio/aac/news_radio.pls

ABC Radio National
http://www.abc.net.au/res/streaming/audio/aac/radio_national.pls

And while I'm at it..

WNYC's Q2 stream - they also try to get you to use some stupid web based player

http://www.wnyc.org/stream/q2/aac.pls

WFMU mp3 stream - they just put a proper link to the stream up like sensible people, but I might as well put it here too:

http://wfmu.org/wfmu.pls

WCBN - more free-form radio.

http://floyd.wcbn.org:8000/wcbn-hd.mp3

3 RRR - best goddam station in the world. One of these should work.

http://s2.stationplaylist.com:9020/3RRRFM.m3u

http://media.on.net/radio/114.m3u - via internode

http://iiradio.iinet.net.au:8027/  - via iinet (unmetered for iinet customers)

Posted by stib 

Comments [0]

My first (useful) extendscript toolbox project

if you're looking at the expression in the previous post you might notice that it only works properly for compositions where the layers are all the same size as the comp, with their anchor points in the middle. Like you get if you import a layered potatoshop file as a composition, but without choosing "retain layer sizes".

Import

If you're working with elements that are different sizes and have their anchor points away from the centre of the comp, then this means that they'll all scale from their own anchor points, defeating the purpose of the exercise – they'll look the same size, but they'll be in different apparent positions.

This was bugging me.

It bugged me enough that I wrote my first useful After Effects script using the Extendscript ToolKit. So here it is, my brand new moveAnchorPtToMiddleOfComp.jsx

Jsx
It does what it says on the can - moves the anchor point of the selected layer(s) to the centre of a composition. Select some layers, run it and there you go. Note that it doesn't work if you've rotated the layer. Scaled, yes, rotated, no.

Posted by stib 

Comments [0]

After Effects: how to lock a layer's scale to appear full size in the camera

if you're working with 3D in AE, a useful trick to know is how to make a layer fill the frame of the camera when moving it on the z axis. It's pretty easy with expressions.

Camera

If you look at the camera's properties (double click the camera layer or ctl/cmd+shift+y), you'll see the Zoom setting, which is a useful, if slightly counter-intuitive number – it's the distance that layers have to be from the camera to be at full size from that camera's view point. At twice this distance layers will appear half size and at haf this distance layers will appear twice their size.

It follows that if a layer is x pixels from the camera then x / Zoom is the factor we have to scale it to appear full size. The benefit of using zoom as opposed to the angle of view is that we don't have to mess about with trigonometry to get useful results.

TL;DR: to make a layer appear at 100% scale to a 3D camera, add this expression to the scale property of a layer (alt-click on the stopwatch to add an expression to a property):

scaleFactor=1 / thisComp.layer("Camera 1").cameraOption.zoom;
transform.scale * scaleFactor * length(thisComp.layer("Camera 1").transform.position, transform.position);

of course you will have to change "Camera 1" to the name of your camera. With this expression on, you can still change the scale of your layer with the scale property, it just multiplies that by a scale factor to match the relative positions of the camera and the layer.

I find this useful when setting up a 2.5D style comp, where different layers of an image are moved forward or backward, but retaining the original composition. Once I've set it up I turn the expression off, after converting the expression to keyframes.

Ce2kf
If you do this you'll find that it creates one keyframe per frame, which is annoying. Also, if you're doing this to lots of layers and your comp is really long it will have to calculate a gazillion keyframes, which is tedious.

Screen_shot_2012-04-11_at_12
The smoother can sort it out, but if you've done this all before doing any animating then you can just delete all the keyframes an you'll be sweet. Pro Tip: make your layer one frame long by parking the playhead at its in-point (hit i with the layer selected) and then hitting alt-] (left square bracket). Then it will only have to calculate one frame.

Filed under  //   2.5D   3d   After Effects   animation   expressions   motion graphics  
Posted by stib 

Comments [0]

comparison of tyre life on my bike. An on–going study

I'm interested in seeing how various tyres perform on my commute. Now that I keep track of my kilometers I can actually compare them objectively

brand price on off F/R
kms notes
Vittoria Rubino Slick
~$40 15/11/11 10/3/12 rear 2150 Wore holes in it by the end - last 20k was done with gaffer tape patches! A little bit of of dirt-road riding during this time, but probably less than 100km
Continental Gatorskin
~$38 14/3/12
1180km

rear

Filed under  //   bike  
Posted by stib 

Comments [0]

Note to future self: Encoding proRes with ffmbc for fcp

the voodoo is

ffmbc -i themovie.foo -vcodec prores -profile hq -acodec pcm_s16le output.mov

-profile can have the values: proxy, lt, std, hq. FCP likes signed 16Bit Little Endian audio.

Posted by stib 

Comments [0]

How very Borges of you

cute Processing easter egg:

Screen_shot_2011-12-22_at_12

Posted by stib 

Comments [0]

getting the most out of the 12 cores and MPEG Streamclip

Hercules_slaying_the_hydra-sml
I don't feel like I'm getting my money's worth from my computing equipment unless I can smell burning plastic. I paid for those CPU cycles, I want them to be used! That's one of the reasons all my machines run the World Community Grid - to soak up the my surplus computing power and use them for doing stuff like curing cancer. However when I do have a lot of crunching to do it pains me to see the CPU hardly breaking a sweat while I grind my teeth. Final Cut Pro, I'm looking at you.

Now it's easy enough with the command line to get a whole lot of processes running in parallel, that's one of the great advantages of CLI software like ffmbc and its older sibling ffmpeg. With GUI applications however you're generally limited to whatever multi-processor support the software maker built in. So here's a trick that can help you when you have CPUs and RAM to spare, but not time.

Command Line, Meet the GUI

There's an OS X - only command-line programme called open that, you guessed it, opens stuff. Generally it works as if you'd double clicked things with your mouse, so if you type open foo.png it will open foo.png in whatever your default application for looking at pngs happens to be, or if you point it at /Applications/someApp.app/ it will recognise it as an application and run it (In case you didn't know, applications in OS X are actually folders).

Where the magic happens is one of open's command line options. Here's the list of options from the man page:

-a application Specifies the application to use for opening the file
-b bundle_indentifier vSpecifies the bundle identifier for the application to use when opening the file
-e Causes the file to be opened with Applications/TextEdit
-t Causes the file to be opened with the default text editor, as determined via LaunchServices
-f Reads input from standard input and opens the results in the default text editor.
End input by sending EOF character (type Control-D).
Also useful for piping output to open and having it open in the default text editor.
-W Causes open to wait until the applications it opens (or that were already open) have exited.
Use with the -n flag to allow open to function as an appropriate app for the $EDITOR environment variable.
-R Reveals the file(s) in the Finder instead of opening them.
-n Open a new instance of the application(s) even if one is already running.
-g Do not bring the application to the foreground.
-h Searches header locations for a header whose name matches the given string and then opens it.
Pass a full header name (such as NSView.h) for increased performance.

Now the important one for us is the -n option. This lets us override the usual mac behaviour and lets you open more than one instance of a programme. This is great if you want to run something like MPEG Streamclip which has a built in limit of 4 simultaneous encodes. Here's a screensot of it running 3 instances, doing 4 encodes each.

Screen_shot_2011-07-21_at_2

The CPU and RAM on this machine had power to spare - I could have even run another instance if I'd needed it. And my job took a third of the time. 12 cores. Love it.

Screen_shot_2011-07-21_at_2
The magic words

So the script to get this going is simple. Open Terminal and type

open -n /Applications/MPEG\ Streamclip.app

rinse, repeat. Of course this works for other programmes as well, you just substitute /Applications/MPEG\ Streamclip with whatever the path to the application is.

You could of course further automate this process thus

for i in {1..12} #replace 12 with however many instances you want

do open -n /Applications/MPEG\ Streamclip.app

done

Let the computer do the typing for you!

Remember that bash is case sensitive. Also, there is no undo. So you need to type right. The easiest way to avoid typos is to use the shell's auto completion function. As well as saving typing, it actually makes sure that your commands are spelled correctly, and all the correct escapes etc. are there. In the example above I actually typed

open -n /A[tab]MP[tab]

where [tab] is me hitting the tab key. Basically you type enough text to uniquely identify the path you want – like autocomplete on a phone (one that has good autocomplete, not an iPhone).

I have no other folders at the top level of my file system starting with A so once I'd typed the slash followed by A, that uniquely identified the Applications folder, and the rest was filled in for me. Similarly the letters MPE are enough to uniquely match MPEG Streamclip. Note that it also puts the escape character \ in front of the space.

Spaces are special on the command line as they separate commands - so typing:

open -n /Applications/MPEG Streamclip

would be interpreted as two statements: open -n /Applications/MPEG, and Streamclip, neither of which would make any sense. You need to either enclose the path in quotes or "escape" the spaces with a backslash character.

It's not just spaces either. Remembering which characters need to be escaped can be a pain, so using auto-complete is really helpful.

Filed under  //   Final Cut Pro   bash   ffmbc   ffmpeg   hacks   mpeg streamclip   os x   shell scripting  
Posted by stib 

Comments [1]

script-fu for 5D footage shot with separate audio

Synch
I've been shooting footage on the 5D with separate audio on a zoom H4-N,and here's a trick for dealing with separate audio and video files.

I synch in FCP by matching the audio recorded by the 5D with the audio off the Zoom. It's a pain, but it's alot easier than synching on a Steenbeck. When I've got a match I modify the timecode of the video to match the audio, as the Zoom records with proper timecode, the 5D doesn't.

Now since editing h.264 footage in FCP is about as fun as falling off a bicycle into a barbed wire fence I make a proRes-422 production copy of all my 5D footage before I start editing. I keep my original camera footage in my archives, and if I want to be able to resurrect the project later without having to keep all my modified proRes movies I have to make sure that the origianal footage from the 5D matches the timecode of my production copies.

Luckily ffmbc lets me write timecode to files without any transcoding. So here's the script I use:

cameraFolder=/path/to/the/5D/footage/

productionFolder=/path/to/my/proRes/production/copies/

mkdir "$cameraFolder/Fixed_TC" #make a temporary folder for the new files to avoid stuff-ups
cd "$productionFolder"
for i in *;
do newTC=$( ffmbc -i "$i" 2>&1|grep timecode:|sed "s/[^0-9]*//");
oldTC=$( ffmbc -i "$oldfolder/""$i" 2>&1|grep timecode:|sed "s/[^0-9]*//");
echo "$newTC -- $oldTC"; #just for debuging
if [[ "$newTC" != "$oldTC" ]] && [[ "$newTC" != "00:00:00:00" ]]; #don't bother replacing movies that haven't been modified
then ffmbc -i "$oldfolder/$i" -vcodec copy -acodec copy -timecode $newTC "$oldfolder/fixed_TC/$i";
fi;
done

When it has done I can copy all the movies in the "Fixed_TC" folder over the original footage.

Filed under  //   Canon 5D   Final Cut Pro   bash   os x   shell scripting  
Posted by stib 

Comments [0]

Note to future self: Converting AVCHD .m2ts files for use in FCP

Screen_shot_2011-07-06_at_12

I was given a portable hard drive with a whole lot of video shot on a Sony AVCHD consumer camera, in the form of m2ts files. And now I'm faced with the task of turning them into something I can persuade FCP (7) to open. Log and transfer doesn't work (I'm assuming that whoever copied the camera files didn't do the right voodoo with the file structure) leaving a whole lot of orphaned files that FCP just refuses to open. Just to frustrate me, they play fine with VLC, so I can see them but I can't use them.

M2TS is the format used by blu-ray and some Sony cameras. It's an MPEG2 Transport Stream container, with h.264 encoded video inside. If you don't know what that means, it's a bit like getting a Betacam SP cassette case and putting an SD Card inside it. My first response is to break out MPEG Streamclip and batch them into ProRes. Gah! For once MPEG Streamclip lets me down. Episode, Compressor all fail too. Since VLC can play them I give the streaming / transcoding wizard from VLC a bash, but as usual it doesn't work. I've never yet had that thing work for transcoding - it looks like it's doing something, and takes a whole lot of CPU time to produce video files that won't play. Great media player though.

Turns out I shouldn't have mucked around with these GUI apps, I should have just gone straight to the command line. Using ffmbc (the 'broadcast' version of ffmpeg) I can convert them to quicktimes using an uncompressed codec (v210 in this case, I could have used qtrle - AKA Apple Animation codec - and saved some disk space, but v210 was four times faster). I want ProRes for my edit so I have to then recompress, but that's a simple job for MPEG Streamclip.

I had a bit of trouble working out what audio format Quicktime likes, turns out it's 16 bit signed, Big Endian. So just to remind my future self what CLI juju I need here's the magick for converting a folder of m2ts files:

for i in *.m2ts;
do ffmbc -i "$i" -vf yadif=0:-1 -vcodec v210 -acodec pcm_s16be "${i/m2ts/mov}" ;
done

The for loop is so it batches a whole folder of m2ts files. If you wanted to do just one you'd get rid of the first and third line and the do on the second line. and you'd replace "$i" with your input file and "${i/m2ts/mov}" with your output file. The  -vf yadif=0:-1 bit is for deinterlacing them with Yadif (the numbers mean 1 frame per two fileds and automatic field order), so if you don't want the output to be deinterlaced you could remove that bit.

Filed under  //   AVCHD   editing   shell scripting  
Posted by stib 

Comments [2]

Searching Firefox Bookmarks with Spotlight

I've only recently discovered the usefulness of Apple's Spotlight search tool. For some reason I'd never really clicked that it could be a very handy little launcher for applications and documents, until I noticed the Mac techo guy who came to plug all the wires in and adjust the tappets on my new 12 core machine at work <smirks>. But now I'm addicted - I've even mapped the Spotlight keyboard shortcut on to one of my mouse buttons and got rid of Butler.

So of course I couldn't be satisfied with just launching apps and dox, I want all my webs to appear in Spotlight too. After some googling I find that this isn't as easy as it would appear, especially if you don't want to use Safari.

Well here's what I came up with. A modification of this modification of a Perl Script that produces URL files. Why URLs? Well they're simple than webbokmarks, and since FireFox doesn't read the content of .webbookmark or .webloc filesbut relies on data in the resource fork, weblocs and webbokmarks didn't work anyway. Bad Firefox.

So I need a little helper app to read the url file and open FF at the right page. It's simple enought to do with a shell script or a bit of perl etc, but the OS won't let you assign these as the default app for the file type. So I used an AppleScript as a wrapper.

So if you want your Bookmarks to appear in Spotlight here's what you have to do.

first run this perl script:

#!/usr/bin/perl
use strict;
use warnings;
my $meta = "$ENV{HOME}/Library/Caches/Metadata/Firefox";
system("mkdir -p $meta");
system("rm $meta/*.url");
my $bookmarks = `find \~/Library/Application\\ Support/Firefox/Profiles/ -name 'bookmarks.html'`;
open (IN, $bookmarks);
while (<IN>){
    my $line = $_;
    if (($line =~ m|HREF="(.*?)".*>(.*?)</A>|) && ($1 !~ /^javascript\:/)){
   
        my $url = $1;
        $url =~ s/&/&amp;/g;
        my $name = $2;
        $name =~ s{[/:;\*\\\"\'\.\|]+}{-}g;
#         my $uuid = `uuidgen`;
#         $uuid =~ s/\n$//;
        print $line;
        open (OUT, ">$meta/$name.url");
        print OUT "[InternetShortcut]\nURL=$url\n";
        close OUT;   
    }
}

You can copy and paste it or download it here. To run, just open a terminal cd tot he directory you downloaded the script (usually cd ~/Downloads will get you there) and type perl ffbm.pl

If you want to open the links with Firefox or Chrome, read on:

FF on the mac doesn't handle .url files or .webloc or .webbokmark files properly. We need a little helper to read the files and kick the contents to Firefox / Chrome.

So I've created this applescript. Plonk it in your Applications folder (or wherever). This basically munges the .URL file to get the URL out of it, and uses your default web browser to open it. Here's the code:

on open theURLfile --called when the OS sends a URL file to the script
    openURLfile(theURLfile)
end open

openURLfile(choose file) --called when the user just runs this script by double clicking

on openURLfile(theURLfile) --the actual Hoo-Hah
    set URLfilePpath to POSIX path of theURLfile
    set theURL to (do shell script "cat  \"" & URLfilePpath & "\"|grep \"URL=\"|sed \"s/.*=//\"")
    do shell script "open " & theURL --the OSX open command opens whatever you give it according to your default application choice
end openURLfile

Screen_shot_2011-07-01_at_2
Now there's one last step. You have to associate the .url files with this wwwopener application. After running the perl script go to <home>/Library/Caches/Metadata/Firefox and choose one of the .url files that should be there. Hit Cmd-i to get information and change the Open With from Safari (or whatever it defaults to) to wwwopener.app (this doesn't change your default web browser, it just makes URL files open with the helper app, which then opens them in the default browser. If you're an Opera or Safari user you don't need to worry, as they read .URL files fine.

Filed under  //   firefox   hacks   os x   perl   spotlight  
Posted by stib 

Comments [1]