Kodi Community Forum
Custom language in advancedsettings - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Video Support (https://forum.kodi.tv/forumdisplay.php?fid=264)
+--- Thread: Custom language in advancedsettings (/showthread.php?tid=374048)



Custom language in advancedsettings - koren1 - 2023-08-08

Hello,

I have some movies with french audio and other movies with french but the canadian variant. I would like to distinguish the two languages.

I have tried to set the language to canadian, but it's not possible. If I'm correct, we must specify a language according to iso 693-2B. If it's right, I can only set a language as french and I can't distinguish french and the french canadian variant. I would like to be able to do it. After searching, it seems to be possible since nexus to define custom language codes in  advancedsettings.xml .

So with ffmpeg and I have set canadian audio  to fr-ca

My advancedsettings.xml:
 
Code:
<advancedsettings version="1.0">
        <languagecodes>
                <code>
                        <short>fr-ca</short>
                        <long>Canada</long>
                </code>
        </languagecodes>
</advancedsettings>

Unfortunately, when I play a video, the language is displayed as "French" and not "Canada" as expected. I have Coreelec nexus 20.2 and my skin is Aeon Nox Silvo.

What am I doing wrong ?


RE: Custom language in advancedsettings - izprtxqkft - 2023-08-08

in computing, outside of Windows, case matters

based on the examples on the page you link the region codes are capitalized so following the examples you should be using fr-CA and not fr-ca (they are not the same thing)

only an observation, ymmv


RE: Custom language in advancedsettings - scott967 - 2023-08-09

(2023-08-08, 15:15)koren1 Wrote: So with ffmpeg and I have set canadian audio  to fr-ca

I didn't think ffmpeg let you do that?  Turn on debug logging, start play on the movie and look what Kodi logs from ffmpeg for stream metadata.

A quick test with
Code:
ffmpeg.exe -i copy.mp4 -metadata:s:a:0 language=fr-ca -vcodec copy -acodec copy test.mp4
didn't work for me.

scott s.
.


RE: Custom language in advancedsettings - koren1 - 2023-08-09

(2023-08-08, 16:46)jepsizofye Wrote: based on the examples on the page you link the region codes are capitalized so following the examples you should be using fr-CA and not fr-ca (they are not the same thing)

That's right, I tried with fr-CA but it didn't help.
scott967 Wrote: I didn't think ffmpeg let you do that? Turn on debug logging, start play on the movie and look what Kodi logs from ffmpeg for stream metadata.

It seems to work for me. First, I don't use mp4 container for my movies, I use matroska. I set fr-ca with ffmpeg 6.0 on a linux system.
Kodi runs in a separate computer with Coreelec. I used the following command:
 
Code:
ffmpeg -i video.mkv -map 0 -metadata:s:a:3 language=fr-ca -metadata:s:a:4 language=fr-ca -c copy -shortest output.mkv

After I upload it on kodi and play the file with kodi. The name of the file is: Moana\(2016\).4k.truehd.atmos.hdr.10bit.x265.mkv

You can have a look at the kodi log.

I don't see any errors. When playing the videos, I switched to the audio labeled fr-ca.

I'm running kodi on an odroid N2 with Coreelec 20.2. At the moment in my advancedsettings.xml I have defined fr-CA to be translated to Canada.
If I change it to fr-ca it doesn't help.

Can you see some problems or do you need more informations ?


RE: Custom language in advancedsettings - koren1 - 2023-08-22

So because I didn't succeed to translate fr-ca with Canada, I tried the example of the wiki https://kodi.wiki/view/Advancedsettings.xml#languagecodes

I used a command like the following:
 
Code:
ffmpeg -i video.mkv -map 0 -metadata:s:a:3 language=pt-BR -c copy output.mkv

After that I had the same in my advancedsettings.xml, but it was displayed in kodi as "Portuguese" not "Portuguese - Brazil".

Does the example of the wiki works for somebody ?

I don't know if I miss something or if there is a bug. If I don't find a solution, I will let the audio track as it is or maybe replace it by some french which correspond to my localization.


RE: Custom language in advancedsettings - scott967 - 2023-08-23

According to the code:
 
Code:
      //! @FIXME: Matroska v4 support BCP-47 language code with LanguageIETF element
      //! that have the priority over the Language element, but this is not currently
      //! implemented in to ffmpeg library. Since ffmpeg read only the Language element
      //! all tracks will be identified with same language (of Language element).
      //! As workaround to allow set the right language code we provide the possibility
      //! to set the language code in the title field, this allow to kodi to recognize
      //! the right language and select the right track to be played at playback starts.

But I tried to set the language code in the title and that didn't seem to work.

BTW I think
 
Code:
ffmpeg -i video.mkv -map 0 -metadata:s:a:0 language=pt-BR -c copy output.mkv
result in illegal language tag in mkv, as the mkv spec says the language element should be the the 3 letter code and you should use the language BCP47 element instead (which ffmpeg doesn't support).  See "Language Codes" here:  https://www.matroska.org/technical/notes.html

I went ahead and entered an issue, though maybe I'm not doing it right.

23655
scott s.
.


RE: Custom language in advancedsettings - koren1 - 2023-08-23

Thank you for entering an issue. After reading the code, I tried it again and I was able to get what I want. I have to use the title field.

I did the following:
 
Code:
ffmpeg -i video.mkv -map 0 -metadata:s:a:3 title=fr-CA -c copy output.mkv

I tested it with fr-CA and it works. As you wrote it, ffmpeg doesn't support BCP47 and a workaround must be used. So the proper fix is to be done in ffmpeg. So for the moment the only possibility is to use the fied title and not language. So the original content of the field title will be lost, but perhaps it's possible to add fr-CA at the end of the field title.
Quote:that pr implement add a kind of workaround that consist in to add in to the title field of mkv the expanded language code
so edit your mkv and add (fr-CA) at the end of title element field, when detected will be used instead of Language element field
You can also close the issue, I think it has been also answered in the issue.


For me it's solved, thank you for your support!!