Odd Wildcard Matching in Windows 10

I recently ran into an odd behavior of more files matching a pattern than I expected. I’d used exiftool to modify the dates on files my GoPro produced. It creates backup files of the original images when it modifies the tags. Here’s the command I ran.

exiftool.exe -r "-AllDates+=4:7:6 17:40:00" -ext jpg f:\GoPro\20170807

Now I had about 4000 files with the .JPG extension and another 4000 files with a .JPG_original extension.

I ran my program that parses the directory structure and turns all those images into a time lapse movie, and it seemed to be including both the file extensions, making a very disjointed movie.

I loaded my source code in the debugger and it seemed to be doing a findfirst / findnext specifically looking for .JPG files, and not some other extension, but it was definitely retrieving files both with .JPG and .JPG_original extensions.

I then ran a couple of commands at the windows command prompt and was surprised to find the same results there.

dir F:\GoPro\20170807\372GOPRO\G*.JPG /p
dir F:\GoPro\20170807\372GOPRO\G???????.JPG /p

Each command returned both the JPG and JPG_original files.

dir F:\GoPro\20170807\372GOPRO\G*.JPG_original /p

returned just the JPG_original files.

dir F:\GoPro\20170807\372GOPRO\G??????.JPG /p

had one less question mark and correctly returned no files.

This is all unexpected behavior, though I’m glad to see that it was consistent with the operating system and not something specific to the C runtime. I’d love an explanation of what’s going on.

Advertisements

exiftool to manage DJI media files

DJI Drones don’t seem to remember the image count between formats of a media card. This creates a problem for me when I’m trying to backup and maintain my images and video.

Because the dates are all correct in the media files, retrieved from GPS data, organizing the files by naming them based on the date works for me.

Using ExifTool by Phil Harvey is a great solution for pulling the metadata from the files and renaming the files.

The command line that I was initially using is:

exiftool "-FileName<${CreateDate}.$filetype" -d %Y%m%d-%H%M%S%%-c -ext mp4 -ext dng -ext jpg dji*

It’s problem is that it orphans the SRT subtitle files from my videos that I’d like to keep matching the video files.

I’ve tried this variation to do it in one step but it doesn’t work, because the SRT files get renamed as MP4 files.

exiftool -verbose "-FileName<${CreateDate}" -d %Y%m%d-%H%M%S%%-c.%%le -ext mp4 -ext dng -ext jpg dji* -srcfile %f.srt

If anyone has a suggestion for how to rename all the media files in one directory I’d appreciate it. Even running two commands in sequence would be fine.

Update:

I’ve figured out that running these two commands in sequence will get me the results I am looking for:

exiftool "-FileName<${CreateDate}" -d %Y%m%d-%H%M%S%%-c.srt -ext mp4 -srcfile %f.srt dji*
exiftool "-FileName<${CreateDate}" -d %Y%m%d-%H%M%S%%-c.%%le -ext mp4 -ext dng -ext jpg dji*

I’m still looking for a way of doing it in a single command that may leave less room for error, but this is working for now.

Being a responsible drone pilot

I try to be a responsible drone pilot. I use the FAA B4UFly App on a regular basis to see what it has to say about locations that I’m interested in flying. Unfortunately, it lists every uncontrolled heliport as an airport and reports “Action Required” so often as to be nearly useless.

Yesterday I was sitting on the beach at Golden Gardens Park in Seattle, watching sailboats race offshore. I thought it would be good to check to see what the app would show. I was sitting at sea level, with a hill near me that would be at least 200 feet high. The rules for drones say that you are not allowed to fly over 400 feet above the surface without permission from the controlling authority. Aircraft are not allowed to fly below 700 feet without similar permission.

GoldenGardensVFR

Golden Gardens is located about where the “E” in KENMORE sits on the map above. It’s under the Class B Airspace that starts at 3,000 feet, going up to 10,000 feet.

While understanding VFR charts  may be more than the average drone pilot should be expected to recognize, especially for a dense area like Seattle, the B4UFly App’s tendency to show warnings is similar to the boy who cried wolf. It’s impossible to recognize when an action is really appropriate.

Mustang Survival EP 38 Inflatable Ocean Racing Vest

After 16 years of faithful service, I decided it was time to replace my SOSpenders inflatable PFD. I’d bought it back when I was going through all of the classes offered by Windworks Sailing for US Sailing Certifications, and while it is still fully functional, the opening style was not as comfortable as the newer Mustang PFDs.

I’d gone into the store hoping to find a good price on a traditional shaped Mustang PFD, with the clasp in the front and double D rings to secure a tether. While I found those PFDs, I also came across this new PFD from Mustang that I’d not seen before. It had been introduced in October 2016, and I’d not done much sailing after early November, completing Round the County on Different Drummer.

The EP 38 was visually appealing, but also a step up in cost compared to the PFDs I went in prepared to buy.  It included built in crotch straps, something that I’d had to add to my old PFD to satisfy regulations on many of the races I’ve been interested in. I tried the EP38 on, finding that my head did fit through the opening and it was comfortable while wearing a t-shirt. I ended up leaving the store without buying anything since I had something new to think about.

