Skip to content

feat: turn audio/video transcripts and slide media into tracks - #4752

Merged
vagenas merged 24 commits into
docling-project:mainfrom
DanielNg0729:fix/pptx-odp-embedded-media
Nov 20, 2026
Merged

vagenas merged 24 commits into
docling-project:mainfrom
DanielNg0729:fix/pptx-odp-embedded-media

Conversation

@DanielNg0729

Copy link
Copy Markdown
Member

Hi maintainers, this PR stops PPTX and ODP conversion from dropping slide video and audio, and adds an opt-in step that transcribes them with the existing audio and video pipelines.

Issue resolved by this Pull Request:
Resolves #4740

What changes

  1. Media is kept (bug fix, always on).
    • PPTX: python-pptx reads a video as a Movie, which is not a Picture, so the backend skipped it. A video now becomes a picture of its poster frame, with provenance on its slide. Audio was already a picture of the speaker icon.
    • Each video or audio picture records its media file in the picture meta, as docling__video or docling__audio. The value is the path inside the package for an embedded file (ppt/media/media1.mp4), or the link target for a linked file. In PPTX, the media element in p:nvPr (a:videoFile, a:quickTimeFile, a:audioFile, a:wavAudioFile) gives the kind, and the p14:media relationship, or else the one of the media element, gives the file.
    • ODP: the backend ignored the draw:plugin of a media frame, and only its preview came out. The preview picture now records the same field. A frame without a preview gets an empty picture. When LibreOffice declares its generic application/vnd.sun.star.media type, the manifest or the file extension gives the kind.
  2. Backends can load the media. The new DeclarativeDocumentBackend.load_media(location) returns the bytes of a recorded file. The default returns None. PPTX reads the package part, and ODP reads the archive. A linked file follows the ImageResourceLoader rules: a URL needs enable_remote_fetch, and a local file needs enable_local_fetch, a document given as a Path, and a place in the folder of the document or below it.
  3. Opt-in conversion in the pipeline. With the new ConvertPipelineOptions.do_media_conversion (default False), SimplePipeline sends each recorded file to AsrPipeline (audio) or VideoPipeline (video), with the Whisper model of media_asr_options. The result goes in a section group right after the picture: the transcript with its TrackSource timestamps and, for a video, the sampled frames. The items take the provenance (slide and box) and the content layer of the picture. A file that cannot be loaded or converted, also for a missing asr extra or ffmpeg, keeps its picture, is listed in ConversionResult.errors, and makes the result PARTIAL_SUCCESS. A linked file that the options do not allow is skipped with a warning.
  4. Docs. supported_formats.md, a new "Video and audio in slides" section in processing_audio_media.md, and the Python SDK reference of the usage skill.

Design note: the conversion is a pipeline step, not a backend feature, because docling.backend must not import docling.pipeline (Tach layers). As a pipeline step, the user sets it in the options they already pass, the media pipelines are built only when a document has media, and any declarative format that records docling__video / docling__audio can use it later.

Usage

from pathlib import Path

from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import ConvertPipelineOptions
from docling.document_converter import (
    DocumentConverter,
    OdpFormatOption,
    PowerpointFormatOption,
)

pipeline_options = ConvertPipelineOptions(do_media_conversion=True)
converter = DocumentConverter(
    format_options={
        InputFormat.PPTX: PowerpointFormatOption(pipeline_options=pipeline_options),
        InputFormat.ODP: OdpFormatOption(pipeline_options=pipeline_options),
    }
)
result = converter.convert(Path("slides.pptx"))
print(result.document.export_to_markdown())

Markdown of the first slide of my test deck (Whisper tiny):

Quarterly review

<!-- image -->

ppt/media/media1.mp4

<!-- image -->

Welcome to the Quarterly Review.

Revenue Group by 12% this quarter.

<!-- image -->

ppt/media/media2.mp3

 This is the audio note on the first slide.

 Please read the appendix.

