Skip to content

Add audio-extension and video-extension #17636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Jun 17, 2025

References

Fixes #3860

Audio and video are taking a more significant part of AI workflows these days, for example for transcribing audio to text with tools like whisper.

Code changes

User-facing changes

Users can double click on a video or audio file to open it in JupyterLab.

Before

jupyterlab-no-audio-video.mp4

After

jupyterlab-audio-video.mp4

To generate test files with ffmpeg:

# Generate 5-second 440Hz sine wave
ffmpeg -f lavfi -i "sine=frequency=440:duration=5" -ac 1 test-audio.wav

# Generate 10-second color bars test video
ffmpeg -f lavfi -i "testsrc=duration=10:size=320x240:rate=30" test-video.mp4

Backwards-incompatible changes

None

Ideas for possible follow-ups

  • Add toolbars items to perform actions on the files: trim, edit...
  • Captions for videos via <track>
  • Waveform visualizer for audio files

@jtpio jtpio added this to the 4.5.0 milestone Jun 17, 2025
Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@jtpio
Copy link
Member Author

jtpio commented Jun 24, 2025

Currently the two extensions have a very similar structure and approach, but it probably still makes sense to keep them separate. So they can be disabled separately, but also later to be able to add more features specific to audio or video, such as the ones mentioned in the top comment:

  • Add toolbars items to perform actions on the files: trim, edit...
  • Captions for videos via <track>
  • Waveform visualizer for audio files

@jtpio jtpio requested a review from Copilot June 26, 2025 06:48
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds new audio and video viewer extensions to JupyterLab to support media file interactions directly in the UI. Key changes include:

  • Adding new packages for audio and video extensions with related source code, configuration, and styling.
  • Updating project configuration files (e.g., metapackage, labeler, dev_mode) and documentation to integrate the new extensions.
  • Enhancing the document registry to include new file types and their associated icons for audio and video.

Reviewed Changes

Copilot reviewed 29 out of 39 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/video-extension/* New video viewer implementation and supporting configuration (TypeDoc, tsconfig, styles, source code, package definition).
packages/audio-extension/* New audio viewer implementation and supporting configuration (TypeDoc, tsconfig, styles, source code, package definition).
packages/docregistry/src/registry.ts Updated file type registry to support new audio and video file types.
packages/metapackage/* Updated references to include the new audio and video extensions.
galata/test/documentation/* New tests for both audio and video file opening behaviors.
dev_mode/* and .github/labeler.yml Updated configuration files to include the new extensions.

@jtpio
Copy link
Member Author

jtpio commented Jun 26, 2025

OK I think the basic functionality should be in place. All CI is now all passing ✅

Marking as ready for review to encourage folks to try it, for example on Binder: https://mybinder.org/v2/gh/jtpio/jupyterlab/audio-video-extension?urlpath=lab

Maybe it's in a good enough so that it can be available in an early JupyterLab 4.5 alpha release, to end users can try it too. Happy to iterate more on it if some things need to be fixed until the JupyterLab 4.5 final release.

@jtpio jtpio marked this pull request as ready for review June 26, 2025 08:44
@krassowski
Copy link
Member

This works well with tabs, should it also work as output renderer?

from IPython.display import display
from IPython.core.formatters import DisplayFormatter

video_path = './big_buck_bunny.mp4'
with open(video_path, 'rb') as f:
    video_data = f.read()

mime_bundle = {'video/mp4': video_data}

# Display the MIME bundle
display(mime_bundle, raw=True)

@jtpio
Copy link
Member Author

jtpio commented Jun 26, 2025

Yes it would likely make sense to support this too. For large files the amount of data to transfer from the kernel can be quite big, but we can also imagine this being useful for smaller files.

@jtpio
Copy link
Member Author

jtpio commented Jun 27, 2025

Yes it would likely make sense to support this too. For large files the amount of data to transfer from the kernel can be quite big, but we can also imagine this being useful for smaller files.

I'll have a look next week. Unless folks are ok if we do that in a separate follow-up PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Understand audio and video formats the browser can handle
2 participants