Difference between revisions of "Video file tagging"

From Official Kodi Wiki
Jump to navigation Jump to search
(→‎Tag field mapping table: say what parentheses mean)
(→‎Tag field mapping table: put AVI 4cc tags not yet supported by Kodi into parentheses)
Line 107: Line 107:
| || <code>album_artist</code> || <code>aART</code> ||  || <code>ALBUMARTIST</code> || <code>-R</code>, <code>-albumartist</code> || album artist
| || <code>album_artist</code> || <code>aART</code> ||  || <code>ALBUMARTIST</code> || <code>-R</code>, <code>-albumartist</code> || album artist
| ''Album'' || <code>album</code> || <code>©alb</code> || <code>IPRD</code> || <code>ALBUM</code> || <code>-A</code>, <code>-album</code> || album title
| ''Album'' || <code>album</code> || <code>©alb</code> || (<code>IPRD</code>) || <code>ALBUM</code> || <code>-A</code>, <code>-album</code> || album title
| || <code>artist-sort</code> || <code>soar</code> ||  || <code>ARTISTSORT</code> ||  ||  
| || <code>artist-sort</code> || <code>soar</code> ||  || <code>ARTISTSORT</code> ||  ||  
| ''Artist'' || <code>artist</code>, <code>author</code> || <code>©art</code>, <code>©ART</code> || <code>IART</code> || <code>ARTIST</code> || <code>-a</code>, <code>-artist</code> || artist information
| ''Artist'' || <code>artist</code>, <code>author</code> || <code>©art</code>, <code>©ART</code> || (<code>IART</code>) || <code>ARTIST</code> || <code>-a</code>, <code>-artist</code> || artist information
| || <code>comment</code> || <code>©cmt</code> || <code>ICMT</code> || <code>COMMENT</code> || <code>-c</code>, <code>-comment</code> || general comment
| || <code>comment</code> || <code>©cmt</code> || (<code>ICMT</code>) || <code>COMMENT</code> || <code>-c</code>, <code>-comment</code> || general comment
| || <code>compilation</code> || <code>cpil</code> ||  || <code>COMPILATION</code> ||  ||  
| || <code>compilation</code> || <code>cpil</code> ||  || <code>COMPILATION</code> ||  ||  
Line 119: Line 119:
| ''WritingCredits'' (split at slashes) || <code>composer</code> || <code>©wrt</code> ||  || <code>COMPOSER</code> || <code>-w</code>, <code>-writer</code> || composer information
| ''WritingCredits'' (split at slashes) || <code>composer</code> || <code>©wrt</code> ||  || <code>COMPOSER</code> || <code>-w</code>, <code>-writer</code> || composer information
| || <code>copyright</code> || <code>©cpy</code>, <code>cprt</code> || <code>ICOP</code> || <code>COPYRIGHT</code> || <code>-C</code>, <code>-copyright</code> || copyright information
| || <code>copyright</code> || <code>©cpy</code>, <code>cprt</code> || (<code>ICOP</code>) || <code>COPYRIGHT</code> || <code>-C</code>, <code>-copyright</code> || copyright information
| || <code>creation_time</code> ||  ||  || <code>ENCODINGTIME</code> ||  ||  
| || <code>creation_time</code> ||  ||  || <code>ENCODINGTIME</code> ||  ||  
Line 131: Line 131:
| || <code>disc</code> || <code>disk</code> ||  || <code>DISCNUMBER</code> || <code>-d</code>, <code>-disk</code> / <code>-D</code>, <code>-disks</code> || disk number / number of discs
| || <code>disc</code> || <code>disk</code> ||  || <code>DISCNUMBER</code> || <code>-d</code>, <code>-disk</code> / <code>-D</code>, <code>-disks</code> || disk number / number of discs
| || <code>encoded_by</code> || <code>©too</code> || <code>ITCH</code> || <code>ENCODEDBY</code> || <code>-e</code>, <code>-encodedby</code> || name of the person or company who encoded the file
| || <code>encoded_by</code> || <code>©too</code> || (<code>ITCH</code>) || <code>ENCODEDBY</code> || <code>-e</code>, <code>-encodedby</code> || name of the person or company who encoded the file
| || <code>encoder</code> ||  || <code>ISFT</code> || <code>ENCODERSETTINGS</code> || <code>-E</code>, <code>-tool</code> || software used for encoding
| || <code>encoder</code> ||  || (<code>ISFT</code>) || <code>ENCODERSETTINGS</code> || <code>-E</code>, <code>-tool</code> || software used for encoding
| (''ProductionCode'') || <code>episode_id</code> || <code>tven</code> ||  || <code>TVEPISODEID</code> || <code>-o</code>, <code>-episodeid</code> || TV episode ID
| (''ProductionCode'') || <code>episode_id</code> || <code>tven</code> ||  || <code>TVEPISODEID</code> || <code>-o</code>, <code>-episodeid</code> || TV episode ID
Line 139: Line 139:
| || <code>episode_sort</code> || <code>tves</code> ||  || <code>TVEPISODE</code> || <code>-M</code>, <code>-episode</code> || episode number
| || <code>episode_sort</code> || <code>tves</code> ||  || <code>TVEPISODE</code> || <code>-M</code>, <code>-episode</code> || episode number
| ''Genre'' (split at slashes) || <code>genre</code> || <code>©gen</code>, <code>gnre</code> || <code>IGNR</code> || <code>GENRE</code> || <code>-g</code>, <code>-genre</code> / <code>-j</code>, <code>-genreid</code> || genre name / ID
| ''Genre'' (split at slashes) || <code>genre</code> || <code>©gen</code>, <code>gnre</code> || (<code>IGNR</code>) || <code>GENRE</code> || <code>-g</code>, <code>-genre</code> / <code>-j</code>, <code>-genreid</code> || genre name / ID
| (''Set'') || <code>grouping</code> || <code>©grp</code> ||  || <code>CONTENTGROUP</code> || <code>-G</code>, <code>-grouping</code> || grouping name
| (''Set'') || <code>grouping</code> || <code>©grp</code> ||  || <code>CONTENTGROUP</code> || <code>-G</code>, <code>-grouping</code> || grouping name
Line 145: Line 145:
| || <code>hd_video</code> || <code>hdvd</code> ||  || <code>ITUNESHDVIDEO</code> || <code>-H</code>, <code>-hdvideo</code> || HD flag (1/0)
| || <code>hd_video</code> || <code>hdvd</code> ||  || <code>ITUNESHDVIDEO</code> || <code>-H</code>, <code>-hdvideo</code> || HD flag (1/0)
| || <code>language</code> ||  || <code>ILNG</code> || <code>LANGUAGE</code> ||  ||  
| || <code>language</code> ||  || (<code>ILNG</code>) || <code>LANGUAGE</code> ||  ||  
| || <code>lyrics</code> || <code>©lyr</code> ||  || <code>UNSYNCEDLYRICS</code> || <code>-L</code>, <code>-lyrics</code> || unsynchronized lyrics
| || <code>lyrics</code> || <code>©lyr</code> ||  || <code>UNSYNCEDLYRICS</code> || <code>-L</code>, <code>-lyrics</code> || unsynchronized lyrics
Line 167: Line 167:
| ''Title'' || <code>title</code> || <code>©nam</code> || <code>INAM</code> || <code>TITLE</code> || <code>-s</code>, <code>-song</code> || song title, track name
| ''Title'' || <code>title</code> || <code>©nam</code> || <code>INAM</code> || <code>TITLE</code> || <code>-s</code>, <code>-song</code> || song title, track name
| ''Track'' || <code>track</code> || <code>trkn</code> || <code>IPRT</code> || <code>TRACK</code> || <code>-t</code>, <code>-track</code> / <code>-T</code>, <code>-tracks</code> || track number / number of tracks
| ''Track'' || <code>track</code> || <code>trkn</code> || (<code>IPRT</code>) || <code>TRACK</code> || <code>-t</code>, <code>-track</code> / <code>-T</code>, <code>-tracks</code> || track number / number of tracks

