Dart Score Keeper

January 12, 2014
In game shot showing clickable dart board and score table.
End of game shot showing heat map of winning user's throws.

Access the Dart Score Keeper App!

 

For Christmas I received a dart board.  Excited to get back into darts I dug up my old Java Dart Score Keeper, but unfortunately it isn't working with my version of Java.  Rather than patching it, I set out to create a new scoring app using the SVG jQuery darts board interface from David Williams.  

 

Features:

  • Unlimited Players
  • Desktop and tablet support
  • Click directly on the board to add your points
  • Point history with round subtotals
  • Throws are plotted as a heat map on the board at the end, showing which sections were hit the most for each player.
  • Unlimited Undo

 

The app isn't as polished as I might like, but it certainly works.  If you have a suggestion for an improvement please leave a comment below.

 

Tags: 

Finally, true video rotation on the iPhone!

October 27, 2013

The "Video Rotate" app from Gadget Juice is just what I've been looking for!  It allows you to do a frame-by-frame reencode of movies on your iPhone adjusting for a specified rotation.  This is useful if you accidently switch rotations during recording, but is also useful for rencoding the video so it can be played back in VLC and other non-Apple players with the proper rotation.

 

When you first open the app it will ask for permission to access your photo library.  Once you grant that access, you can see your recorded videos in a list.  Tap on the video you wish to modify.

 

The app detected that my video already had a meta tag saying the rotation should be 90°.  Even though it was already selected, I tapped on 90° and was prompted to choose a rotation mode.

 

Choose "Slow" mode to re-encode your video.

 

On my iPhone 5s I was averaging around mid-fifties for re-encoding framerate.  Not bad!  My wife's iPhone averages in the mid-thirties.  This sort of heavy lifting really shows how a 64 bit architecture improves performance.

 

Once done your new movie (complete with a new filename) is added back into your library.

 

My original movie was 27.3 MB.  After the reencoding it was 34.7MB.  I didn't notice any degradation in quality.  Keep in mind at this point it is still a 1080p video.  I like to save my files in 720p to save on storage space.  I shared the new movie with my mac via iMessage (send an iMessage to yourself from the iPhone with the Messages app open on the mac) and it came across as a 3.7 MB 720p video.  I haven't spent much time comparing the quality of the iMessage encode to that of Handbrake, but my guess is handbrake is much better so I will continue to use it.  By the way, did you know the Handbrake app can do batch?  Just add an entire folder to Handbrake, it will scan each movie as a separate title.  In the File menu you'll see there is a new "Add All Titles To Queue" option :-D

Getting slomo video off the iPhone 5s

October 26, 2013

I upgraded to the iPhone 5s and ran into a new problem.  How do you get the slomo video off the iPhone?  When I pull the videos using Image Capture it copies over the 120 FPS movie, as well as an .SLM file.  The SLM file is XML containing the start point and duration of the slomo event, which is how the iPhone knows how to control the playback.  Opening the .MOV in Quicktime just plays back the video at normal speed, although it does now contain a new "Slo-Mo" button"

 

 

You can use iMovie to split your movie and make the desired segment playback at 25% speed, but that doesn't nicely transition into and out of the Slo-Mo the way the iPhone does.  

 

Best thing I've found so far is to iMessage the movie to myself out of the Photos app on the iPhone.  The movie comes over at 720p with the nice slomo fade-in exactly as it was on the iPhone.  My test file was 131 MB straight from the iPhone, and 21 MB after I iMessaged it to myself.  So I like this solution because it keeps the Slo-Mo exactly the same as my iPhone and it compresses the video.  The outstanding issue remains rotation.  As mentioned in an earlier post I've found that all iPhone videos are shot with the volume-button side of the iPhone as down.  QuickTime respects whatever meta flag is used to signify playback rotation, but VLC and others do not.  

 

Please let me know in the comments if you've found any other solutions, or a way to overcome the rotation problem.

 

Equilateral Triangle Tato

August 12, 2012