Without do_media_conversion, only the picture and the path line are there.

Notes for reviewers. I am happy to change any of these:

  • The docling-core Markdown serializer prints custom meta fields as text, so the media path shows under the <!-- image --> line. I used a plain string for this reason, because a dict prints as a Python repr. A dedicated field in docling-core is another option.
  • The new options are on ConvertPipelineOptions, next to do_picture_description and do_chart_extraction. Only SimplePipeline reads them. Frames use the default VideoPipelineOptions, and only the Whisper model can be set.
  • There is no CLI flag yet.

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

A video shape (python-pptx Movie) was not a Picture, so the backend
skipped it and the video was absent from the document. An audio shape
came out as a plain picture of its speaker icon, with nothing to say
that it plays a file.

A video shape now becomes a picture of its poster frame, on its slide.
Video and audio pictures record the media file in a docling__video or
docling__audio meta field: the path inside the package for an embedded
file, or the link target for a linked file. The media element in
p:nvPr gives the kind; the p14:media extension or the media element
gives the relationship.

Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
The ODP backend skipped the draw:plugin of a media frame. Only its
draw:image preview came out, as a plain picture.

The preview picture now records the media file in the same
docling__video or docling__audio meta field as PPTX. A frame without a
preview gets an empty picture. When LibreOffice declares its generic
media type, the manifest or the file extension gives the kind.

Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
A pipeline needs the bytes of a media file to convert it. The new
DeclarativeDocumentBackend.load_media takes the value of a
docling__video or docling__audio field and returns the bytes. The
default returns None.

The PPTX backend reads an embedded file from its package part and the
ODP backend from its archive. A linked file goes through the
ImageResourceLoader rules: a URL needs enable_remote_fetch, and a local
file needs enable_local_fetch, a document read from a Path, and a place
in the folder of the document or below it.

Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
The new ConvertPipelineOptions.do_media_conversion (off by default)
makes the simple pipeline convert each recorded media file with the ASR
pipeline (audio) or the video pipeline (video), with the Whisper model
of media_asr_options. The result goes in a group right after the
picture: the transcript with its timestamps and, for a video, the
sampled frames. The items take the provenance and the content layer of
the picture.

A media file that cannot be loaded or converted, also for a missing
ASR extra, keeps its picture, is listed in the conversion errors, and
makes the result a partial success. A linked file that the backend
options do not allow is skipped with a warning.

Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ DCO Check Passed

Thanks @DanielNg0729, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 2 merge protections satisfied — ready to merge.

Show 2 satisfied protections

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

🟢 Require two reviewer for test updates

When test data is updated, we require two reviewers

  • #approved-reviews-by >= 2

@codecov

codecov Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Signed-off-by: Nguyen Hoang Duong <danielnguyenh07@gmail.com>
@github-actions github-actions Bot added ai:ci-needs-care AI triage: check CI-safety findings before you approve CI asr Issues related to ASR (Automatic Speech Recognition) enhancement New feature or request odf Issue related to the OpenDocument format (ODT, ODS, ODP) backend pptx issue related to pptx backend vtt issues related to the WebVTT backend labels Oct 12, 2026
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

AI triage (advisory)

Checked commit 2dfd4a47b6. The analysis read the diff only. It did not run code from this pull request.

The PR keeps video and audio on PPTX and ODP slides as tracks. It records each media file and adds opt-in keep_media and do_media_conversion options that transcribe the media. WebVTT and audio/video transcripts now also go in a track.

CI safety: needs maintainer care before you approve CI.

  • pyproject.toml: changes build, dependency, or tool configuration
  • tach.toml: changes CI test selection
  • uv.lock: changes locked dependencies
  • tests/test_simple_pipeline_media_asr.py: The test converts a deck with do_media_conversion=True and the default WHISPER_TINY model, so CI can download model files from the network.