Revision as of 10:44, 6 May 2020

Home icon grey.png   ▶ Video library ▶ Video file tagging
Incomplete.png INCOMPLETE:
This page or section is incomplete. Please add information or correct uncertain data which is marked with a ?
Emblem-important-yellow.png NOTICE:
This feature is currently for movies only. TV shows and music videos are not yet supported.
Emblem-important-yellow.png NOTICE:
This page describes an alternative way of adding movies to the library that is not dependent on file names or online scrapers.
Create Video Libraries
1. The Basics
2. Source Folder
3. Movie Setup
4a. TV Show Setup
4b. Seasons Setup
4c. Episodes Setup
5. Music Videos Setup
6. Add Source & Scrape
7. Scraping Problems

Kodi v18 Leia introduces support for embedded video tags using *.mkv and *.mp4 video files. *.avi support is available since v18.x. They are similar in principle to the tags saved in audio files. Only limited support for video tags is available at this time.

1 Benefits of embedded video tags

There are multiple reasons why one would want to use this feature: Media may already contain useful metadata (the reverse however is also true - many files contain "junk" metadata, hence why the feature defaults to off). It gives one more control over the metadata than scrapers do (as scrapers may misclassify media and pull the wrong data). It does away with the need to have .nfo files. Since metadata travels with the media file, there is no longer a need for potentially thousands of these smaller files and can make directory management even easier. Using ultra-high resolution artwork/cover images that looks nicer on newer HD displays. (Pretty pictures!)