After arriving in Victoria BC for the Swiftsure Yacht Race, there was a booth selling Mustang gear at a race discount. I’d watched online videos of the proper method of donning this PFD with heavy gear on, and knew it would be snug for me.

In the blazing sun of the inner harbor I took my heavy gear to the booth and tried on the PFD. I really wanted to see how it felt with the hood still folded into the collar of my foul weather gear. The videos explaining the procedure for donning the PFD explicitly suggest putting up the hood and securing the storm flap across your face before putting the PFD over your head. With some assistance tugging on my collar, I was able to get the PFD in place without raising the hood. While slightly snug around my neck, I decided that it was something I could get used to and bought the PFD.

After using the PFD during the 23 hour race, I’m mostly happy with it, but there are a few things I really wish Mustang had designed better.

  • The chest strap tightening system regularly loosened up on me, and I was often re-cinching it. A bigger issue is that to tighten it, you must pull the straps towards the rear. It would be much easier to tighten it if the cinch points were near the back of the harness and the loose ends pulled forward to tighten.
  • The crotch straps should be a few inches longer. I’m 6’2″ and more overweight than I’d like to be. At full extension these straps barely connect. I know that there are plenty of sailors that are taller than me. The straps are already adjustable to shorten the length, making them a few inches longer would make them so much more usable.
  • The velcro patches securing the spray hood and crotch straps in the back should be larger vertically, to make them easier to secure. I regularly hike outside the upper lifeline, and coming back through the lifeline was knocking the velcro loose.
  • Pulling the life vest on over my head I was regularly rubbing my sunburned nose on the front of the collar. This was something I got better about during the course of the race, so is less of an issue than I thought when initially trying it on.

After listing what was wrong with the vest, I’ll say I like it much more than any vest I’ve used in the past. there are several points that I can’t emphasize enough.

20170531_172119625_iOS

Pulling the vest on over the head and securing the straps is so much faster than having to buckle a traditional vest. At 3am when sleeping below on the sails without my foul weather gear or PFD on, this was intuitive and almost as quick as throwing a t-shirt over my head when I needed to assist with a spinnaker jibe. I can’t emphasize how much the speed of putting it on made spending the money on good safety equipment seem a worthwhile expense.

The front of the PFD seems lower profile than my old PFD, and it’s nice to not have metal D rings in the front.

The hydro-static automatic inflation technology is supposed to be better than the old chalk ring technology.  It may cost more when I need to replace it, but it’s nice to have the maintenance dates visible through the clear plastic in front.

The back of the collar is less likely to get caught on the lifelines, though I’m watching the velcro pocket on the back.

Being all black, there’s not a good visible location two write my name in normal use. I have put my name on the label that’s visible when it’s inflated, but am still working on the best way to label the outside. I have access to a sewing machine that can sew patterns of letters, so I’m thinking of having my name stitched into the webbing using a bright thread.

FFMPEG and drawtext

Several years ago I wrote a program that consolidates time-lapse pictures into a directory and calls FFMPEG to create a video.

I had been wanting the time-code from when each picture was taken printed on the screen while the video was playing but had not figured out how to get it done until this weekend.

Video TimeCode

Frame from video showing the DateTimeOriginal timecode embedded.

I’d gone down multiple paths in an attempt to get this result before finally getting the drawtext feature to work. My program manually pulled the metadata from the images before feeding them to ffmpg. I’d tried creating both text files and image files for overlaying. none of those got the result that I was looking for.

When I finally got everything working, it seems simple, but the underlying problem has to do with the amount of string escaping required to get the command to work.

Here’s an example command I was issuing to ffmpeg that got the result I was looking for.

ffmpeg.exe -hide_banner -r 30 -i Wim%05d.JPG -vf crop=in_w:3/4*in_h,drawtext=fontfile=C\\:/WINDOWS/Fonts/OCRAEXT.ttf:fontcolor=white:fontsize=160:y=main_h-text_h-50:x=main_w-text_w-50:text=WimsWorld,drawtext=fontfile=C\\:/WINDOWS/Fonts/OCRAEXT.ttf:fontcolor=white:fontsize=160:y=main_h-text_h-50:x=50:text=%{metadata\\:DateTimeOriginal} -s 3840x2160 -pix_fmt yuv420p -n Test-2160p30-cropped.mp4

If you look at the -vf option parameter, I’m cropping my input pictures to 3/4 their original height, then using the drawtext feature twice. First I write the static text to the bottom right of the frame, then I extract metadata from the source image and write it to the bottom left of the frame.

Because I’m calling this from a program, I had extra escaping of the \ character in my code. All of the escaping required a lot of trial and error to get things working. I’m using OCRAEXT as my font, but I could be using any fixed spacing font. because of the fact that the time is changing every frame, it’s important that the font not be proportional to make it easy to read.

Cruise Control at 65mph

Last weekend I went to Seattle, and on the way back had the patience to drive for an entire tank of gas at 65mph. Often on a long drive I’ll have the cruise control set approximately five to ten over the posted speed limit. This time I left the cruise control speed at 65 even after I got to Idaho where the posted speed is 80mph.

