Skip to content

Capturing audio from chromium in dockerized headless mode? #189

@princefishthrower

Description

@princefishthrower

First off, thanks for this library - it's been amazing to use!

I've finally dockerized my workflow and my .webms are being produced just fine - the video is high quality and looks fine - but there is no sound.

I realize this isn't a question directly related to the library, but I'm wondering how behind the scenes puppeteer-stream finds audio... does anyone have an example of a dockerized version that is able to correctly capture audio from a headless chromium? Currently I'm using FROM alpine:latest but I'm worried I may have to go full OS (ubuntu or similar) to get the audio working in a headless scenario. If it helps, my puppeteer browser call is like so:

const browser = await launch({
        dumpio: true,
        // macOS:
        // executablePath: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
        // linux (docker):
        executablePath: "/usr/bin/chromium-browser",
        headless: "new", // supports audio!
        // headless: false, // for debugging
        defaultViewport: { width: 1920, height: 1080 },
        args: [
            '--window-size=1920,1080',
            '--start-fullscreen',
            '--ozone-override-screen-size=1920,1080', // for linux
            '--no-sandbox', // to run as root on docker
            '--allow-file-access-from-files',
            '--enable-audio-service',
            '--mute-audio=false',
        ]
    });

I know audio capture works with headless because before I dockerized everything sound was working fine! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions