Downloading videos from the camera onto the computer

Having been a long time user of Lightroom I’ve got used to using it to download the pictures I take into the catalogue and renaming the files into a yyyy_mm_dd format to make it easy to find events in the file system. Whilst I can include video files in these imports, Lightroom doesn’t really have much support for video and I prefer to keep my stills separate from my movies, so I found that I was haphazardly sticking video files from a variety of different cameras into random folders using the file names generated by those devices and then later I couldn’t easily find what I needed.

Using my python skills(!), I decided would write some code to download video files from cards into my required location, with the files named in my required format. I don’t always want to delete files from cards straight away, but then I don’t want to accidentally download the same files again. I therefore needed some means of recording what files I’d already processed. A database was also needed.

I decided against creating a full on document management system like Lightroom where changes and keywords would be stored separately, I just wanted to know that I was only downloading the files I needed and storing them in the folder / file naming convention that I prefer.

The path to the card might be different, and I may decide I want to copy them to a different location once in a while. Plus, I might not want to download all the files on the card (even though I still might want to keep the files on the card!). Also, any videos and pictures I take on my phone already sync to cloud locations, so I may want to get files from the cloud folder to import into the usual video folder.

Video files come in different formats – DJI creates .mp4, Canon creates .mov, the phone does something else and the night cam we have to watch hedgehogs uses .avi. Then there are sound files created when filming slow-motion. But I don’t want to just include all files in case I accidently download stills pictures that might be on the same card.

Writing a simple programme to do this didn’t take long, and I could then quickly copy my files from a number of sources into one area.

Python Code used in file downloads
Python Code used in file downloads – checks that file is a permitted format and not already downloaded. Updates label on interface with progress. Updates database.

A supporting database was created using SQLite. This single file can sit alongside the python file.

Then I decided that it would be even better for the application to have a GUI. Python has a library called Tkinter that contains all the tools to do this, however nothing is as straightforward as it seems. So far, this has taken many times longer, but I finally have a front-end that updates and resizes in a tidy manner – I am using the additional “CustomTkinter” library to give the interface a dark theme. It could also have a light theme.

I have created it as an exe file with PyInstaller – this also took many hours as I found that some libraries were not automatically included. Then I realised that the database file wouldn’t then work if it was put into the Program Files folder alongside the executable (due to the user permissions on that folder), so I had to create more code to relocate the database to the AppData folder.

Then I added the option to double-click on a file to view it in VLC, if I am unsure of the content of the file. This is known as ‘project creep’. New ideas keep getting added to the original brief, so it never gets finished…

GUI for downloading video files
Screenshot of GUI for downloading video files, showing files in source folder, size and date.

All I wanted was to be able to download my files, so why should I be bothered about a fancy interface?
Maybe I’m more of a perfectionist than I realise. …or maybe it’s a procrastination technique to take me away from something more important that I should be doing?

Once (if) I get the GUI perfected, I will then clean up my code and get all the comments to be meaningful. Then I might put it on GitHub and add some version control.

Meanwhile, I can download my video files into a location and name format that makes it easier for me to find them. Now I need to go and film something!

Python
Visual Studio Code
SQLite

Resized GUI for downloading video files
Screenshot of GUI for downloading video files – showing how it can now be stretched (or maximised to fill the screen)