jamerst/AutoTag

macOS, some mp4 tags missing

Kiatra opened this issue · 7 comments

Works great on macOS tagging mp4 files, but some tags are missing.

title: ok
programme: missing
season: missing
episode: missing
genre: ok

Not sure if this is a taglib issue.

Might also be due to the media kind tag not being set. The tags for TV shows seem to not show without setting media kind in Apple TV.

Screenshot 2022-04-12 at 23 03 27

Screenshot 2022-04-12 at 23 31 06

The output on the command line and the renaming looks good though.

AutoTag v3.2.0
https://jtattersall.net

Star.Trek.Lower.Decks.S02E01.1080p.mkv:
    Found Star Trek Lower Decks S02E01 (Strange Energies) on TheMovieDB
    Successfully tagged file as Star Trek: Lower Decks S02E01 (Strange Energies)
    Successfully renamed file to 'Star Trek: Lower Decks - 2x01 - Strange Energies.mkv'


File successfully processed.

Not sure if you support mp4 tagging would be really nice though!

The tags should be written to the file, it's possible that Apple TV is using different tag names to the standard though.

I also don't know how the media kind is stored, knowing Apple it might not be stored in the file itself.

Could you upload a small demo file that is tagged correctly according to Apple TV?

mp4 files are supported, though the extended tagging mode is only supported for mkv files.

Thanks for looking into this!

I tagged a file with AutoTag, this adds the artwork and title tag to the mp4. Then added the "TV Show" via Apple TV, this then enables the episode and season tags and I tagged those as well via the Apple TV App on macOS.

Sample file tagged with Apple TV and exported (5 mb file):
https://user-images.githubusercontent.com/9993201/164723334-08ead75d-de55-4d30-b722-69d2907dd2cc.mp4

Thanks for providing the file.

I've had a look at it and I think I've managed to work out where Apple TV is storing/reading the data from.

I've attempted to write the tags with TagLib, however I'm not sure if they're correct. MediaInfo doesn't read them all correctly compared to the original file, though they should be identical in theory.

Please could you try opening this file in Apple TV to see if the tags are read correctly now?

autotag.mp4

Looks like some progress was made! The file was tagged mostly correctly except the episode number is empty, instead episodeid is set with the episode number.

Comparing the file you uploaded with one tagged via "Apple TV" with ffmpeg:

ffmpeg -i testfile.mp4 -f ffmetadata

I saw that the episode number should go into the episode_sort

ffmpeg output of the file you provide after I retagged it in Apple TV (Added the 10 in the episode number filed, and put a 2x10) string in the episode id:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2-10 First First Contact.mp4:
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.76.100
    title           : First First Contact
    description     : In the season two finale, the U.S.S. Cerritos is tasked to aid another class starship on a first contact mission.
    genre           : Sci-Fi & Fantasy; Animation; Comedy
    album           : Star Trek: Lower Decks
    disc            : 2
    track           : 10/10
    media_type      : 10
    show            : Star Trek: Lower Decks
    season_number   : 0
    episode_id      : 2x10
    episode_sort    : 10

This is the ffmpeg output of the file you provided:

1b0c-e2e5-4f27-9121-ac142028f307.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.76.100
    title           : First First Contact
    description     : In the season two finale, the U.S.S. Cerritos is tasked to aid another class starship on a first contact mission.
    genre           : Sci-Fi & Fantasy; Animation; Comedy
    album           : Star Trek: Lower Decks
    disc            : 2
    track           : 10/10
    media_type      : 10
    show            : Star Trek: Lower Decks
    season_number   : 0
    episode_id      : 10

I also found a list of the tags how-to-add-new-and-non-defined-metadata-to-an-mp4-file

Also the file I send you was already tagged via autotag and I then added missing tags via Apple TV. When I just tag a clean file via Apple TV to show season and episode these additional tags show up so they are the minimal. season_number and disc seems to be both work as an indicator for the season.

    genre           : Sci-Fi & Fantasy
    show            : Star Trek: Lower Decks
    season_number   : 1
    episode_sort    : 3

The episode_sort tag should now be set instead, would you mind checking how it displays in Apple TV again with this new file?

autotag.mp4

For some reason ffmpeg is reporting the episode_sort value as 7 for that file, but I can't work out why. Checking the file with a hex editor confirms the value in the file appears to be 10, so I'm not sure what's going on there. I'm hoping Apple TV recognises it correctly as 10?

Succes! :)

Screenshot 2022-04-23 at 23 08 47

Interesting my ffmpeg also shows 7. But Apple TV correctly shows 10.

Thanks for the fix! I will then be able to sync shows to my iPad via Apple TV :)

I've now uploaded v3.3.0 which will write the Apple tags to mp4 files when used with the argument --apple-tagging.

It also sets the media type for movies too, so any Apple products will also recognise them as movies.