Skip to content
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

No impact of video configurations on headless browser Kubernetes cluster (linux). #156

Open
ArslanMehmoodTkxel opened this issue Apr 15, 2024 · 1 comment

Comments

@ArslanMehmoodTkxel
Copy link

ArslanMehmoodTkxel commented Apr 15, 2024

Despite attempting various resolutions, I've observed no improvement in the video quality. Upon using ffmpeg, I encountered the following logs:

frame=80 fps=0.7 q=0.0 size=1536kB time=00:02:07.31 bitrate=98.8kbits/s dup=0 drop=1165 speed=1.04x
These logs indicate that the generated video is of low quality.

My configurations are as follows:

const stream = await getStream(page, { 
    audio: true, 
    video: true,
    frameSize: 1000,
    bitsPerSecond: 5000000,
    videoConstraints: {
        mandatory: {
            minWidth: 1920,
            minHeight: 1080,
            maxWidth: 1920,
            maxHeight: 1080,
            minFrameRate: 25,
            maxFrameRate: 25,
        }
    }
});

I am launching chrome with these params

const browser = await launch({
      defaultViewport: {
        width: 1080,
        height: 1920,
      },
      args: [
        '--no-sandbox',
        '--window-size=1080,1920',
        '--disable-setuid-sandbox',
        '--start-fullscreen',
        `--headless=new`
      ],

      executablePath: executablePath(),
      timeout: THIRTY_MINUTES_DELAY,
      protocolTimeout: THIRTY_MINUTES_DELAY,
    });

Here is the configuration of ffmpeg

 
const ffmpeg = childProcess.spawn(
        ffmpegPath,
        [ '-y', '-i', '-', '-c:v', 'libx264', '-b:v', '500k', '-c:a', 'copy', file]
    );  

Any suggestions on how to enhance the video quality would be greatly appreciated.

image

Note: I have deployed on Kubernetes cluster the quality was better when i tested this on local machine.

@ArslanMehmoodTkxel ArslanMehmoodTkxel changed the title No impact of resolution on headless browser. No impact of video configurations on headless browser Kubernetes cluster. Apr 15, 2024
@ArslanMehmoodTkxel ArslanMehmoodTkxel changed the title No impact of video configurations on headless browser Kubernetes cluster. No impact of video configurations on headless browser Kubernetes cluster (linux). Apr 15, 2024
@hassanamin994
Copy link

hassanamin994 commented Jun 9, 2024

A bit late but try this

const stream = await getStream(page, {
frameSize: 1000,
videoBitsPerSecond: 7 * 1000 * 1000,
audioBitsPerSecond: 320 * 1000,
mimeType: 'video/webm;codecs=h264,opus',
audio: {
mandatory: {
sampleRate: 44100,
},
},
video: {
mandatory: {
minWidth: WIDTH,
minHeight: HEIGHT,
minFrameRate: 30,
maxWidth: WIDTH,
maxHeight: HEIGHT,
},
},
});

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

No branches or pull requests

2 participants