The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

Tag: Rants

And kvetching, too

  • Sony HDR-AS30V vs. ExFAT vs. Ext2 Times: Total Bafflement

    I’d like to overlay a timestamp on still images extracted from Sony HDR-AS30V camera videos, ideally including the frame number, to record exactly when the incident occurred. Movie players use relative time, with 00:00:00 at the beginning of the file, so we’ll need either the file timestamp or the timestamp recorded in the image’s Exif data, plus the frame number modulo 60 (or, shudder, 59.94 for NTSC).

    The ExFAT format used on 64 GB MicroSD cards stores the file’s creation time, its modification time (writing data), and the most recent access time (reading data). That’s similar to the Linux ext2/3/4 filesystem time and unlike plain old FAT, which omits the access time.

    The various FAT formats store local time, with no regard for time zones, Daylight Saving Time, or anything else. Linux stores times as UTC and converts to local time on the fly. This has catastrophic consequences for getting any of this right.

    It helps to have alias ls='ls -h --color=auto --time-style=long-iso' in your .bashrc file.

    The HDR-AS30V has a year-month-day calendar, a 24-hour clock, a Time Zone value, and a separate DST on/off setting.

    Turning DST on adds 1 hr to the Time Zone value, turning it off subtracts 1 hr. That has the side effect of changing the clock time: not what I expected. You must, therefore, set the TZ first, then DST, then the clock, which does not follow the menu’s natural order of things.

    The camera sets file timestamps as it creates the files, but Linux also meddles with the values while displaying them. Some doc suggests that Linux regards FAT file timestamps as UTC and applies DST correction, which seems to match what I see. There’s a mount option (-o tz=UTC) that seems to have no effect, as well as an undocumented time offset (-o time_offset=60) that also has no effect.

    Setting the TZ to GMT+0 (Sony uses GMT, not UTC) for simplicity, setting the clock to the correct local time, and twiddling DST shows that:

    • Rebooting (remove /insert battery) doesn’t change anything
    • Metadata in file = clock setting – DST setting (-1 on, +0 off)
    • MP4 / THM file create / modify times = always clock +1 hour
    • MP4 / THM file access times = as create / modify until next Linux access

    Under those conditions, with the clock set to (locally accurate) 1908, UTC+1, and DST off, then the Exif timestamp metadata for a movie created at that time look like this:

    exiftool /mnt/part/MP_ROOT/100ANV01/MAH00036.MP4 | grep -i date
    File Modification Date/Time     : 2014:09:01 20:08:09-04:00
    File Access Date/Time           : 2014:09:01 19:10:14-04:00
    File Inode Change Date/Time     : 2014:09:01 20:08:09-04:00
    Create Date                     : 2014:09:01 19:08:03
    Modify Date                     : 2014:09:01 19:08:08
    Track Create Date               : 2014:09:01 19:08:03
    Track Modify Date               : 2014:09:01 19:08:08
    Media Create Date               : 2014:09:01 19:08:03
    Media Modify Date               : 2014:09:01 19:08:08
    

    The corresponding filesystem values:

    ll /mnt/part/MP_ROOT/100ANV01/
    total 146M
    ... snippage ...
    -rwxr-xr-x 1 ed root  14M 2014-09-01 20:08 MAH00036.MP4
    -rwxr-xr-x 1 ed root 8.5K 2014-09-01 20:08 MAH00036.THM
    
    ll -c /mnt/part/MP_ROOT/100ANV01/
    total 146M
    ... snippage ...
    -rwxr-xr-x 1 ed root  14M 2014-09-01 20:08 MAH00036.MP4
    -rwxr-xr-x 1 ed root 8.5K 2014-09-01 20:08 MAH00036.THM
    
    ll -u /mnt/part/MP_ROOT/100ANV01/
    total 146M
    ... snippage ...
    -rwxr-xr-x 1 ed root  14M 2014-09-01 19:10 MAH00036.MP4
    -rwxr-xr-x 1 ed root 8.5K 2014-09-01 20:08 MAH00036.THM
    

    The THM file contains a 160×120 pixel JPG thumbnail image taken from the first frame of the corresponding MP4 file. For longer movies, it’s more obvious that the MP4 file creation date is the start of the movie and its modification date is the end. The maximum 4 GB file size of corresponds to exactly 22:43 of 1920×1080 movie @ 60 frame/sec (the metadata says 59.94).

    The +1 hour offset in the file create / modify times comes from the FAT timestamp being (incorrectly) adjusted by the Linux DST setting. When exiftool reads the MP4 file, that resets its access time to the actual time as seen by Linux, thereby crushing the bogus FAT time.

    Doing the seemingly sensible thing of setting the camera to have the correct local time (roughly 1930), the correct time zone, and the correct DST setting produces this jumble:

    exiftool /mnt/part/MP_ROOT/100ANV01/MAH00037.MP4 | grep -i date
    File Modification Date/Time     : 2014:09:01 20:33:15-04:00
    File Access Date/Time           : 2014:09:01 20:33:14-04:00
    File Inode Change Date/Time     : 2014:09:01 20:33:15-04:00
    Create Date                     : 2014:09:01 23:33:11
    Modify Date                     : 2014:09:01 23:33:14
    Track Create Date               : 2014:09:01 23:33:11
    Track Modify Date               : 2014:09:01 23:33:14
    Media Create Date               : 2014:09:01 23:33:11
    Media Modify Date               : 2014:09:01 23:33:14
    
    ll /mnt/part/MP_ROOT/100ANV01/MAH00037*
    -rwxr-xr-x 1 ed root  11M 2014-09-01 20:33 /mnt/part/MP_ROOT/100ANV01/MAH00037.MP4
    -rwxr-xr-x 1 ed root 8.2K 2014-09-01 20:33 /mnt/part/MP_ROOT/100ANV01/MAH00037.THM
    
    ll -c /mnt/part/MP_ROOT/100ANV01/MAH00037*
    -rwxr-xr-x 1 ed root  11M 2014-09-01 20:33 /mnt/part/MP_ROOT/100ANV01/MAH00037.MP4
    -rwxr-xr-x 1 ed root 8.2K 2014-09-01 20:33 /mnt/part/MP_ROOT/100ANV01/MAH00037.THM
    
    ll -u /mnt/part/MP_ROOT/100ANV01/MAH00037*
    -rwxr-xr-x 1 ed root  11M 2014-09-01 19:34 /mnt/part/MP_ROOT/100ANV01/MAH00037.MP4
    -rwxr-xr-x 1 ed root 8.2K 2014-09-01 20:33 /mnt/part/MP_ROOT/100ANV01/MAH00037.THM
    

    The only correct time in that mess is in the next-to-last line: the access time for the MP4 file. Every other timestamp comes out wrong, with the internal metadata values being off by +4 hours; that suggests the camera sets the internal timestamps to UTC.

    As nearly as I can figure, the only way to make this work requires setting the clock to the local time, TZ to UTC+0, and DST off. That will screw up the filesystem timestamps, but at least the Exif metadata will be correct, for some value of correct.

    The camera’s GPS receiver depends on the clock for its initial synchronization. I don’t know how the TZ and DST settings affect the clock’s correctness for that purpose.

    I do not know if / how / when the displayed times have been altered by the programs that display them.

    I think exiftool can extract the times from the internal metadata and fix up the filesystem times, but that’ll take more tinkering.

    Sheesh & similar remarks…

  • Revlon Tweezers: Bad Spot Welds

    Mary bought a pair of Revlon tweezers a while ago, picking a Name Brand to avoid hassles with bottom-dollar crap:

    Revlon tweezers - bad spot welds
    Revlon tweezers – bad spot welds

    Well, that didn’t work.

    I contend that the only difference between Name Brands and the bottom-dollar crap I tend to buy is a bit of QC and a lot of price. I’ll agree that’s not strictly true, but it does fit a goodly chunk of the observed data.

    Anyhow.

    I milled a recess into the corner of some scrap plastic to locate the handle end, then arranged a step block to capture the business end:

    Revlon tweezers - drilling setup
    Revlon tweezers – drilling setup

    That setup ensures the holes go into the corresponding spots on both pieces, because I couldn’t figure out how to clamp them together and drill them both at once. I drilled the other piece with its good side up to align the holes; doing it bad side up would offset the holes if they’re not exactly along the center line.

    A closer look:

    Revlon tweezers - drilling fixture
    Revlon tweezers – drilling fixture

    Talk about a precarious grip on the workpiece!

    I filed the welds flat before drilling, so the pieces lay flat and didn’t distract the drill.

    Then:

    • Center-drill
    • Drill 2-56 clearance
    • Scuff up mating surfaces with coarse sandpaper
    • Apply epoxy
    • Insert screws
    • Add Loctite
    • Tighten nuts to a snug fit
    • Align jaws
    • Tighten nuts
    • Fine-tune jaw alignment
    • Apply mild clamping force to hold jaws together
    • Wait overnight
    • Saw screws and file flush
    • Done!

    The clamping step:

    Revlon tweezers - epoxy curing
    Revlon tweezers – epoxy curing

    Those nicely aligned and ground-to-fit jaws were the reason Mary bought this thing in the first place.

    The screw heads look OK, in a techie sort of way:

    Revlon tweezers - fixed - front
    Revlon tweezers – fixed – front

    The backside won’t win any awards:

    Revlon tweezers - fixed - rear
    Revlon tweezers – fixed – rear

    But it won’t come apart ever again!

    There’s surely a Revlon warranty covering manufacturing defects, printed on the long-discarded packaging, that requires mailing the parts with the original receipt back to some random address at our own expense.

    Ptui!

  • Another Bike Ride, With Gratuitous Smog

    Large Pickup - Small Brain
    Large Pickup – Small Brain

    He could claim to be accelerating after a stop signal and that’s just how those big Chevy “clean diesel” engines work, even with DEF and DPF in full effect.

    In point of fact, this was deliberate:

    Large Pickup - Small Brain - Penumbra
    Large Pickup – Small Brain – Penumbra

    I wish no ill on any man, but, should the Fates decree that a big pickup must be found wrapped around a tree, I have a recommendation.

    We were northbound on 9W, returning home after an end-of-summer party.

  • Bathroom Sink Drain Pop-Up: The Rot Continues

    Once again, the black bathroom sink drain stopper stopped popping up. Having had this happen once before, I knew what I would find:

    Corroded bathroom sink drain lever
    Corroded bathroom sink drain lever

    The lever arm to the left of the ball should be about twice that long, minus the jagged end.

    I slid the ball rightward to expose more rod, introduced both ends to Mr. Bench Grinder to round them off, scuffed up the short end with sandpaper to improve its griptivity, then slobbered on enough JB KwikWeld to cover the entire length of rod that will live inside the drain:

    Epoxy-coated bathroom sink drain lever
    Epoxy-coated bathroom sink drain lever

    The first failure took 9 years, this one took 4…

    Memo to Self: Next time, replace the rod with something that doesn’t corrode.

     

  • Left Turn on Red

    Coming out of Adams, we’re ready to make a left turn onto Rt 44:

    Left turn on red - 2014-07-24
    Left turn on red – 2014-07-24

    He was one car back in the left-turn storage lane when his light went yellow-to-red, crossed the stop line on the red, and was one car length over the stop line and accelerating when our light changed to green.

    We’re ready to start rolling on green, but we’ve learned to wait a few heartbeats for just such occasions; what counts as a fender-bender for you would be a fatality for us.

    Y’know how motorists get very, very angry at cyclists? I’ve always wondered why they don’t get that angry when motorists do those same stupid things, at higher speeds with much more energy.

    We ride as though we’re thin cars, which is how it’s supposed to be done, and generally don’t get too much hassle.

    One thing that is annoying, though: short-stroke yellow cycles that last maybe two seconds. We can cross the stop line on green, accelerating firmly through the intersection, and still get caught in the middle as the signal changes to green-to-yellow-to-red behind us and red-to-green for opposing traffic. No, we didn’t run the yellow, but that’s what it looks like.

  • Eco-Friendly Firewood?

    These seem to be ordinary birch logs, cut into short chunks, sporting a top crosscut loaded with fire starter:

    Light-n-Go Bonfire Log - stacked
    Light-n-Go Bonfire Log – stacked

    The front of the label makes them seem wonderfully eco-friendly, but the fine print on the back shows that they’re from the Old World:

    Light-n-Go Bonfire Log - origin label
    Light-n-Go Bonfire Log – origin label

    There’s surely a universe where shipping heat-treated firewood from Estonia to Poughkeepsie makes perfect sense. I just didn’t realize I was living in it.

  • Subaru Forester: Speed Demon!

    I finally figured out why the Forester feels so slow:

    Subaru Forester - speedometer
    Subaru Forester – speedometer

    Here in the Northeast US, the maximum legal speed anywhere is 65 mph, less than half-scale, and typical around-town speeds hit 40 mph, barely 1/4 of full scale.

    For all practical purposes, that needle barely moves during our usual trips.

    I like analog gauges to represent smoothly varying quantities that you must read at a glance, but a big digital display would actually be more useful than that thing.

    A 150 mph speedometer scale makes no sense in what’s basically a shrunken all-wheel-drive SUV, even with minimal off-road capabilities. Yes, perhaps the Forester could hit 150 mph, but why not have the scale top out around, say, 100 mph? Above that, you shouldn’t be paying much attention to the speedo, anyway.

    The Sienna’s speedo went to 110 and, to the best of my knowledge, that needle never passed 85 mph, tops. However, ordinary (and legal) driving speeds filled the lower half of the scale, with the highest useful speeds in the next quadrant beyond vertical.

    Yes, I know why the speedos sport such absurd numbers. I don’t have to like it.

    There’s a servo motor (or some such) driving the needle; calibration has been a simple matter of software for a long, long time.

    For whatever it’s worth, the Forester and the Sienna have both tachometers and automatic transmissions, a combination that converts shifting into a spectator sport. The Forester’s continuously variable transmission moves the tach needle in smooth glides, rather than abrupt jumps.