Question

My problem is the following, I have a headless server (ubuntu desktop) runing a webbrowser, and I would like to be able to broadcast my "screen" via RTMP (to twitch for example).

I'm currently using the following script :

#! /bin/bash

INRES="640x480"         # input resolution
OUTRES="640x480"        # Output resolution
FPS="25"                # target FPS
QUAL="fast"             # FFMPEG preset

STREAM_KEY=$(cat ~/.twitch_key)

avconv \
    -f x11grab -s $INRES  -r "$FPS" -i :0.0 \
    -vcodec libx264 -s $OUTRES -preset $QUAL -b 768k -r "$FPS" \
    -f flv "rtmp://live.twitch.tv/app/$STREAM_KEY"

So far, using this script, I am able to broadcast my login screen but I can't seem to get any further. Am I doing something wrong ? Is there a better way to this ?

Was it helpful?

Solution

you need to add -pix_fmt yuv420p to the options. Without it x264 will encode x11grabs output using High 444. There are very few decoders that support High 444.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top