Improved language tagging in GPAC

We’ve recently improved the language tagging in GPAC, and in particular in MP4Box and in MP4Client. This posts gives details about how to use these new features.

MP4 files (and GPAC) have been using a 3-character-code to indicate the language of a track, following the standard ISO 639-2:1998. This way of language tagging has since then been superseeded and the current practice is to use an IETF standard called BCP-47 (Best Current Practice) a.k.a. RFC 5646. This new language tagging approach is a bit more complex. It mainly 2, 3 or 4 characters, possibly followed by extensions separated with “-” for instance for regional or script variations of a language. Examples of tags are: “en”, “fr-FR” (French French) vs. “fr-CA” (Canadian French), … see more examples here.

BCP-47 tagging is standard in MPEG-DASH for language tagging and has been recently enabled in the ISO Base Media File Format, through a new box called “ExtendedLanguageBox” (code “elng”). In GPAC, it can now be used for audio tracks, subtitle tracks or any other track.

Here are some examples of MP4Box command lines where BCP-47 tags can be used:

This will set the language of file.mp4 to “English US”. The MP4 file will still indicate the old language tagging “eng” but will additionally contain a “elng” box with the code “en-US”.

This command will display the new language information:

Note that it is of course still possible to set the language track by track as follows (here 1 is the track id):

or to set it during the import of a track:

It is now also possible to generate DASH sequences with these language information, for instance using:

The MPD will look as follows:

The DASH clients of GPAC have also been extended to support selection of BCP-47 tagged representations.