fireattack / chapter_converter

Convert between different video chapter file formats
MIT License
35 stars 5 forks source link

mediainfo format not available #11

Closed noraj closed 11 months ago

noraj commented 11 months ago
➜ chap -f mediainfo -o chapters.xml chapters.mediainfo
usage: chap [-h] [-f {simple,pot,ogm,tab,xml}] [--mp4-charset MP4_CHARSET] [--charset CHARSET] [-o OUTPUT] [-c] [filename]
chap: error: argument -f/--format: invalid choice: 'mediainfo' (choose from 'simple', 'pot', 'ogm', 'tab', 'xml')

mediainfo is available in the README but not in the tool.

fireattack commented 11 months ago

-f is for output format. "mediainfo" format is only supported for input which is automatically guessed.

fireattack commented 11 months ago

Can you provide the "chapters.mediainfo" file and what it looks like? Is it just a text file copied from media info?

Currently it must be only the part about the chapter, i.e. starts from "Menu" line.

noraj commented 11 months ago
➜ chap -f xml -o chapters.xml chapters.mediainfo
Write to file: chapters.xml
mkvmerge v79.0 ('Funeral Pyres') 64-bit
Error: Simple chapter parser: 'CHAPTER02=00:00:41:200' is not a CHAPTERxx=... line.
Error: Unknown mode 'temp.mks'.
Traceback (most recent call last):
  File "/usr/bin/chap", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/chapter_converter/chapter_converter.py", line 207, in main
    remove('temp.mks')
FileNotFoundError: [Errno 2] No such file or directory: 'temp.mks'

I crafted it by hand.

Menu
00:00:00.000                : fr:Introduction
00:00:41:200                : fr:"Moteur de recherche"
00:03:09.120                : fr:"Motivation du projet"
00:06:12.120                : fr:"Catégorie Outils et fonctionnalités des tableaux riches"
00:13:16.000                : fr:"Catégorie Ressources"
00:16:26.160                : fr:"Catégorie Plateformes de CTF"
00:17:15.220                : fr:"Catégorie Système d'exploitation"
00:19:06.040                : fr:"Les fonctionnalités"
00:25:51.120                : fr:"Récapitulatif contribution"
00:26:13.260                : fr:"Liens vers les autres projets Rawsec"
00:26:22.180                : fr:"Blog Rawsec"
00:26:29.160                : fr:"Write-up Factory"
00:26:46.000                : fr:"The Hacking Tool Trove (THTT)"
00:28:31.050                : fr:"Hacker site noraj"
00:29:26.040                : fr:"Les réseaux sociaux"
00:31:32.270                : fr:"raw.pm, l'index racine"
00:31:47.080                : fr:"Les alternatives"
00:38:08.030                : fr:Hacktoberfest
00:38:46.240                : fr:Conclusion

However if I export to OGM instead of XML it works.

➜ chap -f ogm -o chapters.ogm chapters.mediainfo
Write to file: chapters.ogm

It's not recognized by MKVToolNix GUI

image

While it should be supported

image

fireattack commented 11 months ago

This is caused by the typo in 00:00:41:200 (it should be 00:00:41.200).

noraj commented 11 months ago

This is caused by the typo in 00:00:41:200 (it should be 00:00:41.200).

Thanks, my bad.