Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LC is discarding the language tag from chapters in .MKV files #991

Closed
bigfella237 opened this issue Jan 21, 2022 · 8 comments
Closed

LC is discarding the language tag from chapters in .MKV files #991

bigfella237 opened this issue Jan 21, 2022 · 8 comments
Labels
bug ffmpeg Problem resides in ffmpeg or usage of ffmpeg

Comments

@bigfella237
Copy link

I'm using the latest version of LC. Here is a screenshot of the file's chapters open in MKVmerge before:

https://i.postimg.cc/3RPdg7FG/Lossless-Cut-Chapters-BEFORE.jpg

And after exporting:

https://i.postimg.cc/wvt1y3LH/Lossless-Cut-Chapters-AFTER.jpg

Lossless Cut is removing the language tags, which means I need to mux the file again to reset them. Could Lossless Cut be made to leave this tag intact (IE export the same values as were imported)?

Thanks!

@mifi
Copy link
Owner

mifi commented Feb 12, 2022

Is this cut or cut+merge? please provide some more information as explained in the template

@bigfella237
Copy link
Author

No, just a simple trim.

I was only using the MKVmerge software to reset the MKV flags back to "eng" after using Lossless Cut.

@mifi
Copy link
Owner

mifi commented Feb 12, 2022

any chance u could share a file? I've never seen chapter language before

@bigfella237
Copy link
Author

No problem, I just re-encoded this to a much lower resolution so it's a more manageable file size and added some chapters (set to "eng").

https://www.mediafire.com/file/zlw6lvsgrwf6qwa/Lossless_Cut_Test_File_%2528Low_Res_Re-encode%2529.mkv/file

I don't normally use the "Import Chapters" option so I'm not sure if that makes a difference, just drop it into Lossless Cut, trim any amount you like from it, then compare the chapters before and after.

Thanks

@mifi
Copy link
Owner

mifi commented Feb 12, 2022

Thanks. I ran ffprobe on your file, and it returns this:

[
  {
    id: 106667171,
    time_base: '1/1000000000',
    start: 0,
    start_time: '0.000000',
    end: 10000000000,
    end_time: '10.000000',
    tags: {
      title: 'Chapter 01',
    },
  },
  {
    id: -1371318106,
    time_base: '1/1000000000',
    start: 10000000000,
    start_time: '10.000000',
    end: 20000000000,
    end_time: '20.000000',
    tags: {
      title: 'Chapter 02',
    },
  },
  {
    id: -810947947,
    time_base: '1/1000000000',
    start: 20000000000,
    start_time: '20.000000',
    end: 30000000000,
    end_time: '30.000000',
    tags: {
      title: 'Chapter 03',
    },
  },
  {
    id: -2142281084,
    time_base: '1/1000000000',
    start: 30000000000,
    start_time: '30.000000',
    end: 40000000000,
    end_time: '40.000000',
    tags: {
      title: 'Chapter 04',
    },
  },
  {
    id: -1200737892,
    time_base: '1/1000000000',
    start: 40000000000,
    start_time: '40.000000',
    end: 49049000000,
    end_time: '49.049000',
    tags: {
      title: 'Chapter 05',
    },
  },
]

ffmpeg spits out:

  Chapters:
    Chapter #0:0: start 0.000000, end 10.000000
      Metadata:
        title           : Chapter 01
    Chapter #0:1: start 10.000000, end 20.000000
      Metadata:
        title           : Chapter 02
    Chapter #0:2: start 20.000000, end 30.000000
      Metadata:
        title           : Chapter 03
    Chapter #0:3: start 30.000000, end 40.000000
      Metadata:
        title           : Chapter 04
    Chapter #0:4: start 40.000000, end 49.049000
      Metadata:
        title           : Chapter 05

So there is no language detected by ffmpeg/ffprobe.

However MediaInfo seems to detect the language:


Menu
00:00:00.000                             : en:Chapter 01
00:00:10.000                             : en:Chapter 02
00:00:20.000                             : en:Chapter 03
00:00:30.000                             : en:Chapter 04
00:00:40.000                             : en:Chapter 05

Will have to look into it, but it looks like an ffmpeg issue. BTW I found this issue, possibly related: MediaArea/MediaAreaXml#34

#1027

@mifi mifi added ffmpeg Problem resides in ffmpeg or usage of ffmpeg bug labels Feb 12, 2022
@bigfella237
Copy link
Author

If I extract the "chapters" element directly from the .MKV file and open it with Notepad++ I see:

<?xml version="1.0"?>
<!-- <!DOCTYPE Chapters SYSTEM "matroskachapters.dtd"> -->
<Chapters>
  <EditionEntry>
    <EditionFlagHidden>0</EditionFlagHidden>
    <EditionFlagDefault>0</EditionFlagDefault>
    <EditionUID>3418007036680139663</EditionUID>
    <ChapterAtom>
      <ChapterUID>12346341782649019555</ChapterUID>
      <ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
      <ChapterTimeEnd>00:00:10.000000000</ChapterTimeEnd>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterDisplay>
        <ChapterString>Chapter 01</ChapterString>
        <ChapterLanguage>eng</ChapterLanguage>
      </ChapterDisplay>
    </ChapterAtom>
    <ChapterAtom>
      <ChapterUID>14678830363762186406</ChapterUID>
      <ChapterTimeStart>00:00:10.000000000</ChapterTimeStart>
      <ChapterTimeEnd>00:00:20.000000000</ChapterTimeEnd>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterDisplay>
        <ChapterString>Chapter 02</ChapterString>
        <ChapterLanguage>eng</ChapterLanguage>
      </ChapterDisplay>
    </ChapterAtom>
    <ChapterAtom>
      <ChapterUID>17970822921537055381</ChapterUID>
      <ChapterTimeStart>00:00:20.000000000</ChapterTimeStart>
      <ChapterTimeEnd>00:00:30.000000000</ChapterTimeEnd>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterDisplay>
        <ChapterString>Chapter 03</ChapterString>
        <ChapterLanguage>eng</ChapterLanguage>
      </ChapterDisplay>
    </ChapterAtom>
    <ChapterAtom>
      <ChapterUID>16782836598219694724</ChapterUID>
      <ChapterTimeStart>00:00:30.000000000</ChapterTimeStart>
      <ChapterTimeEnd>00:00:40.000000000</ChapterTimeEnd>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterDisplay>
        <ChapterString>Chapter 04</ChapterString>
        <ChapterLanguage>eng</ChapterLanguage>
      </ChapterDisplay>
    </ChapterAtom>
    <ChapterAtom>
      <ChapterUID>433599032052298140</ChapterUID>
      <ChapterTimeStart>00:00:40.000000000</ChapterTimeStart>
      <ChapterTimeEnd>00:00:49.049000000</ChapterTimeEnd>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterDisplay>
        <ChapterString>Chapter 05</ChapterString>
        <ChapterLanguage>eng</ChapterLanguage>
      </ChapterDisplay>
    </ChapterAtom>
  </EditionEntry>
</Chapters>

@bigfella237
Copy link
Author

Just to add to the above, the Language flag becomes much more important in this scenario where you might have chapters listed in multiple languages:

