“Save the Decaf!” — rebuilding and renewing the engine of 1978 CB400A Honda motorcycle (named Decaf)

Saving my 1978 Honda CB400A “Decaf” bike from a near fatal blow — lower gasket blowout and huge oil leak! (like, dumped a quart+ of oil in minutes while riding fast on highway at high temps). It was inadvertently overfilled with oil (my bad) and driven too hard (twin brother’s not so good) combination that killed the Beast!

Work with my twin brother (a very gifted self-and-internets-taught car and motorcycle moonlighting mechanic!), I as assistant especially for the entire reassembly and much of the cleaning work.

We had to take the top 3 layers off the engine stack (AKA “complete top-end rebuild”),
remove the pistons, and strip all the way down to the gearbox.
Layers: [valve cover] gasket [valves] gasket [cylinders and pistons] gasket [gearbox and crankcase]
Very neatly Honda makes them all stacked and connected via 8 super long screws that compress, when properly torqued, the entire set under the valve cover.


  • replaced the piston rings (very thin split rings circling the pistons that make them “float” up/down the cylinders),
  • re-honed the cylinders (you use a “flexible hone tool” to clean, slightly resurface, polish and add a light “cross-hatching pattern” to them),
  • cleaned the pistons completely (lots of carbon buildup after decades!) and installed 3 new gaskets — especially paying attention to the lowest gasket that tore and blew oil using some “gasgacinch” sticky product around the oil jets).

Then we did a full valve job (gets the valves ideally aligned to the 4-stroke engine stages),
timing belt adjustment, oil change, and more.

In addition, the air filter was trashed, so replaced that and fashioned an air filter custom holder to keep it from slipping back into the air box.

Bonus points: exhaust and carbeurator gasket replacements.

About $150 in parts (piston rings alone were OEM Honda and $75+), but probably the equivalent of $800-1000+ in labor.

A challenging and very educational labor of love!

Fixing 1978 Honda CB400A always on neutral light — “decaf” project bike

I’m about to sell, with some sadness, my 1978 Honda CB400A “Hondamatic” motorcycle.
I have one last problem with it — that’s been baffling me for over a year.

When I consolidated the speedometer and “idiot lights” to a svelte new cafe racer style chrome LED-based single instrument, I found that its neutral light was always on, no matter what gear.

So I finally figured out a clever (if I may say so) way through research to use the “proverbial $7 part” from in-stock Radioshack — a RELAY switch!

Here, I describe and show the problem, step through a bit of the bike’s electrical system, and show you how I used a relay to fix the problem.

I’ll be sad to see you go, little Decaf!

The *awesome* video learning tutorials I used on Youtube to determine relays were for me!:
RELAYS – How to wire and how they work TUTORIAL !!
How An Automotive Relay Works and How to Wire ‘Em up
(thanks, guys!)

Hyper Green Magic — Green Magic Man Kawasaki ZX-6 motorcycle Hyperlapse, route 1, CA

From the video:

“Two weeks ago, Green Magic Man became the top poster on kawasaki ZX6 forum”
“One week ago, Hyperlapse hit the App Store”
“this is their story”

“Green Magic Man” hitting the curves on Highway 1 towards the coast, Marin County, CA on Labor Day 2014

We tried “Hyperlapse”, which just came out this week, for the first time.

decaf front brake fix — fluid flush and bleed — 1978 Honda CB 400A

The front brake of my 1978 Honda CB400A (baby cafe racer — AKA “decaf”) went almost dead.

Here, we fix it in about 30 minutes — my first time doing more than just an oil change or electronic reworkings! 😎

We assume somehow my brake fluid has deteriorated/aged from viscous fluid to closer to water (this naturally happens over time) and/or somehow has taken in air (which will sack your brakes entirely).

We open my brake master cylinder, inspect, flush clean brake fluid through (making sure to never get air into the line — AKA “brake bleeding”), and see how the results are.

play motion-JPEG video using javascript (in browser, no plugins, minimal JS)

Motion JPEG test

play motion-JPEG video using javascript (in browser, no plugins, minimal JS)

click a button above to begin!

This extracts the JPEG frames, likely without the huffman compression tables (though chrome dont care 8-), found within the .avi bytestream, and then base64 encodes them so they can be easily inserted into a dynamic <img> tag.

Add in a short display timeout and keep overlaying images, and you have your "video", using <img> tags, like a flip book.

WORKS: [ chrome: yes ][ firefox: was yes but now not 8-( ][ safari/iOS: no ][ IE: i bet not ]

Originally created 2006 by Tracey Jaquith. minor updates to jQuery and simplifying 2013

Source (or "View Source"):

New Bay Bridge Span opens — VLOG 1st person motorcycle ride across

New Bay Bridge Span opens — VLOG 1st person motorcycle ride across.

Labor Day 2013, Monday night, ~10pm

The Bay Bridge opens *7 hours before* the widely reported 5am tuesday reopening, after being completely closed for 5 full days.

My twin, Russ AKA “Green Magic Man” (google it 😉 (on green Ninja) and I are the first 30 vehicles on to the 8th street onramp and show you how the new Bay Bridge span looks like from a first person HD camera (courtesy of Hunter, thanks, Baby!)

It is dazzling at night!

Includes 2nd raw 30 minutes of entire trip in a 2nd file.

Morgan Territory Motorcyclin’ — 85 mile east bay loop around Mt. Diablo with Honda CB400A “decaf”

After months of work, Russ finally gets his Ninja 600cc working!

Hunter, Russ, and I celebrate with an 85-mile day trip during the three day weekend around Mount Diablo, through the legendary Morgan Territory.

Ridden over: Oakland, Canyon, Moraga, Lafayette, Walnut Creek, Clayton, Morgan Territory, Danville, San Ramon, and home!

simple way to make h.264 mp4 web and iOS/mobile playable video mp4 files for linux and macosx using ffmpeg

Greetings video geeks! 😎

At my job, I’ve updated the process and way we create our .mp4 files that are shown on video pages on archive.org

It’s a much cleaner/clearer process, namely:

  • I opted to ditch ffpreset files in favor of command-line argument 100% equivalents. It seems a bit easier for someone reading the task log of their item, trying to see what we did.
  • I no longer need qt-faststart step and dropped it. I use the cmd-line modern ffmpeg “-movflags faststart”

Entire processing is now done 100% with ffmpeg, in the standard “2-pass” mode
As before, this output .mp4:

  • plays in modern html5 video tag compatible browsers
  • plays in flash plugin within browsers
  • works on all iOS devices
  • makes sure the “moov atom” is at the front of the file, so browsers can playback before downloading the entire file, etc.

Here is an example (you would tailor especially the “scale=640:480” depending on source aspect ratio and desired output size; change or drop altogether the “-r 20” option (the source was 20 fps, so we make the dest 20 fps); tailor the bitrate args to taste):

  • ffmpeg -y -i stairs.avi -vcodec libx264 -pix_fmt yuv420p -vf yadif,scale=640:480 -profile:v baseline -x264opts cabac=0:bframes=0:ref=1:weightp=0:level=30:bitrate=700:vbv_maxrate=768:vbv_bufsize=1400 -movflags faststart -ac 2 -b:a 128k -ar 44100 -r 20 -pass 1 -acodec aac -strict experimental stairs.mp4;
  • ffmpeg -y -i stairs.avi -vcodec libx264 -pix_fmt yuv420p -vf yadif,scale=640:480 -profile:v baseline -x264opts cabac=0:bframes=0:ref=1:weightp=0:level=30:bitrate=700:vbv_maxrate=768:vbv_bufsize=1400 -movflags faststart -ac 2 -b:a 128k -ar 44100 -r 20 -pass 2 -acodec aac -strict experimental -metadata title='”Stairs where i work” – lame test item, bear with us – http://archive.org/details/stairs’ -metadata year=’2004′ -metadata comment=license:’http://creativecommons.org/licenses/publicdomain/’ stairs.mp4;

Happy hacking and creating!

PS: here is the way we compile ffmpeg (we use ubuntu linux at work, but this script works on macosx, too).

decaf 1978 honda CB400A speedometer and instruments replaced!

OK, so I sorted out all my re-wiring and was able to replace my stock honda huge instrument cluster with a much smaller and streamlined single mini-speedometer with four instrument lights combined in it.

I used a CB400A wiring clymer manual image that I found online to sort out which wires connect where. I also cleared up quite a few wire clusters that no longer needed to leave the headlight wire storage area and made space for the new connections.

VERY satisfying! Can’t wait to fire her up tomorrow and hopefully the speedo/odometer work properly and track accurately. The indicator lights I could test (blinkers, hi-beam, as well as instrument backlight) work. Will see if my neutral light works tomorrow too (and hopefully will not see the “oil pressure” light come on ever 😎 )

replacing CB400A instruments to smaller cafe racer style

Today I did much more than I thought I would — I pulled out and disconnected all instruments and relocated the ignition/key switch.

The plan is to combine the current speedometer/odometer with four of the seven indicator lights (neutral, high beam indicator, oil warning light, turn signal indicator) into a smaller chrome combined unit, and just plain omit the other three lights (parking brake, 1st gear, 2nd gear).

Now that I’ve done more than I had planned (“oh, maybe just two bolts today to see if I can figure out more what I’m up against…”) it is time to order parts! 😎

convert yuvj420p to yuv420p (chrome playable!) mp4 video (eg: canon/nikon video)


found a nice (video lossless, best i can tell) way to convert the video from cameras like my Canon ELPH SD1400,
which is *already* h.264 video + PCM mono audio

to a new mp4 container with aac audio. that part’s easy/cake w/ ffmpeg — but the trick to get the h.264
video part to play in chrome browser and/or with a flash plugin is to get the flagged “yuvj420p” colorspace pixels
to be considered “yuv420p”. it seems like the former is >= 8 bits-per-pixel and has a range wider than the 256 values;
while the later is 8 bit per pixel. ( brief info/notes/background )

at any rate, finally found this nice post:


which refers to this modified MP4Box/gpac tree, to switch the “fullrange” color-related flag off:

and then, voila! i have a nice little script where i can convert my canon ELPH videos to a html5 video tag and flash plugin compatible mp4:

#!/bin/bash -ex

IN=${1:?"Usage: [input video] [output video]"};
OUT=${2:?"Usage: [input video] [output video]"};

# make a hacked version of "mp4box" that can toggle a colorspace-related flag in our video!
if [ ! -e $HOME/scripts/mp4box ]; then
(git clone https://github.com/golgol7777/gpac.git && cd gpac) || \
( cd gpac && git reset --hard && git clean -f && git pull && git status );

./configure --enable-pic --static-mp4box --enable-static-bin
make -j4;

# bonus points: make a *static* binary so if we change linux/OS versions, dont hafta worry!
cd applications/mp4box;
gcc -o $HOME/scripts/mp4box -static main.o filedump.o fileimport.o live.o -L../../bin/gcc -lgpac_static -lm -lpthread -ldl -lz

# demux
ffmpeg -y -i "$IN" -an -vcodec copy video.mp4;
ffmpeg -y -i "$IN" -vn -acodec copy audio.wav;

# convert yuvj420p to yuv420p the cheater way (for chrome and flash plugin playback!)
rm -fv tmp.mp4;
$HOME/scripts/mp4box -add video.mp4#:fullrange=off tmp.mp4

# convert wav audio to aac
ffmpeg -y -i tmp.mp4 -i audio.wav -acodec libfaac -ac 1 -ab 256k -vcodec copy t2.mp4;
qt-faststart t2.mp4 "$OUT";
rm -fv video.mp4 audio.wav t2.mp4 tmp.mp4;

deinterlacing 2323 telecine video into fields for visual analysis

Having some challenging fun working on trying to deinterlace some toughie clips
from my brother’s upcoming feature film.

His camera recorded in 24fps (24000/1001 to you fellow geeks 😎 and smartly
did a “2323” writing/stretching of it to 60i (60 half-frames).
After correcting back to 24fps progressive most of his clips, he’s found ~10-20%
are not able to be put back together visually properly even with CineTools
and manually specifying the “cadence” and sequence starting frames, etc…

I started with code that I wrote to take a small segment of a video
and split the interlaced frames into 1/2 height “fields” and then drop them
down to grayscale to compare them all to each other to find the best matches
(to verify the cadence is right and/or the fields aren’t “off by 1”, etc..)

It uses mplayer and ImageMagick (“convert” and “compare”) for pretty high-quality
extraction of frames from the source video into the 1/2 height “fields”.

So I just do about 0.3 seconds to get 10 frames, and thus 20 1/2 frame fields for analyzing.
It will output the best matches of frames. For example:

php lacer.php good.mov 0.5 0.8

I then extended it into a web page (screenshot above, where I’m left-shifting one field by 4 pixels for visual inspection)
PHP script <== try it out online! (source)
that uses some CSS cleverness (clip property is your BFF!) to interlace together a pair of fields.
It supports:

  • field swapping (move one 1/2 image to be the 1st, 3rd, 5th, etc. lines — if it was
    previously the 2nd, 4th, 6th, etc. lines)
  • left and right shifting a field
  • pairing arbitrary fields
  • showing a “raw” 60i telecined sequence
  • showing the 60i sequence as a “deinterlaced” 24P sequence

natively compiling ffmpeg, mplayer, mencoder on MacOS Lion (with x264!)

OK, I’ve revamped my script to compile these tools:

on MacOS Lion, using the heads of the trees, with direct encoding support for:
vpx / WebM


A nice recent update to ffmpeg is the ability to decode/read Apple ProRes, too!