A tato is a Japanese container that lies flat.  They tend to be symmetrical.  Letter folds are meant to contain a message, and envelopers are containers that are usually sealed after use.  Tatos are meant to be reusable.  Through the ELFA mailing list and my own research I have found how to build tatos for three to eight-sided regular polygons.  Most instructions for a triangle start from a triangular piece of paper.  I found a way to do it from a square.  

Tags: 

Fortaleza Envelope

August 12, 2012

I created this envelope fold a couple years ago while playing around with folding in thirds.  It is not the most elegant envelope, but I can can truly say it is my own creation.  All too often after discovering an envelope fold I find it already documented somewhere else months later.  After sharing this with the ELFA mailing list, no one has mentioned any similar models.

Tags: 

Sunflower Palm Wax

April 17, 2012

Someday I'll learn how to take a picture of a candle made from palm wax, mine don't do it justice.  This candle is made with "Starburst" palm wax, which naturally crystalizes as it cools.  It was made as a unity candle for a sunflower themed wedding.  I dyed the base yellow and poured at about 190°.  When the wax had cooled to 150° I carefully added three drops of liquid brown dye.  At this point the wax is still liquid, giving some time for the dye to slowly swirl around and create the leaching effect.  Any hotter and it spreads too evenly, any cooler and it doesn't spread enough.

Brazilian Flag Candle

March 24, 2012
Front of Brazilian flag candle
Side view of Brazilian flag candle
Stenciled pieces fitting together
Putting it all together

I made this Brazilian flag candle as a thank you gift for a family that hosted my wife and I for a week.  I got the dimensions for the flag from this graphic on wikimedia.org.  I sketched the design on paper within a 3" x 6" rectangle and cut out stencils for the green, yellow and blue portion of the flag.  I selected colors from my recycled wax bricks that were close to the real colors, melted them down and poured them into glass pans.  It was important to melt exactly the same amount of each color so the thickness in the pan would be consistent.  After the wax had cooled for about 30 minutes it had the consitency of cheese.  At that point I laid my paper stencil on top of the wax and cut around it.  Once the wax had cooled the rest of the way the wax popped out pretty easily and I had the desired shape.  Unfortunately when I was making the green portion it cracked getting it out of the pan.  I learned my lesson and made multiple copies of the yellow diamond and blue circle.  Looking back I wish I would have redone the green section.  Oh well, live and learn.  The pieces needed a little shaving to fit together snugly.

Initially the plan was to simply have the flag on one side of the candle and use white wax for everything else.  I was afraid that after I poured the white wax the stacked flag pieces would collapse, so I decided to hold it in place with chunks which I made from the leftover green, yellow and blue wax.  I've done one other candle this way, and there again I solved the "hold the slabs in place" problem with chunks.  The pieces of this candles don't fit together perfectly, there were natrual gaps resulting from my inaccurate process.  This actually works to my favor as it allows the white wax to work its way in and hold everything together mechanically.  If there were no gaps, there'd be nothing for the white wax to grip on to, and the entire flag portion would slough off eventually.

The candle is made entirely out of recycled wax.  I'll have to do a post about this someday, but basically I melt down old candles and scrap wax of similar color, filter out the gunk, and form bricks.  I have multiple storage containers filled with bricks of wax arranged in ROYGBIV order.  Working with new wax looks better, but is more expensive.  Recycled wax on the other hand is very cheap  You can usually find old partially melted candles at garage sales for a few cents.  My candle making hobby started off entirely from recycled wax.  Nowadays I use it just because I think it is cool to give new life to the former waste.

 

Jacob's Ladder Envelope

February 5, 2012

Yami Yamauchi has an Origami model called "Jacob's Ladder". There is a variation called the "Magic Wallet", but I found the instructions to be complex and the final piece allows the contents to slip out. I've revised the model to add a pleat to the top and bottom so contents are held securely in place. I've diagrammed the revision, which I'm calling "Jacob's Ladder Envelope". The diagram shows how to build the envelope with 8.5 x 11" paper to perfectly hold credit-card sized objects. This revision is also thinner, has nicer looking edges, and introduces two new pockets to the outside of the envelope.