<?xml version="1.0"?>
<!-- <!DOCTYPE Chapters SYSTEM "matroskachapters.dtd"> -->
<Chapters>
  <EditionEntry>
    <EditionFlagHidden>0</EditionFlagHidden>
    <EditionFlagDefault>0</EditionFlagDefault>
    <EditionUID>3418007036680139663</EditionUID>
    <ChapterAtom>
      <ChapterUID>12346341782649019555</ChapterUID>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterDisplay>
        <ChapterString>Chapter 01</ChapterString>
        <ChapterLanguage>eng</ChapterLanguage>
      </ChapterDisplay>
      <ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
      <ChapterTimeEnd>00:00:20.000000000</ChapterTimeEnd>
    </ChapterAtom>
    <ChapterAtom>
      <ChapterUID>14678830363762186406</ChapterUID>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterDisplay>
        <ChapterString>Chapter 02</ChapterString>
        <ChapterLanguage>eng</ChapterLanguage>
      </ChapterDisplay>
      <ChapterTimeStart>00:00:20.000000000</ChapterTimeStart>
      <ChapterTimeEnd>00:00:49.049000000</ChapterTimeEnd>
    </ChapterAtom>
  </EditionEntry>
  <EditionEntry>
    <EditionFlagHidden>0</EditionFlagHidden>
    <EditionFlagDefault>0</EditionFlagDefault>
    <EditionUID>10881502284652382627</EditionUID>
    <ChapterAtom>
      <ChapterDisplay>
        <ChapterString>Chapitre 01</ChapterString>
        <ChapterLanguage>fre</ChapterLanguage>
      </ChapterDisplay>
      <ChapterUID>9474270449578469025</ChapterUID>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
      <ChapterTimeEnd>00:00:20.000000000</ChapterTimeEnd>
    </ChapterAtom>
    <ChapterAtom>
      <ChapterDisplay>
        <ChapterString>Chapitre 02</ChapterString>
        <ChapterLanguage>fre</ChapterLanguage>
      </ChapterDisplay>
      <ChapterUID>6132805354353343877</ChapterUID>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterTimeStart>00:00:20.000000000</ChapterTimeStart>
      <ChapterTimeEnd>00:00:49.049000000</ChapterTimeEnd>
    </ChapterAtom>
  </EditionEntry>
  <EditionEntry>
    <EditionFlagHidden>0</EditionFlagHidden>
    <EditionFlagDefault>0</EditionFlagDefault>
    <EditionUID>150742582447920281</EditionUID>
    <ChapterAtom>
      <ChapterDisplay>
        <ChapterString>Kapitel 01</ChapterString>
        <ChapterLanguage>ger</ChapterLanguage>
      </ChapterDisplay>
      <ChapterUID>8567636161335515582</ChapterUID>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
      <ChapterTimeEnd>00:00:20.000000000</ChapterTimeEnd>
    </ChapterAtom>
    <ChapterAtom>
      <ChapterDisplay>
        <ChapterString>Kapitel 02</ChapterString>
        <ChapterLanguage>ger</ChapterLanguage>
      </ChapterDisplay>
      <ChapterUID>13335010568281197443</ChapterUID>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterTimeStart>00:00:20.000000000</ChapterTimeStart>
      <ChapterTimeEnd>00:00:49.049000000</ChapterTimeEnd>
    </ChapterAtom>
  </EditionEntry>
  <EditionEntry>
    <EditionFlagHidden>0</EditionFlagHidden>
    <EditionFlagDefault>0</EditionFlagDefault>
    <EditionUID>16753243778213094583</EditionUID>
    <ChapterAtom>
      <ChapterDisplay>
        <ChapterString>Capítulo 01</ChapterString>
        <ChapterLanguage>spa</ChapterLanguage>
      </ChapterDisplay>
      <ChapterUID>2161846324810908801</ChapterUID>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>
      <ChapterTimeEnd>00:00:20.000000000</ChapterTimeEnd>
    </ChapterAtom>
    <ChapterAtom>
      <ChapterDisplay>
        <ChapterString>Capítulo 02</ChapterString>
        <ChapterLanguage>spa</ChapterLanguage>
      </ChapterDisplay>
      <ChapterUID>12803616733650064291</ChapterUID>
      <ChapterFlagHidden>0</ChapterFlagHidden>
      <ChapterFlagEnabled>1</ChapterFlagEnabled>
      <ChapterTimeStart>00:00:20.000000000</ChapterTimeStart>
      <ChapterTimeEnd>00:00:49.049000000</ChapterTimeEnd>
    </ChapterAtom>
  </EditionEntry>
</Chapters>

@mifi
Copy link
Owner

mifi commented Aug 7, 2024

tracking this problem in #1027 - closing this issue to keep count down

@mifi mifi closed this as not planned Won't fix, can't repro, duplicate, stale Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ffmpeg Problem resides in ffmpeg or usage of ffmpeg
Projects
None yet
Development

No branches or pull requests

2 participants