You are not logged in.

#1 2013-10-18 16:26:29

hpstg
Member
Registered: 2007-06-09
Posts: 46

FFMPEG Streaming

Hello everybody.
I am using FFMPEG to stream StarCraft 2 to Twitch.tv, but it has stopped working correctly. I run StarCraft 2 on a separate Xserver (display 1), but when I start the ffmpeg streaming script, it will encode and show everything properly except the game. The game will show if I put it on Windowed mode with borders. With windowed borderless mode it just shows the cursor (moving etc), but nothing else. Any ideas?

My drivers are the Catalyst 13.11 beta, my GPU is the Radeon 7970.

The streaming script is this:

#!/bin/bash
KEY=live_20776618_WzlzenrmMJiMeSQdLKGHJ1Tz0SJWI6
TIMESTAMP=$(date "+%m-%d-%y @ %H%M") # My chosen timestamp for filename on my local copy
ffmpeg\
        -f x11grab -s 1920x1080 -r 30 -i :1\
        -f alsa -ac 2 -i pulse\
        -vcodec libx264 -preset ultrafast\
        -b:v 650k -b:a 64k\
        -pix_fmt yuv420p\
        -acodec libmp3lame -ar 44100 -ab 64k\
        -threads 0\
        -f flv - |\
                ffmpeg -i - \
                        -c copy -f flv rtmp://live.justin.tv/app/$KEY \
#                        -c copy -f mp4 "/media/Array/Video/footage/wow/WoW on `echo $TIMESTAMP`.mp4"

The script that I use to spawn the new xserver is this:

#!/bin/bash

# calculate first available VT
LVT=`fgconsole --next-available`

# calculate first usable display
XNUM="-1"
SOCK="something"
while [ ! -z "$SOCK" ]
do
XNUM=$(( $XNUM + 1 ))
SOCK=$(ls -A -1 /tmp/.X11-unix | grep "X$XNUM" )
done
NEWDISP=":$XNUM"

if [ ! -z "$*" ]
# generate exec line if arguments are given
then
# test if executable exists
 if [ ! -x "$(which $1 2> /dev/null)" ] 
then
echo "$1: No such executable!"
# if running from X, display zenity dialog:
[ -z "$DISPLAY" ] || zenity --error --text="$1: No such executable!" 2> /dev/null
exit 127
fi
# generate exec line
EXECL="$(which $1)"
shift 1
EXECL="$EXECL $*"
EXECPH=""

# prepare to start new X sessions if no arguments passed
else
EXECL=""
EXECPH="New X session"
fi

# if runing from X, display zenity dialog:
[ -z "$DISPLAY" ] || zenity --question --title "Launch?" --text="Will launch \"$EXECL$EXECPH\"

tty$LVT
X display $NEWDISP

Continue?" 2> /dev/null || exit 1

echo "Will launch \"$EXECL$EXECPH\" on tty$LVT, X display $NEWDISP..."
[ -z "$DISPLAY" ] && sleep 1s


# This flag is used for indication of unaccessible or broken DRI.
# It is set, for example, when using fglrx+compiz-manager.
# Some games will refuse to start if it is set.
# Unsetting it should not do any harm, and can be useful.
unset LIBGL_ALWAYS_INDIRECT

##########################################################
# main execution
xinit $EXECL -- $NEWDISP vt$LVT -nolisten tcp -br &
##########################################################

# set our new dislplay
DISPLAY=$NEWDISP
# wait some time for X to load
sleep 4s

# then we set useful parameters

# disable non-linear mouse acceleration
xset m 1 1

# disable hard-coded default 10m screensaver
xset s 0 0

# while X is running, persistently do something useful
# i.e. prevent apps from enabling mouse acceleration and screensaver
while xset -q > /dev/null
do 
xset m 1 0
xset s 0 0
sleep 3s
done


wait
sleep 5

I start the new xserver with xrun xterm.

Offline

Board footer

Powered by FluxBB