Menu

#221 Workaround patch for bad chapter list formatting/chapters in custom templates and adding matroska to exif ignore list

Fixed
nobody
None
Medium
Patch
2024-02-15
2024-01-17
apsen
No

I'm submitting a patch for several items:
1. Workaround for standard template chapter listing where key/value separator is not the first colon by skipping all colons and digits at the beginning of line before starting to look for separator.
2. Workaround for inability to specify chapter listing in MediaInfo custom templates by copying the chapters from standard template.
3. Adding matroska to the ignore list of the exif formats.

Thanks!

1 Attachments

Discussion

  • apsen

    apsen - 2024-01-17

    This is for MediaInfo plugin

     
  • Anonymous

    Anonymous - 2024-01-17

    Can you provide output examples without/with patch for 1-2?

     
  • apsen

    apsen - 2024-01-17

    For the first item:

    Oringinal: In this case the hours are treated as key and the rest of the line as value

    ────────────────────────────────────────────────── Menu ──────────────────────────────────────────────────
     00                                : 00:00.000                             : en:Chapter 1
     00                                : 18:09.000                             : en:Chapter 2
     00                                : 33:27.000                             : en:Chapter 3
     00                                : 41:58.000                             : en:Chapter 4
     00                                : 52:01.000                             : en:Chapter 5
    ─────────────────────────────────────────────────── XMP ──────────────────────────────────────────────────
    

    New: The timestamp is kept together and the rest of the line becomes value

    ───────────────────────────────────── Menu ─────────────────────────────────────
     00:00:00.000                : en:Chapter 1                                     
     00:18:09.000                : en:Chapter 2                                     
     00:33:27.000                : en:Chapter 3                                     
     00:41:58.000                : en:Chapter 4                                     
     00:52:01.000                : en:Chapter 5                                     
    

    For the second item: MediaInfo has no way of specifiying the chapter list in a custom template - you could output a few of other values but nto the list. There's a bug that has been open since beginning of 2020
    (https://sourceforge.net/p/mediainfo/discussion/297610/thread/9182ad3d06/).

    In my workaround I append the menu section from standard output to the custom template output and the section will go through the same logic as in the first item and will look as above.

     

    Last edit: apsen 2024-01-17
  • Vladimir Surguchev

    3.15.16

     
  • Vladimir Surguchev

    • status: New --> Accepted
     
  • VictorVG

    VictorVG - 2024-01-17

    С варнингами на кодировку стоит возится?

    VC++ 2019 v16.11.29 build 16.11.33927.289
    
    Сборка успешно завершена.
    
    ".\Artem\MediaInfo\MediaInfo.vcxproj" (целевой объект Build ) (1)
     -> (Целевой объект ClCompile) ->
    
    .\Artem\common\vc_crt_fix_impl.cpp(1,1): warning C4828: Файл содержит знак,
    начинающийся со смещения 0x8e, который является недопустимым в текущей
    исходной кодировке (кодовая страница 65001). [.\Artem\MediaInfo\MediaInfo.vcxproj]
    
    .\Artem\MediaInfo\plugin.hpp(1,1): warning C4828: Файл содержит знак,
    начинающийся со смещения 0x95, который является недопустимым в текущей
    исходной кодировке (кодовая страница 65001). [.\Artem\MediaInfo\MediaInfo.vcxproj]
    
    .\Artem\MediaInfo\plugin.hpp(1,1): warning C4828: Файл содержит знак,
    начинающийся со смещения 0xb5, который является недопустимым в текущей
    исходной кодировке (кодовая страница 65001). [.\Artem\MediaInfo\MediaInfo.vcxproj]
    
    .\Artem\MediaInfo\plugin.hpp(1,1): warning C4828: Файл содержит знак,
    начинающийся со смещения 0x95, который является недопустимым в текущей
    исходной кодировке (кодовая страница 65001). [.\Artem\MediaInfo\MediaInfo.vcxproj]
    
    .\Artem\MediaInfo\plugin.hpp(1,1): warning C4828: Файл содержит знак,
    начинающийся со смещения 0xb5, который является недопустимым в текущей
    исходной кодировке (кодовая страница 65001). [.\Artem\MediaInfo\MediaInfo.vcxproj]
    
    .\Artem\MediaInfo\plugin.hpp(1,1): warning C4828: Файл содержит знак,
    начинающийся со смещения 0x95, который является недопустимым в текущей
    исходной кодировке (кодовая страница 65001). [.\Artem\MediaInfo\MediaInfo.vcxproj]
    
    .\Artem\MediaInfo\plugin.hpp(1,1): warning C4828: Файл содержит знак,
    начинающийся со смещения 0xb5, который является недопустимым в текущей
    исходной кодировке (кодовая страница 65001). [.\Artem\MediaInfo\MediaInfo.vcxproj]
    
    .\Artem\MediaInfo\plugin.hpp(1,1): warning C4828: Файл содержит знак,
    начинающийся со смещения 0x95, который является недопустимым в текущей
    исходной кодировке (кодовая страница 65001). [.\Artem\MediaInfo\MediaInfo.vcxproj]
    
    .\Artem\MediaInfo\plugin.hpp(1,1): warning C4828: Файл содержит знак,
    начинающийся со смещения 0xb5, который является недопустимым в текущей
    исходной кодировке (кодовая страница 65001). [.\Artem\MediaInfo\MediaInfo.vcxproj]
    
        Предупреждений: 9
        Ошибок: 0
    
    Прошло времени 00:01:51.85
    distrib --- MediaInfo x86
    distrib --- MediaInfo x64
    

    Я думаю, что можно в текстовм редакторе перекодировать в UTF-8 и варнинги должны уйти. Только нужно ли сейчас это делать или дождаться патча пункта 2) ?

     
  • Vladimir Surguchev

    Чего дожидаться? Весь патч уже применён.
    utf8(common) да, не закоммитил, пропустил.

     
  • Vladimir Surguchev

    Фаровские файлы (plugin.hpp) уже давно в utf8, реликт в вашей сборке ваша заслуга.

     
  • VictorVG

    VictorVG - 2024-01-18

    Ага, всё, у себя проверю.

    P.S.

    Личное - ещё бы нужные микросхемы пришли - с 13 декабря из Домодедово в Москву едут (~ 23 км по дороге:)) а то какие-то персонажи трубу оборвали "Продадим по 3500 - 5700 руб за штуку. Всё равно только у нас купите!" а там цена 57 руб за десяток с доставкой из Китая.:)

     
  • apsen

    apsen - 2024-01-18

    &+][+{}&]+){}]+{

    Turns out the MediaInfo configuration is a global singleton so the template settings need to be explicitly set to blank at the beginning to reset the settings from the previous call.

    Like this:

    if (get_mi_template(template_file))
    {
        mi.Option(L"Inform", L""); // <-- the fix
        _info_text = mi.Inform();
        size_t pos = _info_text.find(L"\r\nMenu\r\n");
        if (pos != std::string::npos)
            menu = _info_text.substr(pos);
        mi.Option(L"Inform", template_file.c_str());
    }
    
     

    Last edit: apsen 2024-01-18
  • Vladimir Surguchev

    I am personally not using teplate settings at all.
    So please try to explain what exactly problem you are going to fix in your patches.

     

    Last edit: Vladimir Surguchev 2024-01-18
  • apsen

    apsen - 2024-01-18

    My fix for the missing chapters was to pull the data twice. First time pull it with no template and extract chapter information from the returned value and second time pull it with a template.

    Turns out that the MediaInfo's settings persist across invocations. The option method is an object method and not a class one so I did not realize that when you create a new object it will inherit template setting from the previously created object. Since the templated output lacks chapter information the second and the subsequent invocations of the plug-in will not show chapter information.

    The fix is to explicitly reset the template back to blank at the beginning of the call.

    Thanks!

    PS I've only started using templates yesterday in an attempt to show more precise values for the duration of the videos and once on it I have tried to make the display more compact and that's when I have discovered the chapters issue in MediaInfo. And since there is not much hope for MediaInfo to fix it any time soon I have created this workaround. While at it I have also figured out how to correct issue with the chapters display and how to remove exif data for matroska videos.

    PPS If you would like to have a template for testing I could attach mine or there are some available on the internet.

     

    Last edit: apsen 2024-01-18
  • Vladimir Surguchev

    Fine. I'll apply your second patch this evening.
    Several templates for testing are a good idea for the future.
    I don't have enough time for mediaInfo yet.
    I'll rely on your own tests and reviews from other users.

     
  • Vladimir Surguchev

    3.15.17

     
  • apsen

    apsen - 2024-02-11

    Found a case where the latest menu workaround still does not work - multiple chapter lists.
    Currently the plugin detects chapters by looking for \r\nMenu\r\n but it becomes /\r\nMenu #\d+\r\n/ when there are multiple chapter lists.

    Locally, I have fixed that by changing to \r\nMenu and that works for me but in theory it could break unless the whole line is parsed.

     
  • Vladimir Surguchev

    Check my last commit. If ok it will be next version.

     

    Last edit: Vladimir Surguchev 2024-02-11
  • apsen

    apsen - 2024-02-11

    Yep! It works.

     
  • Vladimir Surguchev

    • status: Accepted --> Fixed
     

Anonymous
Anonymous

Add attachments
Cancel