1 related pull request(s) in the same code
PR State Signal Assessment
#4650 open changes the same code related: It changes opendocument_backend.py to attach comments to pictures. This PR adds media tracks in the same backend and touches the same picture helpers, but the two fix different problems.

Reference data changes

Change Files
structure 4
text 13
  • structure tests/data/webvtt/groundtruth/webvtt_example_01.vtt.json: reading order changed
  • structure tests/data/webvtt/groundtruth/webvtt_example_02.vtt.json: reading order changed
  • structure tests/data/webvtt/groundtruth/webvtt_example_03.vtt.json: reading order changed
  • structure tests/data/webvtt/groundtruth/webvtt_example_04.vtt.json: reading order changed
  • text tests/data/latex/groundtruth/1706.03762_main.tex.dclg: +1 / -1 lines
  • text tests/data/latex/groundtruth/2305.03393_main.tex.dclg: +1 / -1 lines
  • text tests/data/latex/groundtruth/2310.06825_main.tex.dclg: +1 / -1 lines
  • text tests/data/latex/groundtruth/2310.06825_main.tex.latex: +3 / -1 lines
  • text tests/data/latex/groundtruth/2412.19437_main.tex.dclg: +1 / -1 lines
  • text tests/data/latex/groundtruth/2501.00089_main.tex.dclg: +1 / -1 lines
  • text tests/data/latex/groundtruth/arXiv-2501.01300v2_main.tex.dclg: +1 / -1 lines
  • text tests/data/latex/groundtruth/example_01.tex.dclg: +1 / -1 lines
  • text tests/data/latex/groundtruth/example_02.tex.dclg: +1 / -1 lines
  • text tests/data/webvtt/groundtruth/webvtt_example_01.vtt.itxt: +14 / -13 lines
  • text tests/data/webvtt/groundtruth/webvtt_example_02.vtt.itxt: +12 / -11 lines
  • text tests/data/webvtt/groundtruth/webvtt_example_03.vtt.itxt: +18 / -17 lines
  • text tests/data/webvtt/groundtruth/webvtt_example_04.vtt.itxt: +14 / -13 lines

Assessment: unclear. The WebVTT reference changes match the backend change that puts cues in a track. The one-line changes in the LaTeX reference files have no cause in this PR's LaTeX-related code, and the diff does not show their content. The docling-core version bump may explain them.

The ai:* labels are advisory. They do not approve CI and they do not add tests:full. A new push runs this check again.

Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
@github-actions github-actions Bot added ai:ci-needs-care AI triage: check CI-safety findings before you approve CI and removed ai:ci-needs-care AI triage: check CI-safety findings before you approve CI labels Oct 12, 2026
@DanielNg0729
DanielNg0729 requested review from PeterStaar-IBM, ceberam and dolfim-ibm and removed request for PeterStaar-IBM and dolfim-ibm October 13, 2026 03:03
@PeterStaar-IBM

Copy link
Copy Markdown
Member

