Linux Format

Tagging metadata

Nick Peers takes an in-depth look at media metadata to come up with some strategies to improve your file-tagging techniques.

- Nick Peers has a media collection that would make your eyes water – both in its quality and quantity.

Nick Peers takes an in-depth look at media metadata to come up with some strategies to improve your obsessive file-tagging techniques.

Metadata – the art of ‘tagging’ your photos, films and music with extra informatio­n to help identify it – may not sound like the sexiest of subjects, but when you’re setting up a new media server or wanting to browse your photos through an app like Shotwell, you can instantly recognise your files and organise them as you see fit.

Metadata is, according to the Merriam Webster dictionary, “data informatio­n that provides informatio­n about other data”. The other data in this case is your media files; the data informatio­n is everything from a TV show’s episode title to the composer of a music track. Broadly speaking, metadata resides in one of two places: within the database of a related program such as your music player or media server, or embedded in the file itself as a series of keyword ‘tags’. Often, program metadata is richer than the tags embedded in files – just look at the kind of informatio­n supplied by the likes of Kodi (https://kodi.tv) or Jellyfin (https:// jellyfin.media) in terms of detailed synopses, cast and crew informatio­n and artwork. While you’re able to edit all these by hand, most of it is downloaded – or ‘scraped’ – from online databases such as IMDB or The TV Database. It’s effortless, but ultimately most of that informatio­n is tied to the program in question.

While simpler keyword-based tagging isn’t as detailed as the metadata available elsewhere, it does serve a useful purpose: namely, the tags are stored in the files themselves, making them platformin­dependent. It also helps to confirm the identify of each media file by adding key informatio­n such as the artist name or TV episode title, which in turn can be used by apps that don’t make use of the metadata stored in third-party online databases.

For scraping or tagging to work, you need to organise your files in a specific folder structure, plus name them a certain way to help programs, tag editors and ultimately yourself identify them. The box on the opposite page reveals how this works in practice, and also shows you how to quickly rename hundreds of files at once, if necessary.

File-based tags

While most music and film/tv files share similar tags, the sad fact is that – like the proliferat­ion of file formats and containers – there’s no single standard for tags. Instead, separate tag systems exist depending on which file format you’re using. For the purposes of simplicity, we’ll focus on the most popular open formats: MP3, Vorbis OGG and FLAC for music, and MP4 and MKV for films.

MP3 stores its metadata inside ID3 tags. Confusing matters further is the fact that ID3 tags come in two versions, but we’ll focus on the newer, more flexible ID3V2 tags. Vorbis OGG and FLAC use their own native tagging system, which are identical to each other and collective­ly known as Vorbis comments. Confusing matters even further than that is the fact that some FLAC files can also contain ID3 tags, which can cause problems on some systems.

MP4 files support three widely supported tag sets: itunes, Iso-defined tags and 3gpp-defined tags. Unfortunat­ely, all these sets are optimised for music rather than TV shows or films. They can, however, be adapted; for example, Title refers to a film or episode title, while Artist refers to a film director or the title of a TV show, as does Album Artist. Album Title is used to define the TV show and season – for example,

Detectoris­ts Series 1. Track can then be used to denote episode number, while Year and Genre fields can be filled in as required – so Comedy, Sci-fi, Drama, and so on.

MKV files are awkward in that tags aren’t embedded into the file itself; instead you must create one or more XML files containing all the tag informatio­n following a specific format. This can be a single XML file for your entire collection or broken down to one file per DVD or episode. You can do this by hand – see https:// matroska.org/technical/specs/tagging for details.

While tags aren’t as rich as the metadata offered by scraping services, you can still record a lot of detail in your file-based keyword tags. Available tags go far beyond simply offering an artist name and track name – you can also record data about the parent album name (and album artist name if it’s different to the artist – for example on a compilatio­n album), track composer, track number and disc number for multi-disc albums. ID3V2 tags also extend to support films and TV shows in the form of episode names, series and episode number. It’s also possible to embed artwork into files.

Adding and editing tags

When you buy music online, the tracks should come with metadata filled in. The same is true when you rip a CD using a tool like fre:ac (www.freac.org) – it searches the CDDB online database, then downloads artist, album and track informatio­n before embedding the tags into whichever file format you rip the disc to.

Tools like Handbrake for video-file ripping and conversion don’t provide any metadata, so you’ll need to add these manually later. Ironically, the command-line tool powering Handbrake – Ffmpeg – does enable you to embed metadata into files, but it’s not particular­ly user-friendly.

Ubuntu enables you to view a media file’s core tags, but not to edit them. Simply right-click the file and choose Properties > Audio/video to get informatio­n such as title and artist. If you’re at the command line, browse to a file’s parent directory and type ls -l . You can edit tags manually in fre:ac, but a simpler solution is to open Software Centre and search for EASYTAG. This handy tool lets you view, edit and download music (but not film or TV) tags from both the freedb and Musicbrain­z online databases.

The program can take a little getting used to: manually viewing and editing tags is simple enough, as you can see on the left. You can also opt to embed album or single artwork directly into each music track; the benefit of this is that you ensure a copy of the artwork is always available, plus you get to choose what quality of artwork to provide.

Artwork can be found online – do an image search for an album or single title and maybe ‘CD’ if the title’s too broad – or you can scan in CD covers and then edit them. 600x600 pixels is a good size, and save it in JPEG format to reduce the file size. The JPEG is embedded into each file you tag it to, thus can have a cumulative effect on the size of your media files.

There are several tools to quickly generate and update tags too. When it comes to generating tags where none exist, click the CDDB search button on the main toolbar to open a separate window.

Type your search terms into the Search box – if searching for a compilatio­n album, include ‘Various’ as the artist name if necessary. Use the ‘Search Fields’ box to filter the search by one or more of artist, album, track name or ‘other’ (all other fields, such as composer). You can also filter by category, but in the first instance it’s usually best to keep the search as wide as possible.

Results appear listed by Artist/album – click one and that album’s tracks appear in the right-hand pane. Click each track in turn, and you’ll see the correspond­ing track highlighte­d in the file navigator pane. Assuming your filenames have been named with the track number as a prefix, you should find they match up perfectly to the album from the CDDB search. If this is the case, click the ‘Select all lines’ button beneath the Results window and you should see that all the tracks are selected in both the CDDB Search

window and the main EASYTAG window. Click Apply and all the tags will be assigned.

What if your filenames don’t have the all-important track number to keep them in the correct order? Tick ‘Match lines with the Levenshtei­n algorithm’ before performing your search, and when you click each track in the results pane you should find the correct tracks are marked in the main EASYTAG window, thus enabling you to click Apply.

Nothing gets written to the actual files until you press Ctrl+s – if you navigate to another folder, you’ll be prompted to confirm your changes, where you can click Discard or Save depending on what you want to do. Before saving, you can undo changes or click ‘Remove tags’ to wipe all existing tags and start again.

Use pattern-matching

Another technique is to use the Tag and Filename Scan, which lets you quickly fill in tags using informatio­n in the folder and filenames, rename files based on existing tags, and perform quick fixes to tag fields. This includes changing the letter case, along with converting special characters and spaces.

Select ‘View > Show Scanner’ to bring up the window. To create tags using filename and folder informatio­n, select the Fill Tag tab. The tool uses fill masks to extract the required informatio­n. There should be a legend explaining what each mask means – for example, ‘%b’ is ‘album’ – but if it’s missing click the Show/hide Legend button in the top right corner.

What you need to do is to pick the correct file mask to match your folder structure of artist/album/01 – track name.mp3. There’s a drop-down menu of preset choices, but none quite fit. However, if you select ‘%a-%b/%n-%t’ from the drop-down menu, then change it to %a/%b/%n-%t you should find it now matches perfectly. Click ‘Scan files’ and all selected files in the main window are tagged accordingl­y. Having to do this manually for each album in your collection would be time-consuming, so save time by adding your new mask to the list of available masks: click the Show/ Hide Masks Editor button followed by the ‘Create…’ button. Copy and paste %a/%b/%n-%t into the ‘New_ mask’ box. Once done, click the + button to make it the default mask followed by the ‘Save masks’ button.

Switch to the ‘Rename File’ tab if you want to rename your tracks using informatio­n from your tags. It’s typically used to add the track number to the front of the file where it doesn’t exist, and the default ‘%n - %t’ choice should work in most cases.

Finally, the Process Fields tab enables you to tidy up various fields – for example, by capitalisi­ng the first word of song titles, or by removing or converting unwanted characters such as ‘%20’ to spaces.

Edit film tags

While it’s technicall­y possible to edit MP4 tags in

EASYTAG, this is not ideal. Translatin­g the tags isn’t the issue here as we’ve already explained, but you’ll only be able to tag files by hand: Easytag’s automatic search servers (see Edit > Preference­s > CDDB) are audioonly, namely freedb.org and Musicbrain­z.

If you want to tag film and TV files quickly, you’ll need to install a Java-based app: tinymediam­anager.

The step-by-step guide opposite reveals how it works. Sadly none of this informatio­n is embedded into your MP4 files; instead, the metadata is stored inside a single NFO file which is optimised for Kodi and written in XML format.

All artwork is downloaded as separate images, and all these files are placed in the same folder as the file they’re providing metadata for, sharing similar filenames to make them easy to identify. It’s less elegant than embedding the informatio­n directly, but it allows more metadata to be stored and is recognised in other programs too, such as Jellyfin. If you do go down this path, we’d recommend storing films in separate folders to keep things reasonably organised.

 ??  ??
 ??  ?? Programs like Kodi ‘scrape’ online databases for media and artwork.
Programs like Kodi ‘scrape’ online databases for media and artwork.
 ??  ?? If you plan to embed artwork into your media files, look for images 600 x 600 pixels in size that will blow up well.
If you plan to embed artwork into your media files, look for images 600 x 600 pixels in size that will blow up well.

Newspapers in English

Newspapers from Australia