Repository navigation
feat(pptx,odf): keep slide video and audio and record their media file - #4752
DanielNg0729 wants to merge 8 commits into
Conversation
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>
|
✅ DCO Check Passed Thanks @DanielNg0729, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Signed-off-by: Nguyen Hoang Duong <danielnguyenh07@gmail.com>
AI triage (advisory)Checked commit The PR adds video and audio support to the PPTX and ODP backends: each media object is kept as a picture with its file path in the picture meta. A new opt-in `do_media_conversion` pipeline option sends each media file through the ASR or video pipeline and places the result after its picture. CI safety: needs maintainer care before you approve CI.
3 related pull request(s) in the same code
The |
Signed-off-by: Daniel Nguyen <danielnguyenh07@gmail.com>
|
@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 I would love to see:
|
PeterStaar-IBM
left a comment
There was a problem hiding this comment.
see #4752 (comment)
let's first do the updates and release it in docling-core.
|
Thank you very much Dr @PeterStaar-IBM. I agree, docling-core first. I will put this PR on hold, and I will open the docling-core PR for
And one thing is that i saw is that the Thank you very much for the review! |
wonderful, please make sure @vagenas is involved in the entire process! cc: @dolfim-ibm @cau-git |
|
@DanielNg0729 as you correctly pointed out, first of all this depends on releasing the latest DocLang changes including |
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
Movie, which is not aPicture, 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.docling__videoordocling__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 inp:nvPr(a:videoFile,a:quickTimeFile,a:audioFile,a:wavAudioFile) gives the kind, and thep14:mediarelationship, or else the one of the media element, gives the file.draw:pluginof 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 genericapplication/vnd.sun.star.mediatype, the manifest or the file extension gives the kind.DeclarativeDocumentBackend.load_media(location)returns the bytes of a recorded file. The default returnsNone. PPTX reads the package part, and ODP reads the archive. A linked file follows theImageResourceLoaderrules: a URL needsenable_remote_fetch, and a local file needsenable_local_fetch, a document given as aPath, and a place in the folder of the document or below it.ConvertPipelineOptions.do_media_conversion(defaultFalse),SimplePipelinesends each recorded file toAsrPipeline(audio) orVideoPipeline(video), with the Whisper model ofmedia_asr_options. The result goes in asectiongroup right after the picture: the transcript with itsTrackSourcetimestamps 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 missingasrextra or ffmpeg, keeps its picture, is listed inConversionResult.errors, and makes the resultPARTIAL_SUCCESS. A linked file that the options do not allow is skipped with a warning.supported_formats.md, a new "Video and audio in slides" section inprocessing_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.backendmust not importdocling.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 recordsdocling__video/docling__audiocan use it later.Usage
Markdown of the first slide of my test deck (Whisper tiny):
Without
do_media_conversion, only the picture and the path line are there.Notes for reviewers. I am happy to change any of these:
<!-- 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.ConvertPipelineOptions, next todo_picture_descriptionanddo_chart_extraction. OnlySimplePipelinereads them. Frames use the defaultVideoPipelineOptions, and only the Whisper model can be set.Checklist: