Search code examples
videometadatakodimkv

Importing video in kodi Movies Library using metatag title instead of filename


I am trying to make sense of the documentation for Kodi and Video Tagging. The documentation states:

It seems that Kodi will not import a media file without a valid title in the metadata tag. This makes it the most critical tag of all.

Title also 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).

So here is what I tried on my side (as a native French speaker). I like using my own file name convention, for instance: 2010 Moi, moche et méchant (Despicable Me).mkv. To make the video easily imported in Video Library I tried a simple:

$ mkvpropedit "2010 Moi, moche et méchant (Despicable Me).mkv" --edit info --set title="Despicable Me"

However when I import a folder with this file in it, it continue to fail to recognize it. I need to manually fix the library entry (Refresh option).

So my questions:

  1. What does the title metatag inside MP4 or MKV does actually ?
  2. Is there a way to keep my own filename convention AND set enough metatag to get the file to be recognize properly (I am not a big fan of NFO).

Update I also tried the following experiment:

$ mkvpropedit "Blade.mkv" --edit info --set title="Blade Runner 2049"

The movie with filename "Blade.mkv" is being recognized as 'Blade' instead of 'Blade Runner 2049'.


Solution

  • Starring at the source code long enough I figure the logic is here:

    The function CVideoInfoScanner::FindVideo only takes as input the filename as stored on disk. This leads to something like this in the debugger:

    #0  VIDEO::CVideoInfoScanner::FindVideo (this=0x55757515fbf0, videoName="BigBuckBunny_320x180.mp4", 
        scraper=std::shared_ptr (count 3, weak 1) 0x7f3b2801d780, url=..., progress=0x0) at VideoInfoScanner.cpp:2114
    

    So this returns no result for the file eventhough the title was set nicely in the ISO Media, MP4 Base Media v1 [IS0 14496-12:2003] container

    $ wget http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4
    $ ffprobe -i BigBuckBunny_320x180.mp4 2>&1| grep title
        title           : Big Buck Bunny
    

    For comparison music is handled very differently since a whole set of tags are being read directly from the MP3 file itself, see:


    Update

    Because I believe this would a nice feature to have in future version, I did report an issue in Trac:


    Update 2

    I have prepared a pull request and it was accepted today: