Skip to content

Binding to AVChapter and chapters functions in Container class#1997

Merged
WyattBlue merged 5 commits intoPyAV-Org:mainfrom
DE-AI:main
Sep 1, 2025
Merged

Binding to AVChapter and chapters functions in Container class#1997
WyattBlue merged 5 commits intoPyAV-Org:mainfrom
DE-AI:main

Conversation

@DE-AI
Copy link
Contributor

@DE-AI DE-AI commented Aug 29, 2025

This PR adds c bindings to AVChapter struct and a method to list all chapters in a container.

Example usage:

import av
container = av.open("video_with_chapter_marks.mp4")
chapters = container.chapters()

for chapter in chapters:
    print(f"id: {chapter['id']}, start: {chapter['start']}, end: {chapter['end']}, time_base: {chapter['time_base']}, metadata: {chapter['metadata']}")

The output should look like:

id: 0, start: 0, end: 5001, time_base: 1/1000, metadata: {'title': 'I0001'}
id: 1, start: 5001, end: 10001, time_base: 1/1000, metadata: {'title': 'I0002'}
id: 2, start: 10001, end: 30000, time_base: 1/1000, metadata: {'title': 'I0003'}

…r class.

Call container.chapters() to receive a list of all chapters.
@WyattBlue WyattBlue added the needs tests This PR needs a test label Aug 29, 2025
@WyattBlue WyattBlue removed the needs tests This PR needs a test label Aug 31, 2025
@WyattBlue WyattBlue merged commit 5f33896 into PyAV-Org:main Sep 1, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants