Copying Video Files From Action Cameras to a NAS Drive

For unknown reasons, a recent VLC update caused it to ignore uppercase file extensions: MP4 and AVI files no longer appear in its directory listings, while mp4 and avi files do. The least-awful solution involved renaming the files after copying them:

find /mnt/video -name \*AVI -print0 | xargs -0 rename -v -f 's/AVI/avi/'
find /mnt/video -name \*MP4 -print0 | xargs -0 rename -v -f 's/MP4/mp4/'
find /mnt/video -name \*THM -print0 | xargs -0 rename -v -f 's/THM/thm/'

Yup, that scans the whole drive every time, which takes care of stray files, manual tweaks, and suchlike. The THM files are useless thumbnails; I should just delete them.

While I had the hood up, I listed the remaining space on the NAS drive and cleaned up a few misfeatures. I manually delete old video files / directories as needed, usually immediately after the script crashes for lack of room.

The Sony HDR-AS30V can act as a USB memory device, but it dependably segfaults the ExFAT driver; I now transfer its MicroSD card to an adapter and jam it into the media slot on the monitor, where it works fine.

Protip: always turn the AS30V on to verify the MicroSD card has seated correctly in its socket. Unfortunately, the socket can also hold Sony’s proprietary Memory Stick Micro cards (32 GB maximum capacity = roadkill), but the dual-use / dual-direction socket isn’t a snug fit around MicroSD cards. You (well, I) can insert a card so it looks fine, while sitting slightly canted and not making proper contact. The camera will kvetch about that and it’s easier to fix with the camera in hand.

I’ve disabled USB device automounting, as I vastly prefer to handle them manually, so the script asks for permission in order to mount the drives. The transfer requires about an hour, so I’ve extended the time the sudo password remains active.

The script lets both cards transfer data simultaneously; the Fly6 generally finishes first because it produces less data. That produces a jumbled progress display and the script waits for both drives to finish before continuing.

The Bash source code as a GitHub Gist:


  1. #1 by Vedran on 2017-05-19 - 09:48

    echo Whoopsie: $rc

    Gotta love developers with sense of humor… I once found almost identical error handler in a production app for our client with one little twist, guy who wrote it didn’t include any additional info, so user ended up with just “Whoopsie!!!” in the error dialog. Very useful when thrown from a procedure that (on a good day) can go wrong in about 30 different way :)

    • #2 by madbodger on 2017-05-19 - 10:22

      I was developing some communications code once, and unbeknownst to me, my employer shipped it out to be deployed by the US Navy. I found out about it when I got an irate call from someone on a ship at sea who’d just gotten the error message “Can’t get a buffer to save my ass!”

    • #3 by Ed on 2017-05-19 - 13:26

      “Developer”: that would not be me!

      I’ve come to realize the Great Truth: never check for any error you can’t (or won’t) do anything about. [grin]

      • #4 by Vedran on 2017-05-19 - 13:39

        You joke but that’s probably practice number two I have to beat out of every new Oracle developer I get. For some reason they are ALWAYS taught to add exception blocks to their code but are NEVER taught what to actually do in them except mask the real error with ultimately unhelpful “ummm, there was some error dude, whatever, I’m gonna go and quit now”.
        For those curious, practice number one is using cursors for everything and the kitchen sink :)

Spam comments vanish. Comment moderation may cause a delay.

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s