You need to enable JavaScript to run this app.
Lake AI Service

Lake AI Service

Copy page
Download PDF
Video processing
Remove audio tracks from video
Copy page
Download PDF
Remove audio tracks from video

Operator introduction

Description

Video audio track removal processor

Features

  • Removes audio tracks from video using ffmpeg subprocess
  • Preserves original video encoding and quality (no re-encoding required)
  • Automatically downloads remote files / uploads results
  • Supports timeout control
  • Supports multiple video formats

Daft invocation

Operator parameters

Input

Input column name

Note

input_col

Input video path array

output_col

Output video path array

Output

Output path array

Parameters

If a parameter does not have a default value, it is required

Parameter name

Type

Default value

Description

output_format

str or None

None

Output video format, such as "mp4", "avi", "mkv". If None, keep the original format. Default value: None

extra_params

list or None

None

Additional ffmpeg parameter list, such as ["-preset", "fast"]. Default value: None

timeout

int or None

None

ffmpeg execution timeout (seconds). Default is None (no timeout)

Examples

The following code demonstrates how to use Daft (for distributed scenarios) to run the operator to remove audio tracks from video.

from __future__ import annotations

import os

import daft
from daft import col
from daft.las.functions.udf import las_udf
from daft.las.functions.video import VideoRemoveAudio

if __name__ == "__main__":
    # After removing audio, the video will be saved to the specified TOS path. Therefore, you need to set environment variables to ensure write access to TOS, including: ACCESS_KEY, SECRET_KEY, TOS_ENDPOINT, TOS_REGION, TOS_TEST_DIR
    TOS_TEST_DIR_URL = os.getenv("TOS_TEST_DIR_URL", "las-cn-beijing-public-online.tos-cn-beijing.volces.com")
    TOS_TEST_DIR = os.getenv("TOS_TEST_DIR", "tos_bucket")

    if os.getenv("DAFT_RUNNER", "native") == "ray":
        import logging

        import ray

        def configure_logging():
            logging.basicConfig(
                level=logging.INFO,
                format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
                datefmt="%Y-%m-%d %H:%M:%S",
            )
            logging.getLogger("tracing.span").setLevel(logging.WARNING)
            logging.getLogger("daft_io.stats").setLevel(logging.WARNING)
            logging.getLogger("DaftStatisticsManager").setLevel(logging.WARNING)
            logging.getLogger("DaftFlotillaScheduler").setLevel(logging.WARNING)
            logging.getLogger("DaftFlotillaDispatcher").setLevel(logging.WARNING)

        ray.init(dashboard_host="0.0.0.0", runtime_env={"worker_process_setup_hook": configure_logging})
        daft.set_runner_ray()

    daft.set_execution_config(actor_udf_ready_timeout=600)
    daft.set_execution_config(min_cpu_per_task=0)

    samples = {
        "input_path": [f"https://{TOS_TEST_DIR_URL}/public/archive/video_remove_audio/music_sample.mp4"],
        "output_path": [f"tos://{TOS_TEST_DIR}/video_remove_audio/music_sample_no_audio.mp4"],
    }
    ds = daft.from_pydict(samples)

    # Using Daft to remove audio tracks from video
    constructor_kwargs = {
        "output_format": None,
        "extra_params": [],
    }

    ds = ds.with_column(
        "remove_audio_result",
        las_udf(VideoRemoveAudio, construct_args=constructor_kwargs)(col("input_path"), col("output_path")),
    )

    ds.show()
    # ╭────────────────────────────────┬────────────────────────────────┬────────────────────────────────╮
    # │ input_path                     ┆ output_path                    ┆ remove_audio_result            │
    # │ ---                            ┆ ---                            ┆ ---                            │
    # │ String                         ┆ String                         ┆ String                         │
    # ╞════════════════════════════════╪════════════════════════════════╪════════════════════════════════╡
    # │ https://las-public-data-qa.to… ┆ tos://tos_bucket/video_remove… ┆ tos://tos_bucket/video_remove… │
    # ╰────────────────────────────────┴────────────────────────────────┴────────────────────────────────╯
Last updated: 2026.05.12 19:06:36