{"id":16634474,"url":"https://github.com/fireattack/chapter_converter","last_synced_at":"2025-03-21T15:31:37.077Z","repository":{"id":95967941,"uuid":"139684640","full_name":"fireattack/chapter_converter","owner":"fireattack","description":"Convert between different video chapter file formats","archived":false,"fork":false,"pushed_at":"2023-10-02T08:20:29.000Z","size":143,"stargazers_count":38,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T02:44:26.557Z","etag":null,"topics":["chapter","video"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fireattack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-04T07:25:21.000Z","updated_at":"2025-02-27T03:41:17.000Z","dependencies_parsed_at":"2024-11-27T07:00:15.592Z","dependency_job_id":null,"html_url":"https://github.com/fireattack/chapter_converter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fireattack%2Fchapter_converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fireattack%2Fchapter_converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fireattack%2Fchapter_converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fireattack%2Fchapter_converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fireattack","download_url":"https://codeload.github.com/fireattack/chapter_converter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244822691,"owners_count":20516152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chapter","video"],"created_at":"2024-10-12T05:38:01.004Z","updated_at":"2025-03-21T15:31:35.452Z","avatar_url":"https://github.com/fireattack.png","language":"Python","readme":"[![PyPI Version](https://img.shields.io/pypi/v/chapter-converter.svg)](https://pypi.python.org/pypi/chapter-converter)\n\n# chapter_converter\nConvert between several different video chapter file formats with ease.\n\n## Features\n\n* Auto input format detection: including various chapter files and video files with chapters (`.mkv` and `.mp4`)\n* Auto input encoding detection\n* Can specify output format and filename\n* Clipboard support (input and output) for editing purposes\n\n## Prerequisites\n\n- [MKVToolNix](https://mkvtoolnix.download/) binaries `mkvextract` and `mkvmerge`. You can download it via\n  - Official website: https://mkvtoolnix.download/downloads.html\n  - Arch Linux `pacman -S mkvtoolnix-cli`\n  - Debian / Ubuntu `apt install mkvtoolnix`\n  - openSUSE / SLES `zypper in mkvtoolnix`\n\n## Install\n\n```\npip install -U chapter_converter\n```\nor from source:\n```\npip install -U git+https://github.com/fireattack/chapter_converter\n```\n\n### Distribution packages\n\n[![Packaging status](https://repology.org/badge/vertical-allrepos/chapter-converter.svg)](https://repology.org/project/chapter-converter/versions)\n\non ArchLinux:\n\n```\npikaur -S chapter_converter\n```\n\n## Usage\n\nCLI script is named `chap`. Or you can use `python -m chapter_converter`.\n\n```\nusage: chap [-h] [-f {simple,pot,ogm,tab,xml}] [--mp4-charset MP4_CHARSET] [--charset CHARSET] [-o OUTPUT] [-c] [--lang LANG] [--yes] [filename]\n\npositional arguments:\n  filename              input filename\n\noptions:\n  -h, --help            show this help message and exit\n  -f {simple,pot,ogm,tab,xml}, --format {simple,pot,ogm,tab,xml}\n                        output format (default: pot)\n  --mp4-charset MP4_CHARSET\n                        input chapter charset for mp4 file, since it can't be auto detected (default: utf-8)\n  --charset CHARSET     output file charset. XML output will always be utf-8-sig (default: utf-8-sig)\n  -o OUTPUT, --output OUTPUT\n                        output filename (default: original_filename.format[.txt])\n  -c, --clipboard       automatically process text in clipboard and save it back.\n  --lang LANG           manually set language tag for XML chapter.\n  --yes, -y             automatically overwrite existing file.\n```\n\nIf you prefer a single file than a package, you can just download `chapter_converter.py` in `chapter_converter/` and use it directly (`chapter_converter.py -h`).\n\nA simple GUI is also provided as-is by running `chapgui`. You need to install module `gooey` in `pip` manually to make it work. See [my comments](https://github.com/fireattack/chapter_converter/pull/4#issuecomment-1359129224) for some caveats.\n\nAs a Python module:\n\n```python\nfrom chapter_converter import chapter_converter\n\nchapter_converter.main('input.pbf', '-o', 'output.xml')\n```\n\n### Note\n\n* Output by default saved as UTF-8-BOM for max compatibility on Windows. You can change it by passing in `--charset` argument.\n* When `-c` is used, you can still pass in a file as input instead.\n* When `-c` is used, you can still pass in an output filename (using `-o` and/or `-f`) as output instead.\n\n## Supported formats\n\nSee also: example files in `examples/`.\n\n### MKV and MP4 video containers (inputs only)\n\nGuessed by suffix. Not idiot-proof, please only feed in file with chapters.\n\n### Simple format (`simple`)\n\nI made it up.\n\nFormat:\n* Each line: `{timestamp},{title}`\n\nExample:\n\n```\n0:17:02.148,Title1\n0:42:19.976,Title2\n0:58:10.114,Title3\n...\n```\n\n### Tab format (`tab`)\n\nSimilar to Simple, but separated by tab instead of comma.\n\nFormat:\n* Each line: `{timestamp}\t{title}`\n\nExample:\n\n```\n0:17:02.148\tTitle1\n0:42:19.976\tTitle2\n0:58:10.114\tTitle3\n...\n```\n\n### OGM format (`ogm`)\n\nCan be recognized by common video tools, such as [MKVToolNix](https://mkvtoolnix.download/).\n\nFormat:\n* Odd lines: `CHAPTER{i:02}={timestamp}`\n* Even lines: `CHAPTER{i:02}NAME={tilte}`\n\n`i` starts at 1.\n\nExample:\n\n```\nCHAPTER01=0:17:02.148\nCHAPTER01NAME=Title1\nCHAPTER02=0:42:19.976\nCHAPTER02NAME=Title2\nCHAPTER03=0:58:10.114\n...\n```\n\n### MediaInfo format (inputs only)\n\nThe way [MediaInfo](https://mediaarea.net/en/MediaInfo) presents chapter information in text form. Input only. Supports both with or without the \"Menu\" line.\n\nFormat:\n* Each line: `{timestamp}\\s+: ({two_letter_lang_code})?:{title}`\n\nExample:\n\n```\nMenu\n00:00:00.000                : en:Contours\n00:02:49.624                : en:From the Sea\n00:08:41.374                : en:Bread and Wine\n00:12:18.041                : en:Faceless\n...\n```\n\n### XML format (`xml`)\n\nXML chapter format defined by [Matroska specification](https://matroska.org/technical/specs/chapters/index.html).\n\n###  [PotPlayer](https://potplayer.daum.net/) Bookmark format (.pbf) (`pot`)\n\nA format PotPlayer uses for its bookmarks. If you put the file together with the video file (same name except extension, just like any external resources), it will be recognized by PotPlayer just like internal chapters - you can use \"H\" to view and select, and they will show up as markers on navigation bar too:\n\n![Pot Bookmark Example](https://raw.githubusercontent.com/fireattack/chapter_converter/master/img/pot.png)\n\nIt is not ideal, but it's the closest thing to \"external chapter file\" to my knowledge.\n\nFormat:\n\n* First line: `[Bookmark]`\n* Other lines: `{i}={timestamp_in_ms}*{title}*{some_optional_hash_for_pot_internal_usage}`\n\n`i` starts at 0.\n\nExample:\n\n```\n[Bookmark]\n0=1022148*Title1*\n1=2539976*Titile2*\n...\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffireattack%2Fchapter_converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffireattack%2Fchapter_converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffireattack%2Fchapter_converter/lists"}