Please try it out and and share your experiences. I appreciate any feedback. I've uploaded a video of myself demonstrating the envelope to YouTube.

http://www.youtube.com/watch?v=pokAJV2PpZ0

http://thom-patterson.com/Origami/Jacobs_Ladder_Envelope.pdf

Tags: 

iPhone video rotation (and compression)

January 13, 2012

I have found two problems with video recorded from my iPhone 4s.

  1. File sizes are very large.

The iPhone records H.264 at 1920x1080 with a bitrate of 24.0Mbps.  A one minute video is 180MB.

  1. Video playback is sometimes upside down or rotated 90 degrees CW or CCW.

The iPhone records all video with the volume buttons side down.  This means nearly all landscape videos will be upside-down as the Volume-Up button is the start/stop recording trigger.  Portrait videos will appear to be rotated 90° counter-clockwise if they were recorded with the Home button at the bottom.  The iPhone embeds meta data within the video that tells the player how to rotate the video to make it right-side-up for playback.  While QuickTime and others respect that meta data, my preferred player, VLC, does not.  Since I will be sharing my videos and I do not know which players my audience will be using, I want to correct the video stream to be right-side-up regardless of the meta data.

The first problem is very easy to deal with, compress the video with something like Handbrake.  I've also noticed that the 1080p video can be grainy, so I can further reduce the filesize and not lose too much quality by downscaling to 720p.

The second problem is more complex.  Unfortunately HandBrake (or at least the GUI) does not offer a way to rotate video.  The HandBrake CLI does have a "rotate" option, however I found it is not a true rotation.  Rather, it simply flips on an axis.  The documentation is poor, but I found that a value of 1 flips on X, 2 flips on Y, and 3 flips on X and Y.  So using a value of 3 is the same as doing a 180° rotation, which is useful for videos that are upside down, but not for videos that are sideways.  After a bit of hunting I discovered that mencoder can do proper rotation.  I didn't want to spend the time trying to compile my own mencoder binary, so I found some precompiled mac binaries that others had done.  I couldn't find a Mac OS X mencoder binary that has both faad support (to decode source aac which the iPhone uses for audio) and x264 (to encode h264).  I settled on one I found at stefpause.com which can read aac and outputs to raw.  The solution I came up with was to use mencoder to rotate the video, and have it output raw video and pcm audio.  I then pass that raw input into the HandBrake CLI to do the downscaling and compressing.  The raw temp files are stores in /tmp, and they do get very large.  This isn't a problem for me as most of my videos are under a few minutes.  If you are going to be doing anything much longer you probably want to find a better mencoder binary that can do it all for you so you don't need to do raw to handbrake step.

 

The following direction are known to work on OS X 10.7.2:

  1. Create a directory for this project.
  2. Download the HandBrake CLI from http://handbrake.fr/downloads2.php.  I grabbed the 64 bit version 0.9.5.  Mount the disk image and move HandBrakeCLI into your project directory.
  3. Download mencoder.zip from http://stefpause.com/apple/mac/mplayer-os-x-10rc1-and-mencoder-binaries/ .  Copy mencoder into your project directory.
  4. Using TextEdit, or your plain text editor of choice, create a file named "iPhoneFlipVertical.sh" in the project directory.  Copy the following contents into this file.
# used to flip iPhone videos that are upside-down in landscape right-side-up.  Takes iPhone 4s 1920*1080 video, compresses and outputs at 1280x720
# $1 is input file
# $2 is output file, should end with .m4v
# https://trac.handbrake.fr/wiki/CLIGuide
width=1280  #height will be scaled to preserve aspect ratio
audioBitrate=128 #AAC kbps
constantQualityRF=22 #https://trac.handbrake.fr/wiki/ConstantQuality  22 looks good for iPhone
start="started at `date`"
# advanced options from HandBrake preset
x264Advanced="ref=2:bframes=2:subq=6:mixed-refs=0:weightb=0:8x8dct=0:trellis=0"
# rotate, 1 flips on x, 2 flips on y, 3 flips on both (equivalent of 180 degree rotation)
./HandBrakeCLI -i "$1" -o "$2" -e x264 -O -B $audioBitrate -q $constantQualityRF -w $width --denoise="weak" --rotate=3 -x $x264Advanced
echo $start
echo "finished at " `date`
  1. The string for the x264Advanced variable can be obtained from the "Advanced" tab in the HandBrake GUI.  Shown above is the string from the "Normal" preset.

  1. Create another file named "iPhoneRotate90CW.sh".  Copy the following contents into this file.

