[FFmpeg-user] ffmpeg -f fbdev doesn't work with some fb drivers

Dan Flett dflett at bigpond.net.au
Thu Jul 11 15:13:14 CEST 2013


> -----Original Message-----
> Sent: Thursday, 11 July 2013 09:39
> To: 'FFmpeg user questions'
> Subject: Re: [FFmpeg-user] ffmpeg -f fbdev doesn't work with some fb
> drivers

> > Please add some printf's to get_pixfmt_from_fb_varinfo() in
> > libavdevice/fbdev.c to show the contents of varinfo.
> > (Although I fear a compressed format is used.)
> 
> Yes obviously there's some issue there too, but despite the error message,
> ffmpeg does work in that I do get an output (a BMP screenshot in this
case).
> 
> I will do as you suggest and report back.

OK, sorry, doing the printf's was a bit over my head I'm afraid.

What I did do is look at the output of "fbset" on my raspberry pi:

pi at raspberrypi ~ $ fbset -i

mode "1680x1050"
    geometry 1680 1050 1680 1050 16
    timings 0 0 0 0 0 0 0
    rgba 5/11,6/5,5/0,0/16
endmode

Frame buffer device information:
    Name        : BCM2708 FB
    Address     : 0x50006000
    Size        : 3528000
    Type        : PACKED PIXELS
    Visual      : TRUECOLOR
    XPanStep    : 0
    YPanStep    : 0
    YWrapStep   : 0
    LineLength  : 3360
    Accelerator : No

>From this I worked out the RGBA offsets and produced this patch for fbdev.c:

pi at raspberrypi ~/ffmpeg-dmo-1.2.1/libavdevice $ diff -u fbdev_orig.c fbdev.c
--- fbdev_orig.c        2013-07-11 12:28:28.554753775 +0000
+++ fbdev.c     2013-07-11 12:27:01.559807736 +0000
@@ -59,6 +59,7 @@
     {  32,       3,           2,           8,            0,
AV_PIX_FMT_ABGR  },
     {  24,       0,           8,          16,            0,
AV_PIX_FMT_RGB24 },
     {  24,      16,           8,           0,            0,
AV_PIX_FMT_BGR24 },
+    {  16,       11,          5,           0,            16,
AV_PIX_FMT_RGB565 }, // raspi
 };

 static enum AVPixelFormat get_pixfmt_from_fb_varinfo(struct
fb_var_screeninfo *varinfo)

This seems to work without error now:

pi at raspberrypi ~ $ /usr/local/bin/ffmpeg -y -f fbdev -r 30 -i /dev/fb0
-codec:v copy -frames 1000 -f rawvideo /dev/null
ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jul  9 2013 14:47:41 with gcc 4.6 (Debian 4.6.3-14+rpi1)
  configuration:
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
[fbdev @ 0x20a9440] w:1024 h:576 bpp:16 pixfmt:rgb565le fps:30/1
bit_rate:283115520
[fbdev @ 0x20a9440] Estimating duration from bitrate, this may be inaccurate
Input #0, fbdev, from '/dev/fb0':
  Duration: N/A, start: 1373547949.464476, bitrate: 283115 kb/s
    Stream #0:0: Video: rawvideo (RGB[16] / 0x10424752), rgb565le, 1024x576,
283115 kb/s, 30 tbr, 1000k tbn, 30 tbc
Output #0, rawvideo, to '/dev/null':
  Metadata:
    encoder         : Lavf54.63.104
    Stream #0:0: Video: rawvideo (RGB[16] / 0x10424752), rgb565le, 1024x576,
q=2-31, 283115 kb/s, 90k tbn, 30 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 1000 fps= 30 q=-1.0 Lsize= 1152000kB time=00:00:33.34
bitrate=283045.8kbits/s
video:1152000kB audio:0kB subtitle:0 global headers:0kB muxing overhead
0.000000%

With the framebuffer at 1680x1050 I was getting a capture rate of about
4.6fps to /dev/null on the Raspberry Pi.  Lowering the resolution to
1024x576 and capturing at 30fps works in real-time, with ffmpeg getting
about 85% CPU usage on the Raspberry Pi.  I'm hoping to pipe this into
gstreamer with their omxh264enc hardware encoding module, but at the moment
I don't think gstreamer handles rgb565le raw video very well.

Cheers,

Dan



More information about the ffmpeg-user mailing list