Skip to main content

Dataspike deepfake detection plugin for LiveKit Agents

Project description

Dataspike Deepfake Detection Plugin for LiveKit Agents

This plugin integrates Dataspike with LiveKit Agents to provide real-time deepfake detection. It enables detection of synthetic or manipulated media in both video and audio streams during live or recorded sessions.

Installation

pip install dataspike-livekit-plugins

Prerequisites

You’ll need a Dataspike API key. Set it as an environment variable before running your agent:

export DATASPIKE_API_KEY="your_api_key_here"

Usage Examples

Basic Video Detection

from livekit.plugins import dataspike
from livekit.agents import AgentSession, Agent

async def entrypoint(ctx):
    await ctx.connect()
    session = AgentSession(...)
    detector = dataspike.DataspikeDetector()
    await detector.start(session, room=ctx.room)
    await session.start(agent=Agent(instructions="Talk to me!"), room=ctx.room)

Video + Audio Detection

from livekit.plugins import dataspike
from livekit.agents import AgentSession, Agent

async def entrypoint(ctx):
    await ctx.connect()
    session = AgentSession(...)

    # Configure video processing
    video_params = dataspike.VideoParams(
        burst_fps=1,            # Video FPS during suspicious state
        normal_fps=0.2,         # Video FPS during normal state
        quality=75,             # JPEG quality (0-100)
    )

    # Configure audio processing
    audio_params = dataspike.AudioParams(
        sample_rate=16000,      # Required: 16kHz PCM
        sample_size=48000,      # 3 seconds of audio
        interval=60,            # Minimum 60 seconds between samples
    )

    detector = dataspike.DataspikeDetector(
        video_params=video_params,
        audio_params=audio_params,
    )

    await detector.start(session, room=ctx.room)
    await session.start(agent=Agent(instructions="Talk to me!"), room=ctx.room)

With Voice Activity Detection (VAD)

from livekit.plugins import dataspike, silero
from livekit.agents import AgentSession, Agent

async def entrypoint(ctx):
    await ctx.connect()
    session = AgentSession(...)

    # Setup VAD for speech detection
    vad = silero.VAD.load()
    vad_stream = vad.stream()

    # Setup detector with audio processing
    detector = dataspike.DataspikeDetector(
        audio_params=dataspike.AudioParams()
    )

    # Start detector with VAD integration
    # Audio will only be processed when user is speaking
    await detector.start(session, room=ctx.room, vad_stream=vad_stream)
    await session.start(agent=Agent(instructions="Talk to me!"), room=ctx.room)

Configuration

VideoParams

Configure video processing behavior:

  • burst_fps (float): Video sampling rate during suspicious state (default: 1)
  • normal_fps (float): Video sampling rate during normal state (default: 0.2)
  • quality (int): JPEG quality 0-100 (default: 75)

AudioParams

Configure audio processing behavior:

  • sample_rate (int): Target sample rate in Hz (default: 16000, required by Dataspike API)
  • sample_size (int): Number of samples per chunk (default: 48000 = 3 seconds at 16kHz)
  • interval (int): Minimum seconds between audio samples (default: 60)

DataspikeDetector

Main detector configuration:

  • api_key (str): Dataspike API key (or set DATASPIKE_API_KEY env var)
  • video_params (VideoParams): Video processing configuration (default: VideoParams())
  • audio_params (AudioParams): Enable audio detection (default: None, disabled)
  • notification_cb (callable): Custom callback for detection events

Features

  • Real-time video deepfake detection with adaptive frame rates
  • Real-time audio deepfake detection with automatic resampling to 16kHz PCM
  • VAD integration to process audio only during speech activity
  • Automatic reconnection with exponential backoff
  • Backpressure handling with bounded queues and frame dropping
  • Customizable notifications via callbacks or room data messages

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dataspike_livekit_plugins-1.2.17.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dataspike_livekit_plugins-1.2.17-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file dataspike_livekit_plugins-1.2.17.tar.gz.

File metadata

File hashes

Hashes for dataspike_livekit_plugins-1.2.17.tar.gz
Algorithm Hash digest
SHA256 8d2871bdcfd6a3d004bd1efe12987c25a704068838653b001421b4248d60cf72
MD5 26a20dd8ce941a05cfe2b6c4f4afedb5
BLAKE2b-256 80e337c1b41c5872c5a15fe2182ad682a0232b5a40378a8f8d29d043e4cd6cd3

See more details on using hashes here.

File details

Details for the file dataspike_livekit_plugins-1.2.17-py3-none-any.whl.

File metadata

File hashes

Hashes for dataspike_livekit_plugins-1.2.17-py3-none-any.whl
Algorithm Hash digest
SHA256 acf08ecab953435252362b217d1dd6c98715ad1c952a6ea36dbf9040c61baa4d
MD5 714983a2dcf6d75aacfe275c9cd07b88
BLAKE2b-256 62d944859c6acbd44097a94508a3ac9fbf061721747cde83be222c8f7f9920b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page