# used to rotate iPhone portrait videos 90 degrees clockwise.  Compresses and outputs at 720x1280.  Note on the iPhone the side with the volume buttons is always "down" in videos.
# $1 is input file
# $2 is output file, should end with .m4v
# https://trac.handbrake.fr/wiki/CLIGuide
# http://git.mplayerhq.hu/DOCS/man/en/mplayer.1.html
#couldn't find a mac os x mencoder binary that has both faad (to decode source aac) and x264 (to encode h264).  Settled on this one which can read aac and outputs to raw.  Uses a lot of disk space!
start="started at `date`"
tmpRaw="/tmp/`date +%s`.raw"
#./mencoder -vf rotate=1 -ovc x264 -oac pcm "$1" -o "$2"#this is what we'd do with a better mencoder binary (x264 support)
./mencoder -vf rotate=1 -ovc raw -oac pcm "$1" -o "$tmpRaw"
height=1280  #width will be scaled to preserve aspect ratio, 720x1280 for vertical iPhone
audioBitrate=128 #AAC kbps
constantQualityRF=22 #https://trac.handbrake.fr/wiki/ConstantQuality  22 looks good for iPhone
x264Advanced="ref=2:bframes=2:subq=6:mixed-refs=0:weightb=0:8x8dct=0:trellis=0"
./HandBrakeCLI -i "$tmpRaw" -o "$2" -e x264 -O -B $audioBitrate -q $constantQualityRF --height $height --denoise="weak" -x $x264Advanced
rm "$tmpRaw"
echo $start
echo "finished at " `date`
  1. In Terminal, cd into the project directory and make sure the permissions looks like this.  You'll probably need to run chmod 744 *.sh
-rwxr-xr-x@ 1 Thom  staff  16765320 Jan  3  2011 HandBrakeCLI
-rwxr--r--@ 1 Thom  staff       843 Jan  4 21:49 iPhoneFlipVertical.sh
-rwxr--r--@ 1 Thom  staff      1252 Jan  4 21:50 iPhoneRotate90CW.sh
-rwxr-xr-x@ 1 Thom  staff   8090416 Sep  7  2008 mencoder

 

To flip a video upside down, execute the following command in Terminal (within the context of your project directory).  Change the first argument to the path of your input file, and the second argument to the path of your desired output file, which should end in ".m4v".

./iPhoneFlipVertical.sh ~/Desktop/IMG_0095.MOV ~/Desktop/IMG_0095.m4v

 

To flip a video 90° clockwise, execute the following command in Terminal (within the context of your project directory).  Change the first argument to the path of your input file, and the second argument to the path of your desired output file, which should end in ".m4v".

./iPhoneRotate90CW.sh ~/Desktop/IMG_0112.MOV ~/Desktop/IMG_0112.m4v

 

"Before" landscape video.  Length = 1 minute.  Size = 182 MB.
"After" landscape video.  Length = 1 minute.  Size = 70 MB.

"Before" portrait video.  Length = 10 seconds.  Size = 33 MB.
"After" portrait video.  Length = 10 seconds.  Size = 3.2 MB.

If you know of a better mencoder binary, please let me know about it in the comments! 

New Site!

December 30, 2011

After 6 years I've finally gotten around to updating the site layout!  What you see is built on Drupal, which makes content management much easier and will hopefully mean I update more frequently.  I hadn't updated the previous site since 2009, ouch!

It may be a few days before I move old content into its new home.

Subscribe to Thom Patterson RSS