Pyqt Multimedia logo

Pyqt Multimedia

Organization
CodeAtCode
pyqt-multimedia

Use when adding multimedia to PyQt/PySide6 apps - audio and video playback with QMediaPlayer, camera capture with QCamera and QMediaCaptureSession, audio/video recording with QMediaRecorder, GStreamer backend setup, or codec and platform compatibility issues

Overview

PublisherCodeAtCode
Repositoryoss-ai-skills
Skill namepyqt-multimedia
Stars
30
Forks
3
Bundled files
2
LicenseGPL-3.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by CodeAtCode on GitHub. Read the source before you install it.

Installation

Install the Pyqt Multimedia AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/CodeAtCode/oss-ai-skills/tree/master/frameworks/pyqt/multimedia
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/CodeAtCode/oss-ai-skills.git /tmp/oss-ai-skills
mkdir -p .claude/skills
cp -r /tmp/oss-ai-skills/frameworks/pyqt/multimedia .claude/skills/pyqt-multimedia
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Pyqt Multimedia in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Pyqt Multimedia on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Pyqt Multimedia is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Objective: Use this skill to reduce playback-deadlock incidents, GStreamer-backend startup failures, codec-missing black-screen bugs, and recording-corruption incidents by enforcing backend-setup discipline, codec-availability checks, and platform-compatibility decision patterns below.


Core Rules (do X because Y)

Check GStreamer plugins before playback because missing codecs produce silent black video

On Linux, Qt Multimedia uses GStreamer as the backend. Missing plugins cause video to render as black screens without errors.

bash
# Ubuntu/Debian - install ALL plugin groups before testing playback
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
    gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
    gstreamer1.0-libav

# Verify plugins are loaded
gst-inspect-1.0 | grep -E "h264|mp3|aac"

Failure mode: Video loads, QMediaPlayer reports "no error", but screen stays black. Solution: install missing plugin packages, not just Qt bindings.

Use QMediaCaptureSession not QMediaRecorder directly because the session owns the pipeline

QMediaCaptureSession coordinates camera, video output, image capture, and recorder. Bypassing it causes resource conflicts and recording corruption.

python
# ✅ Correct: session coordinates all components
self.capture_session = QMediaCaptureSession()
self.capture_session.setCamera(self.camera)
self.capture_session.setVideoOutput(self.video_widget)
self.capture_session.setRecorder(self.recorder)  # Session manages pipeline

# ❌ Wrong: recorder without session causes conflicts
self.recorder = QMediaRecorder()
# Missing session = pipeline ownership unclear, recording fails silently

Set output location before calling record() because unconfigured recorder corrupts files

QMediaRecorder requires output location to be set before recording starts. Skipping this produces 0-byte or corrupted files.

python
# ✅ Set location first, then record
self.recorder.setOutputLocation(QUrl.fromLocalFile(path))
self.recorder.record()

# ❌ Wrong order: recording starts with no destination
self.recorder.record()
self.recorder.setOutputLocation(QUrl.fromLocalFile(path))  # Too late

Check device availability before instantiating because unavailable devices crash on start

QCamera and QAudioInput fail when instantiated with invalid device references. Always enumerate devices first.

python
from PyQt6.QtMultimedia import QMediaDevices

# ✅ Check before use
cameras = QMediaDevices.videoInputs()
if not cameras:
    raise RuntimeError("No camera available - cannot start video")
self.camera = QCamera(cameras[0])

# ❌ Wrong: no check, crashes on camera.start()
self.camera = QCamera()  # Invalid device
self.camera.start()  # Silent failure or crash

Handle QMediaPlayer error signals because playback failures are silent without them

QMediaPlayer does not raise exceptions on playback errors. Without error signal handlers, users see nothing happen.

python
self.player.errorChanged.connect(self.handle_playback_error)

def handle_playback_error(self, error: QMediaPlayer.ErrorState):
    if error != QMediaPlayer.ErrorState.NoError:
        # Log or display the error - otherwise user sees nothing
        print(f"Playback failed: {self.player.errorString()}")

Audio Playback

Basic audio player with volume control:

python
from PyQt6.QtMultimedia import QMediaPlayer, QAudioOutput
from PyQt6.QtCore import QUrl

player = QMediaPlayer()
audio_output = QAudioOutput()
player.setAudioOutput(audio_output)
player.setSource(QUrl.fromLocalFile("audio.mp3"))
audio_output.setVolume(0.5)
player.play()

See references/media-pipeline.md for complete audio/video player with controls.


Video Playback

Video playback requires QVideoWidget for display. Black screen usually means missing GStreamer plugins (see Core Rules).

python
from PyQt6.QtMultimedia import QMediaPlayer, QAudioOutput
from PyQt6.QtMultimediaWidgets import QVideoWidget

player = QMediaPlayer()
video_widget = QVideoWidget()
player.setVideoOutput(video_widget)
player.setSource(QUrl.fromLocalFile("video.mp4"))
player.play()

See references/media-pipeline.md for complete player with position slider and time labels.


Camera Capture

Photo Capture

Use QMediaCaptureSession with QImageCapture for photo capture:

python
from PyQt6.QtMultimedia import QCamera, QMediaCaptureSession, QImageCapture
from PyQt6.QtMultimedia import QMediaDevices

cameras = QMediaDevices.videoInputs()
if not cameras:
    raise RuntimeError("No camera found")

camera = QCamera(cameras[0])
capture_session = QMediaCaptureSession()
capture_session.setCamera(camera)

image_capture = QImageCapture()
capture_session.setImageCapture(image_capture)

camera.start()
image_capture.captureToFile()

See references/media-pipeline.md for camera with device selection and photo preview.


Audio/Video Recording

Video Recording

Use QMediaRecorder attached to QMediaCaptureSession:

python
from PyQt6.QtMultimedia import QCamera, QMediaCaptureSession, QMediaRecorder

camera = QCamera()
capture_session = QMediaCaptureSession()
capture_session.setCamera(camera)

recorder = QMediaRecorder()
capture_session.setRecorder(recorder)

recorder.setOutputLocation(QUrl.fromLocalFile("output.mp4"))
recorder.record()

See references/media-pipeline.md for complete recorder with status handling and timestamps.

Audio Recording

For audio-only recording, attach QAudioInput to the session:

python
from PyQt6.QtMultimedia import QMediaRecorder, QMediaCaptureSession, QAudioInput

capture_session = QMediaCaptureSession()
audio_input = QAudioInput()
capture_session.setAudioInput(audio_input)

recorder = QMediaRecorder()
capture_session.setRecorder(recorder)
recorder.record()

GStreamer Backend (Linux)

Linux uses GStreamer. Install plugin packages before testing multimedia:

bash
# Core + bad + ugly plugins + libav for broad codec support
sudo apt-get install gstreamer1.0-plugins-good \
    gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
    gstreamer1.0-libav

# Verify GStreamer can find codecs
gst-inspect-1.0 h264parse
gst-inspect-1.0 mp3

Failure mode: QMediaPlayer loads video file but playback fails with no error. Cause: GStreamer missing codec plugins. Fix: install plugin packages above.


Common Issues

IssueCauseFix
Black video screenMissing GStreamer codec pluginsInstall gstreamer1.0-plugins-bad and gstreamer1.0-libav
Recording produces 0-byte fileOutput location not set before record()Call setOutputLocation() before record()
Camera.start() crashesCamera device unavailableCheck QMediaDevices.videoInputs() before instantiating QCamera
No audio outputWrong audio output device selectedCheck QMediaDevices.audioOutputs() and set explicitly
Playback fails silentlyError signal not connectedConnect to errorChanged signal and handle errors

Deep Dives

See reference files loaded on demand:

  • references/media-pipeline.md - Complete video player with controls, camera capture with session management, media recorder setup, error handling patterns
  • references/codecs-platforms.md - Platform-specific codec support tables, installation commands for Linux/Windows/macOS, format compatibility guides

References

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Pyqt Multimedia AI skill do?

Use when adding multimedia to PyQt/PySide6 apps - audio and video playback with QMediaPlayer, camera capture with QCamera and QMediaCaptureSession, audio/video recording with QMediaRecorder, GStreamer backend setup, or codec and platform compatibility issues

Why use Pyqt Multimedia on TypingMind?

Because you install it once and use it with any model. Pyqt Multimedia is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Pyqt Multimedia in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/CodeAtCode/oss-ai-skills/tree/master/frameworks/pyqt/multimedia. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Pyqt Multimedia?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Pyqt Multimedia?

As many as you like. As long as a model supports skills, you can use Pyqt Multimedia with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Pyqt Multimedia AI skill free?

Yes. It is published on GitHub by CodeAtCode under the GPL-3.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