Page 1 of 1

omxplayer framebuffer

Posted: Tue Mar 29, 2016 7:55 am
by Alexandre34
Hello.
I need for a projet to make a screen snapshot of the HDMI output. So I use the framebuffer ( /dev/fb0 ) and make a picture from the pixel.
Unfortunatly, it seems that video played with omxplayer doesn't use framebuffer, because if I see the video on the screen, I don't see her in the picture.
Does somebody knows how to make a snapshoot of a screen including the omxplayer output ?

Bellow is the code I use to initialize the framebuffer:

Code: Select all

    /// initialise framebuffer
    int fbfd = 0;
    struct fb_var_screeninfo orig_vinfo;
    long int screensize = 0;


    // Open the file for reading and writing
    fbfd = open("/dev/fb0", O_RDWR);
    if (!fbfd)
    {
        printf("Error: cannot open framebuffer device.\n");
        return(1);
    }
    printf("The framebuffer device was opened successfully.\n");

    // Get variable screen information
    if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo))
    {
        printf("Error reading variable information.\n");
    }
    printf("Original %dx%d, %dbpp\n", vinfo.xres, vinfo.yres,
           vinfo.bits_per_pixel );

    // Store for reset (copy vinfo to vinfo_orig)
    memcpy(&orig_vinfo, &vinfo, sizeof(struct fb_var_screeninfo));

    // Get fixed screen information
    if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo))
    {
        printf("Error reading fixed information.\n");
    }

    // map fb to user mem
    screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
    fbp = (char*)mmap(0,
                      screensize,
                      PROT_READ | PROT_WRITE,
                      MAP_SHARED,
                      fbfd,
                      0);

    if ((int)fbp == -1)
    {
        printf("Failed to mmap.\n");
    }

Re: omxplayer framebuffer

Posted: Tue Mar 29, 2016 8:05 am
by DirkS
Have a look at https://github.com/AndrewFromMelbourne/raspi2png
I think it does what you are looking for

Re: omxplayer framebuffer

Posted: Thu Mar 31, 2016 11:06 am
by Alexandre34
Yes, exactly what I need..
Thank you.