Random ramblings about Mac, Python, TeX, programming, and more   |     |        |     |  



Add artwork and thumbnails to video files

October 22, 2021  |  tools, macos

I just converted a lot of home videos from VHS to MP4 files. I planned to upload and view the resulting files on my iPad. I used HandBrake to reduce the size of the files and WALTR PRO (remember to turn of Automatic Content Recognition in the Preferences) to transfer the videos to my iPad. But, before I transferred them to the iPad, I wanted to add a title and an artwork image to the metadata of each file. I did also add a thumbnail to each file using fileicon (installed on my Mac using Homebrew), but this was not important for my iPad usage of the video files.

First, I needed to create an image for the artwork of each file. I used the QuickTime Player application on my Mac and copied a frame from the video to the clipboard (⌘C). I then used the Preview application to create a PNG file from the clipboard (⌘N) and saved it with the same base name as the video file. I did also add some text to the image in the Preview application before I saved the file. I could have done this from the command line using, for example, ffmpeg (see Create a thumbnail image every X seconds of the video), but with my approach I can use QuikTime to navigate to, and view, the frame I choose to copy.

I could have used WALTR PRO to edit the metadata when uploading the video to the iPad (hold down the ⌘-key when dropping the videos in the WALTR PRO application window). The problem with this approach is that the title and the artwork would not have been added to the files on my Mac, and if I later wanted to add the videos to another iPad I had to type in the title and add the image again for each movie. Another possible approach was to use the iFlicks application (it is included in my Setapp subscription). However, editing the metadata of a lot of files manually seemed to be too much work. Since the two metadata fields I wanted to add to the movies could be determined by the file name (the title is based on the filename and the image is in a file with the same base name as the video), a command line approach looping over each movie file is a better approach. The ffmpeg command line tool can do this, but an easier-to-use tool for these tasks is atomicparsley (also installed on my Mac using Homebrew):

atomicparsley movie-file.mp4 --title "Movie title" --artwork image-file.png --overWrite

If you skip —overWrite, a new temporary video file with the added metadata will be created (maybe safer).

If my video files were named Name-1.mp4, Name-2.mp4, Name-3.mp4, the matching artwork images should be named Name-1.png, Name-2.png, Name-3.png, and the titles of the movies should be set to Film Name-1, Film Name-2, Film Name-3, respectively. Based on this I used the following shell script (bash script) to add the title and the artwork to all movie files:

for f in *.mp4; do 
  b=`basename $f .mp4`
  atomicparsley $f --title "Film $b" --artwork $b.png --overWrite
done

See the documentation of atomicparsley (atomicparsley -h) for more details on all metadata you can change on the video files using this tool.

Last updated: October 22, 2021