William Goodwin
William Goodwin

Reputation: 3

FFMPEG Screen Capture Issue

Sorry if this has been solved but I couldn't find it.

I'm trying to screen capture using ffmpeg and stream it to Twitch. I have both x11grab and libx264 enabled but when I give it the input for my monitor it keeps returning:

:0.0+0,0: Protocol not found

I confirmed that :0.0 is indeed my $DISPLAY variable, and even if I call that directly in my script with the same error. My script is as follows:

#!/bin/bash

# Stream Variables
STREAM_KEY="<not shown>"
INRES="1680x1050"
OUTRES="1024x768"
FPS="30"
BITRATE="1266k"
BUFFER="1266k"
AUDIO_BITRATE="160k"

ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -framerate $FRAMERATE -video_size $INRES \
   -i :0.0+0,0 -vcodec libx264 -preset veryfast -maxrate $BITRATE -bufsize $BUFFER \
   -vf "scale=$OUTRES, format=yuv420p" -g $(expr $FPS \* 2) -acodec libfdk_aac -b:a $AUDIO_BITRATE \
   -f flv rtmp://liva-jfk.twitch.tv/app/$STREAM_KEY

I'm on Debian Jessie(Testing) and ffmpeg and associated packages come from deb-multimedia. I'm curious if maybe someone here can see something I might have missed.

Sidenote: I know the same display is called in programs like ScreenStudio and they work, but aren't as flexible. I've tried using obs-studio for linux and it crashes with an illegal command when I start recording which makes me wonder if this is a system problem that might be the cause of that.

Upvotes: 0

Views: 2324

Answers (1)

aergistal
aergistal

Reputation: 31209

You're missing a - before video_size.

-f x11grab -framerate $FRAMERATE -video_size $INRES

Why 'protocol not found'?: Because it thinks the x11grab format applies to some input named video_size and it can't deduce the format of the actual input :0.0+0,0.

Update: $FRAMERATE is undefined. You meant to use $FPS. Now it thinks that the whole thing after -framerate is the value and you're in the same situation as above.

Upvotes: 1

Related Questions