1.1 How does it change/differ from the old model?

Kodi has two options for metadata import: using an online scraper or using local information, traditionally in the form of .nfo files. Local tag reading is bundled into the "Local Information" arm, as logically, metadata is still local (i.e not network-drawn) information. Thus, one can still use a combination of .nfo files and embedded information if they choose "Local Information" rather than to use a scraper.

It is important to note however that .nfo files will override embedded information. Not all of Kodi's NFO features are supported by embedded metadata yet, so many users may wish to still use the NFO method. (https://forum.kodi.tv/showthread.php?tid=326340)

1.2 Settings

Kodi settings have the option to enable or disable the reading of video file tags at Settings > Media Settings > Videos > Use video tags. The default setting is disabled.

This page assumes this setting has been enabled.

2 Folder & File Structure

The use of Video File Tags does not absolve you from using the correct Folder and File structure for Movies, TV Shows and Music Videos as detailed in the previous pages.

3 Tagging

Stop hand.png These pages are maintained by the community and should not be considered an endorsement or recommendation. *

Note: User-friendly options for adding and editing embedded metadata may be lacking for your given platform. Be prepared for challenges when going down this path.

3.1 Windows

MP3tag is a Windows-based metadata editor for many different files and tag types, including MP4 and MKV (despite what it's name may suggest). While somewhat complex, it provides very fine-grained control over tagging, and is a worthwhile asset in any media management library.

MetaX is a user-friendly tagging solution. However, it is proprietary and paid ($10). It features much the same core features as MP3tag, but adds an online search functionality to grab metadata from providers such as iTunes, Amazon and others, as well as an autotag feature. This can be useful to people with enormous media collections where the time saved manually tagging justifies the price.

3.2 Mac

  • MetaZ is a free and open source MP4 metadata lookup and editor for Mac OS.

3.3 Linux

  • mp4v2

3.4 Cross-platform

  • exiftool

3.5 A note on iTunes

Apple, in their wisdom, have created a subset of MP4 tags that are strictly speaking only meant for use with iTunes. However, most tagging software can read and write these iTunes tags. These tags are also quite useful but some will not work with Kodi. Tags include the ability to store Cast (actors), Screenwriter and Director information, as well as age restriction data such as MPAA ratings.

The important point to note here is that just because your tagging software allows you to add these does not mean they will be used by Kodi.

4 Core Tags

While there are an absolute myriad of tags that one can use, many, if not most of these are unnecessary for video files. Remember that MP4 tags have to have fields for everything - TV shows, movies, music videos, music, audiobooks, and even images! We usually do not want to populate tags related to music (such as Artist) in a movie file. As such here are some of the most critical tags for video (TV show and Movie) files.

4.1 Title

Kodi will not import a media file without a valid Title in the metadata tag. This makes it the most critical tag of all. An exception is made for MKV files which have an IMDBURL or TMDBURL metatag.

Title differs from filename - I may have a file called Blade_Runner_2049_(2017)Withalotofexcessinformation.mp4, But the title value can simply be "Blade Runner 2049". Kodi will then display "Blade Runner 2049".

Beware that many people who distribute video files do not care much for proper metadata within the file even if they are shipping proper NFO or XML files with them. Regardless, their files may still have tags, but with rubbish or spam content.

4.2 Description

This describes the movie/TV Show. A snippet from iTunes' description of Blade Runner 2049 is as follows: "Thirty years after the events of the first film, a new blade runner, LAPD Officer K (Ryan Gosling), unearths a long buried secret that has the potential to plunge what’s left of society into chaos."

Descriptions thus actually describe the character or basic plot of a movie or TV Show. These will be displayed in Kodi when the file is selected.

Best practice at this point seems to be to mirror the Long Description and Short Description, as there does not seem to be any practical distinction between the two.

When using this tag with TV Shows, every episode can be individually described according to the plot of that particular episode.

4.3 Content Type

In MP4 there should be four choices: Music, Music Video, Movie and TV Show. The choice does not seem to matter at this point as Kodi can not distinguish files based on this tag, but rather relies on the manual setting when the directory was added. It might be useful to set this properly when tagging however, as a future change to allow Kodi to distinguish these tags may prove invaluable.

4.4 Cover/Picture

For some users, the singular greatest benefit to tags is being able to set your own cover image. Don't like the standard cover? Use the Collectors Edition or Digital Download cover.

4.5 TV Show Specific Tags

There are three more tags that should be filled in for TV Shows: Show (tvsh), numeric Season (tvsn) and Episode Number (tves) and the unique Production Code (tven). At the moment these tags do not seem to be of any practical use in Kodi, but should nevertheless be filled out as this may change.

5 Supported Tags

Kodi relies on FFmpeg libraries to import MP4, MKV and AVI metadata. The documentation in the Multimedia.cx wiki is not always up to date, but is correct in general. For proper details, one needs to inspect the mov_write_****_tag() functions in the FFmpeg source code.

are the tags in this table for both mkv and mp4?
Both MP4 and MKV tags are supported, although they use fundamentally different methods of encoding metadata.
I cannot find these video related tags in mp3tag
To get to all the juicy video file related tags in mp3tag, right click on your video file and select "Extended Tags". From here one can see all the tags currently in a file. Add new ones by clicking on the Add button, selecting a Field (what tag to edit) and entering a value. The most critical one in all cases is TITLE, as it seems Kodi will not add a media file if this core tag is missing (and there is no .nfo file).
This will also allow you to add the cover artwork.
What format is this- id3, APE, Generic, MP4, other?
MP4 files use "moov" atoms embedded within the file. These are the same ones used in AAC audio files (such as m4a).
IMDBURL/TMDBURL is this one tag or two separate tags?
Two separate ones, only supported within Matroska (MKV) files currently.

5.1 Tag field mapping table

Kodi FFmpeg MP4 box/atom AVI FourCC Mp3tag mp4tags/mp4v2 CLI Description
album-sort, sort_album soal ALBUMSORT
album_artist aART ALBUMARTIST -R, -albumartist album artist
Album album ©alb (IPRD) ALBUM -A, -album album title
artist-sort soar ARTISTSORT
Artist artist, author ©art, ©ART (IART) ARTIST -a, -artist artist information
comment ©cmt (ICMT) COMMENT -c, -comment general comment
compilation cpil COMPILATION
WritingCredits (split at slashes) composer ©wrt COMPOSER -w, -writer composer information
copyright ©cpy, cprt (ICOP) COPYRIGHT -C, -copyright copyright information
creation_time ENCODINGTIME
(Premiered) year ©day YEAR -y, -year release date
PlotOutline, (Overview) description desc DESCRIPTION -l, -longdesc long description
disc disk DISCNUMBER -d, -disk / -D, -disks disk number / number of discs
encoded_by ©too (ITCH) ENCODEDBY -e, -encodedby name of the person or company who encoded the file
encoder (ISFT) ENCODERSETTINGS -E, -tool software used for encoding
(ProductionCode) episode_id tven TVEPISODEID -o, -episodeid TV episode ID
episode_sort tves TVEPISODE -M, -episode episode number
Genre (split at slashes) genre ©gen, gnre (IGNR) GENRE -g, -genre / -j, -genreid genre name / ID
(Set) grouping ©grp CONTENTGROUP -G, -grouping grouping name
hd_video hdvd ITUNESHDVIDEO -H, -hdvideo HD flag (1/0)
language (ILNG) LANGUAGE
lyrics ©lyr UNSYNCEDLYRICS -L, -lyrics unsynchronized lyrics
media_type stik ITUNESMEDIATYPE -i, -type Media Type (TV Show, Movie, Music, Audiobook ...)
(Studio) network tvnn TVNETWORK -N, -network TV network
(Director) performer ©con CONDUCTOR
(Studio) publisher PUBLISHER
season_number tvsn TVSEASON -n, -season season number
(ShowTitle) show tvsh TVSHOW -S, -show TV show
Plot synopsis ldes PODCASTDESC -m, -description short description
(SortTitle) title-sort sonm TITLESORT
Title title ©nam INAM TITLE -s, -song song title, track name
Track track trkn (IPRT) TRACK -t, -track / -T, -tracks track number / number of tracks

Kodi variables in parentheses are not supported at the moment, but if they are in the future, these are the most likely mappings.

5.2 MKV tag options

MKV tagging currently does mostly ignore the Matroska tagging specification to fill library info. Instead, a Kodi standard NFO file can be embedded into MKV files.

  • An attachment named kodi-metadata will be scanned as an embedded .nfo file
  • An attachment named kodi-override-metadata will be scanned as a url nfo if combined with specifying IMDB/TMDB url. if alone, you get an override nfo

The only textual tags supported in MKV fields as of v18.6 are (case-insensitive) Title = title, Director = director (multiple entries may be separated by a forward slash) and Year = date_released.

5.3 AVI tag options

As of v18.6, Kodi only recognizes Title and Year variables from AVI tags.

6 Artwork

For MKV you can have embedded images. currently limited to:

  • 'small_cover.png' or 'small_cover.jpg' for thumb
  • 'cover.png' or 'cover.jpg' for poster
  • 'fanart.png' or 'fanart.jpg' for fanart

'poster' images can be embedded in MP4 files.

Return to top

Next step: Add Source & Scrape