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.

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.

DJI Phantom and Wind

This week I took my drone to video Initial Point in Idaho. It’s a rocky outcrop about 20 miles south of Boise that was chosen as the initial survey point for the Idaho Territory in 1867. It has a concrete platform installed at the top with a survey marker embedded. There’s a rocky trail that can be driven to the top if your vehicle has a high ground clearance. I chose to walk to the top.

DCIM100MEDIADJI_0177.JPG

Initial Point Idaho

My car was parked at the base, I climbed up about 130 feet to the top. The wind was occasionally gusting at the base. It was constant at the top, with much higher gusts.

I carried the drone in my backpack to the top, and launched it from the platform. I manually flew it around the point, but was feeling extremely nervous doing so. I only flew about 36 feet above the platform during the entire flight.

The concrete platform has a metal railing surrounding it, and I didn’t trust the drone to return safely to land without hitting the railing so I manually had it land nearby. As I was hovering the drone before landing, it was holding a fairly constant 20° lean because of the wind.

After hiking back to my car I still had plenty of battery for another flight. From near my car I launched the drone and flew vertically to about 200 feet, centered the drone over the survey marker, and used the point of interest feature to create a video circling the point.

I don’t believe that the wind was any less on my second flight than it was on my first flight. The fact that I was in the wind on the first flight had me feeling significantly more nervous while flying than when I was out of the wind on the second flight. Watching the video from the first and second flight doesn’t appear significantly different. I would have liked the point of interest video slightly more if I’d been on top of the point the entire time, but I was too nervous to do it all while I was sitting in the wind myself.

Samsung UD590 working with Gigabyte GEFORCE GTX 660

In a previous post I mentioned that I was having problems making my new Samsung 4k UHD monitor work at full resolution.

Gigabyte GEFORCE GTX 660

Gigabyte GEFORCE GTX 660

I ordered a new Gigabyte GEFORCE GTX 660 video card from newegg, removed the old video card, and now have three monitors plugged directly into this video card.

ScreenResolution

 

My center monitor is the new Samsung display running at 3840×2160 on the display port, and the left and right monitors are each HP Pavillion 22bw monitors running 1920×1080 using the DVI ports. The one strange thing is that Windows recognizes the dot pitch on the Samsung monitor and attempts to make things larger than I’d like. It is a configuration option to make text larger or smaller by following the link on the screen resolution dialog and I have moved the slider one notch smaller from the center.

Display

Media Center Content Protection Error

I’ve noticed that I sometimes get errors in windows media center reporting that programs could not be recorded. This generally happens when I’ve left media center running full screen on one of my monitors overnight…

MediaCenterErrorThe strange thing is that if the media center application is not running, or is running in a window, the recording of the programs seems to work properly. I only get these errors coming up when the application is full screen on one of my monitors.

 

Samsung UD590 Monitor

I bought a Samsung UD590 monitor from Amazon and it arrived Saturday May 3rd. It’s native resolution is 3840×2160, which is twice 1920×1080 in each direction. It came with a single HDMI cable and a display-port cable.

Samsung UD590

I bought this for it’s resolution and price. It sells for $699. It claims to be able to run at 60hz input at full resolution, where some of the other monitors in this price range only run 30hz. The box advertises 1ms fast response time, but I’m not certain how that translates.

My previous monitor setup has had an HP Pavilion 22bw as a center monitor, the same as a right monitor, and an old Samsung SyncMaster 205BW monitor in portrait mode as a left monitor.

ASUS SabreToothMy machine is based on an Asus Sabretooth Z87 TUF motherboard. I’ve got an Intel® Core™ i7-4771 Processor running with 32GB ram. I’ve been running the center monitor from the embedded GPU using the HDMI output on the motherboard. I’ve got an old NVIDIA GeForce 8600GT based graphics card driving the left and right monitors via DVI ports. It is an ASUS EN8600 GT Silent card. I’m running windows 8.1.ASUS EN8600GT

I haven’t decided if I want to switch to just using this new monitor, or if I want to keep using the two HP monitors as left and right flanks. My initial test had me plugging the new monitor into the display port on the motherboard and having the HP monitors plugged in via DVI on the card.

When I booted the machine initially, I saw the EUFI screen from the motherboard correctly on the new monitor, the opening screens of windows booting on the new monitor, and then the monitor went blank and only the pretty backgrounds were visible on my monitors on the sides. Through a bunch of trial and error, I figured out that if I reduced the resolution on the Samsung in windows from 3840×2160 to 2560×1440 things worked without going blank. I went so far as to remove the NVIDIA card entirely to see if it was some sort of interaction, but that didn’t seem to help.

By total chance I found out that if I have a large amount of constant white space on the screen I can run the monitor at full resolution. If I’ve got an empty copy of Notepad filling the screen, then the screen runs fine at its native resolution. But if I load an app that throws any level of color complexity on the screen, it shows the image, then goes all black, and blinks the image up approximately one second out of ten.

I don’t understand if this problem is related to the monitor, or related to the motherboard output, or possibly even the cable. I’m using the cable that came with the monitor, so I’ve been discounting that. I’m assuming the problem has to do with the bandwidth of driving 3840×2160 at 32 bit color.

I don’t mind going out and buying a new display card to drive the monitor, but I’m not a gamer so don’t want to spend money for a top of the line gaming card when all that I want to do is drive high resolution and have a reasonable refresh rate for displaying video. Ideally a video card would be able to drive three monitors. I expect I’d drive the big monitor via display-port, and the secondary monitors via a display-port to DVI cable.

Any suggestions as to what exactly my problem is are useful.