@DanielNg0729 I love this feature, but I need to understand a bit more how you want to construct it and in particular, I need to see how this will play with the new <track> capabilities that we have in doclang (see https://github.com/doclang-project/doclang/blob/main/spec.md#tracks).

I would love to see:

  1. we need to first support the serialization/deserialization from DoclingDocument into DocLang.
  2. we need to see where we add the media files (the audio/video) on the slides. Intuitively, I suppose this should be children of the slides

From the review of Steve-Allison:

- Older decks embed .wmv, .m4v, .mpg, .mpeg, .flv, .asf, .wma or
  .aiff. With LibreOffice's generic media type, the ODP backend did not
  record such a file. media_kind() now knows these containers.
- The video pipeline reads only some containers. A video in another one
  is recorded but not converted, with a warning, so the deck no longer
  becomes a partial success for a file that cannot be converted at all.
- A media part that several slides show is converted once; each slide
  gets its copy of the result.

A video without an audio track already converts to its frames without
an error; a test now covers it.

Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
@github-actions github-actions Bot added ai:ci-needs-care AI triage: check CI-safety findings before you approve CI and removed ai:ci-needs-care AI triage: check CI-safety findings before you approve CI labels Oct 29, 2026
Add the transcript items to one TrackItem instead of the body. With the new
keep_media option (--keep-media), reference the input file as the track's audio,
or video for a video file, so that e.g. a DocLang archive stores it. Only file
inputs are supported, and the CLI then keeps them in place.

Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
Like ASR, add the frames and transcript of a video, and the cues of a WebVTT file,
to one TrackItem. Frames become instants at their timestamp. The video pipeline
also takes keep_media (--keep-media), which references the input file as the
track's video.

Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
With the new --keep-source option, store the input file unchanged in the archive
written by --to dclx, with the file name and media type of the document's origin.
Only file inputs have a source to store. A source that is also the media of a
track (--keep-media) is stored once.

Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
…rge-main

Keep the video shapes of a slide next to the Office 2016 charts from main, and
record the media of a picture after main's new picture decoding.

Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
The audio and video pipelines now put their transcript in a track, so the media
group of a slide holds that track. Two tests of the slide transcription still
expect the transcript directly in the group; the move of slide media to tracks
replaces them.

Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
A video or audio object on a PPTX or ODP slide becomes a track, with its poster
frame or icon as the cover and a MediaRef to the media file, in place of a picture
with a docling__video or docling__audio meta field. With do_media_conversion, the
transcript and frames go in that track instead of a group after the picture. The
new keep_media option (also --keep-media) holds the media file in the track, so
that a DocLang archive stores it. Media in a container that a track cannot
reference yet, such as .wmv, stays a picture.

Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
@github-actions github-actions Bot added ai:ci-needs-care AI triage: check CI-safety findings before you approve CI and removed ai:ci-needs-care AI triage: check CI-safety findings before you approve CI labels Nov 20, 2026
…round truth

Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
@github-actions github-actions Bot added ai:ci-needs-care AI triage: check CI-safety findings before you approve CI and removed ai:ci-needs-care AI triage: check CI-safety findings before you approve CI labels Nov 20, 2026

@vagenas vagenas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DanielNg0729, approving, with these changes of mine on top:

  • Slide media as tracks: video and audio on PPTX and ODP slides become a TrackItem under the slide, with the poster frame or preview as cover and a MediaRef to the media, in place of a picture with docling__* metadata. With do_media_conversion, the transcript and video frames go into that track.
  • New options: keep_media holds the media in the track, so that a DCLX archive stores it. On the CLI, --keep-media and --convert-media (which uses the --asr-* options).
  • Audio, video and WebVTT conversions put their transcript in one track. --keep-media references the input as the track's recording, and --keep-source stores the input in the DCLX archive.
  • Fixes: standard media types for audio inputs (audio/mpeg etc.), and stripped segment text for native Whisper.
  • Up to date with main, and requires docling-core 2.108.0, which brings the tracks (docling-project/docling-core#940).

@Steve-Allison, on the points you raised: (1) the track always records where its media is (video / audio), also without transcription; a place for it in DocLang markup is raised in doclang-project/doclang#248; (2) older containers (.wmv, .mpg, .wma, ...) are tracks too; (3) silent videos give frames only and still succeed; (4) shared media is converted once.

@vagenas vagenas changed the title feat(pptx,odf): keep slide video and audio and record their media file feat: turn audio/video transcripts and slide media into tracks Nov 20, 2026

@PeterStaar-IBM PeterStaar-IBM left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonderful!

@vagenas
vagenas merged commit 5182e55 into docling-project:main Nov 20, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:ci-needs-care AI triage: check CI-safety findings before you approve CI asr Issues related to ASR (Automatic Speech Recognition) enhancement New feature or request odf Issue related to the OpenDocument format (ODT, ODS, ODP) backend pptx issue related to pptx backend vtt issues related to the WebVTT backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PPTX/ODP: embedded video and audio are not represented in the document

4 participants