1

I am trying to use FFMPEG to capture a raspberry pi's screen/display and stream it to an RGB led matrix but cannot figure out how to capture the screen/display properly.

I am working with an example program (provided by Adafruit) that takes a video file as a parameter and streams it to the matrix and I'm trying to effectively swap out any mention of the video file with the screen/display. Here's the code

I tried to change line 141 as follows.

// Before
if(avformat_open_input(&pFormatCtx, movie_file, NULL, NULL)!=0)
    return -1; // Couldn't open file

// After
AVInputFormat *pAVInputFormat = NULL;
pAVInputFormat = av_find_input_format("x11grab");
if(avformat_open_input(&pFormatCtx,, ":0.0+10,250", pAVInputFormat, NULL))
    return -1; // Couldn't open file

But that didn't really seem to work.

Is there an easy way to make the program capture from the screen/display instead of a video file?

AdminBenni
  • 321
  • 2
  • 11
  • Do you have an x11 desktop up and running? (I often don't since some programs don't need it). Is `DISPLAY` set in your environment when you run the program? (it might not be if you are ssh-ing into the RPi). Maybe try [fbdev](https://ffmpeg.org/ffmpeg-devices.html#fbdev)? – jamieguinan Apr 17 '19 at 13:32

0 Answers0