Getting Blender output into iMovie ‘09

January 16th, 2011

Sometimes much pain is involved in learning something valuable. I learned something valuable today.

After going through some amazing Blender (http://blender.org) tutorials and getting my first decent animation finally ready to use, I ran into a hitch.

I’m sure there’s an easy way to do this, but I couldn’t figure out a good way to get the animation produced by Blender into iMovie.

I’m running Blender on Ubuntu 10.04, and I need to get high-definition video onto my wife’s iMac where I can use it in iMovie. Sounds easy, right? All the hard part was learning to use Blender (thanks to some really amazing tutorials, and it is an incredibly powerful piece of software – with a bit of a learning curve.

Unfortunately Apple did not give much thought or consideration into making it easy to get various video sources into iMovie. If you connect your HD camcorder, it will read video. If you copy .mts or .m2ts files onto your iMac’s hard drive, it doesn’t know how to import them. I found a useful suggestion on how to use ffmpeg to convert the container (leaving the avchd video codec stream intact) to an mp4 that iMovie is happy to import using File -> Import movies…

Blender has an ffmpeg output option. You want to select output settings where both the vertical and horizontal are multiples of 16. Use avi file format with the mpeg4 (xvid) codec:

Options for ffmpeg output to mpeg4 section 2 in avi format

The parts in yellow are the important ones. I’m running Blender 2.49b. Note that in this example  I’m not going all the way with HD – 1280×720 is enough for me. If you wanted to go 1920×1280 you would need to increase the bitrate from 6000 (kbps) to something like 9000.

If you had selected the h.264 preset before, you ‘ll want to delete the options that may have shown up. The menu button doesn’t work for me, it crashes Blender. Ouch!

Once you have all these settings, and perhaps specify your output directory, go ahead and render using Ctrl+F12

Preparing your output for import into iMovie is easy:

ffmpeg -i /tmp/mymovie_0000_0300.avi -b 6000k -acodec none -vcodec mpeg4 /tmp/mymovie.mp4

As mentioned above, if you used a higher bitrate for HD video in the Blender output options, you’ll want to use the same value here with -b

Once you’ve done this, you can copy the mp4 file to the imac and use File -> Import movies… from iMovie

Updates on Chumbotics

March 14th, 2010

Not much time for fun projects with the way work has been, but in these times it’s good to be employed (or so I keep telling myself).

I’ve started a more serious blog focused on software process issues over at http://grooversoft.com/blog (my wife’s business). I had done some robotics work over the summer which I need to write about with photos. I basically added a picture frame platform to my roomba base with video capture capabilities (then crashed it and ruined the touchscreen, but the unit still works).

But yikes! almost two years since my last posting here. Lots of spam comments but time to write some entries again…

ChumbyCam

June 22nd, 2008
Another Chumby firmware validation challenge developed into an interesting project.

The free http://justin.tv service allows you to connect any webcam for broadcast using a Flash 9 widget that takes your mic and webcam input and uploads it for rebroadcast. These are features that aren’t currently supported in Flash Lite, so typically it would be used with a Linux or Windoze desktop machine.

There were some issues to validate with webcam display which turned out to be related to an unrelated problem.

I took it one step further and tried to use Chumby to display the output of an IP webcam. I chose the D-Link? Ethernet-connected DCS-900 model, largely because it was cheap and simple. It’s around $90 USD and offers a built-in http connection. It offers java and activex viewing of the image stream but those didn’t work right out of the box, and I didn’t have 5 minutes to rtfm so I might have missed some vital step. But the jpeg feed works just fine.

And I had a good test opportunity in-house (literally): a 2.5-year-old boy who presents a potty training challenge. An early riser, he gets to watch PBS Sprout for a commercial-free hour or so while squatting on his pot, but likes to get up. This is also my time for getting some work done in the next room, so I wanted to use Chumby as a remote monitor.

Knowing the IP address of the webcam, I could write this script on the Chumby, and start it by stopping flashplayer and running the script:

stop_control_panel
/mnt/usb/bin/showcam >/dev/null 2>&1

Here’s the script. It’s slightly more elaborate than needed since it caches the last 30 images. Since I’m continually invoking wget I don’t need to do anything to avoid caching – wget does not do any persistent caching by default…

#!/bin/sh
CAMIP=192.168.1.127
CAMPORT=80

SERNO=0
SEQ=$(date +'%Y-%m-%d-%H%M')
mkdir /tmp/$SEQ

while :
do
if wget -O /tmp/${SEQ}/img${SERNO}.jpg http://${CAMIP}:${CAMPORT}/IMAGE.JPG
then
imgtool /tmp/${SEQ}/img${SERNO}.jpg
else
echo "Unable to fetch image"
exit 1
fi
SERNO=$(expr ${SERNO} \+ 1)
[ ${SERNO} -gt 30 ] && SERNO=0
done
Oops, gotta run… my little boy just got up and I don’t feel like carpet-cleaning right now…
I’ve also put this on my wiki under Chumby-related…

Back on the paper trail

May 7th, 2008

I was horrified to see how long it’s been since I’ve released an update to Papercut. I do have some lame excuses like “work has been keeping me busy” but it’s time to get back on the paper trail. I was in the middle of fixing image rotation, which would allow photo-dodecahedra to be more meaningful.

Chumbotics – part 1

May 6th, 2008

A recent project I’ve had a lot of fun with involves using off-the-shelf components and some good old-fashioned software development.

It started out with my work at Chumby.com on the Flash Lite player. I needed to explore using a Flash movie for robotic control via RS-232. The outcome is what I have here.

Ingredients:

  1. Chumby. Cost: $180, shipping included. Available from chumby.com (I work for chumby.com btw)
  2. iRobot Create. Cost: $130 plus shipping from irobot.com, includes the serial cable. You’ll also need a rechargeable battery ($59) and charger (either $69 for the home base charger or $35 for the 12-hour brick charger). You can shell out $230 for the create, command and charge package, which will also include the ATMel-based command module (which you don’t need for this project but can be used for other robot projects). Total cost will be $230 minimum.
  3. USB serial cable. Cost: $15-20 from Fry’s. The Q-stor adapter is one of the cheaper ones they stock and is $20 – there used to be a $15 GQ USB serial cable that also works. Any USB serial adapter that uses the pl2303 driver in linux will work.
  4. 9.6v rechargeable battery for the Chumby. You can get a 1200mah Ni-cad battery pack from Fry’s used for R/C cars for about $15 (with charger, $17). You’ll need to connect it to the 9V battery connector on the Chumby, which is accessible through the velcro opening on the bottom of the chumby. You’ll need to do a little cut and crimp to splice a 9V battery connector onto the battery pack. Remember that the final result needs to have the same polarity as a battery, which means the color-coded red and black wires may be opposite from the wires on the 9.6v battery pack. Check the polarity of the final result to make sure it comes out the same as a regular 9V battery:

    Correct polarity of 9V battery connector

That’s it for the hardware components. The iRobot Create has a DB-25 connector in the cargo bay with a lot of potential for expansion. The next post will cover putting it together and doing some basic tests.