A very interesting thing during the drive from Portland to Boise, the trip computer was regularly calculating the range at a number that, when added to the miles already driven, calculated over 600 miles in the tank. The pictures above are showing an estimate of 580 miles in the tank after having already driven 400 miles.

A quick calculation of driving 432 miles at 65mph vs the same distance at 75mph tells me that the faster speed only saves me 53 minutes. This time I arrived home with over a quarter tank of fuel. Previous times I’ve had the low fuel warning light on when I was still 20 miles short of reaching home. If you figure I could have put another 7 gallons of gas in the car at over $2.50 a gallon, I saved about $17.50 for that 53 minutes. It was on a day that I hadn’t planned on doing anything beyond driving point to point, so I think it was worth it. Just the difference in gas price between Idaho and Washington pushed that difference in cost to over $20.

The real calculations below show that I only achieved 22.72 mpg during this stretch, while the computer was displaying 25.0 mpg. The 16.59 in the next column is the average mpg over the entire lifetime of my vehicle.

3/29/2017 11.555  $    29.45 138615 17.40 16.56  $      2.55 201.0 4 50
3/31/2017 21.918  $    63.98 139002 17.66 16.57  $      2.92 387.0 2 194
4/2/2017 21.265  $    61.01 139401 18.76 16.57  $      2.87 399.0 2 200
4/2/2017 5.196  $    14.23 139513 21.56 16.58  $      2.74 112.0 0 112
4/3/2017 19.011  $    48.08 139945 22.72 16.59  $      2.53 432.0 1 432
Oregon I84

Oregon I84

Oregon I84

Oregon I84

Sometime I may have the patience to try driving the stretch at 55mph, which was the law when I was back in university and drove a car that regularly achieved 38mpg. Views like these last pictures are part of what makes the drive itself worthwhile.

Rental Car vs Personal Car

I’ve spent most of the last winter in Boise, but still call the Seattle area home. I own a BMW X5 that turns 15 years old this year. I ordered it from the factory with the options I wanted, and have been happy with it other than the gas mileage, which I understood when I bought it, and the electronics, which are now 15 years old.

A driving trip from Boise to Seattle is 500 miles each way. That means a trip is a minimum of 1000 miles. My X5 gets as much as 19mpg on the highway, and it requires 91 octane or better fuel. A round trip in my vehicle is going to be a minimum of 52 gallons of fuel, plus wear and tear on the vehicle itself.

I did some quick research and figured out that a comfortable sized rental car would include a Ford Focus, and it should get about 38mpg on the highway, and it would probably take regular fuel, which is already 20¢ per gallon cheaper. I’d driven a Focus in Hawaii in the past and liked the way it drove so was interested in trying it out for this purpose.

I’d plugged in my start and several destinations into Google Maps and come up with a distance I’d drive of 1200 miles for estimation purposes. I created a simple spreadsheet with rough details. I was hoping to get as many as 38mpg in my rental car, which meant that I’d get a savings of over $100 towards paying for the rental car.

Rental Car BMW X5
1200 1200 Miles to Drive
38.00 17 Miles per Gallon
31.57895 70.58824 Gallons of Gas
 $       2.57  $     2.79 Average cost of Gas
 $     81.16  $ 196.94 Total Cost of Gas
 $ 115.78 Savings by using a rental car

I rented from Budget. They didn’t have a Focus, but I got a Nissan Sentra that had very nice electronic toys for me to play with, including Bluetooth connectivity for my phone for both music and telephone calls. It also connected to my phone via the USB connection which seemed to have slightly better audio, plus keeping my phone charged the entire time. The rated MPG seemed to be about 5mpg less than the Ford, but you take what you can get.

After the drive, I tallied up my gas receipts in the fashion I keep track of with my X5 normally.

Date Gallons  Total Mileage MPG Average MPG  Dollars/Gallon Miles In Tank
11/3/2016 1.212 2.86 18200  $     2.36
11/3/2016 9.222 23.97 18538 36.65 36.65  $     2.60 338.0
11/8/2016 8.284 20.37 18806 32.35 34.62  $     2.46 268.0
11/8/2016 3.552 2.239 18924 33.22 34.38  $     0.63 118.0
11/8/2016 6.359 16.4 19122 31.14 33.63  $     2.58 198.0
11/9/2016 6.673 15.74 19346 33.57 33.62  $     2.36 224.0

And then I transferred that data into a duplicate table like the first one.

Rental Car BMW X5
1146 1146 Miles to Drive
33.62 16 Miles per Gallon
34.09 71.625 Gallons of Gas
 $       2.31  $     2.53 Average cost of Gas
 $     78.72  $ 181.15 Total Cost of Gas
 $ 102.43 Savings by using a rental car

I didn’t get quite the mileage that I was expecting to get while driving the rental car, and it seemed to go down as I drove it longer. I’m guessing that it was largely related to my being more of a leadfoot the longer I was in the car. I paid $171.78 for the rental car, so the estimated gas savings mean that I paid less than $70 for not having wear and tear on my own vehicle.

Nissan Sentra Instrument Pod

Nissan Sentra Instrument Pod

Nissan Sentra

Nissan Sentra