ffmpeg -f fbdev doesn't work with some fb drivers
i have a computer with video card ATI Radeon 9200, i've installed linux-3.2.6 on it and the radeonfb module could be loaded successfully, i could use mplayer -vo fbdev to watch movies, it works really well. however, when i wanna grab something using ffmpeg -f fbdev -i /dev/fb0, ffmpeg just complains that the pixel format couldn't be recognized. i used the exactly the ffmpeg binary running on anther computer with intel 945gm integrated graphics card, and ffmpeg -f fbdev -i /dev/fb0 just worked fine. are there some limitations in ffmpeg with framebuffer device? anyway to solve that problem? thanks. PS: i downloaded ffmpeg source from git several days ago and its version is 0.11.1.git
On date Monday 2012-08-27 19:14:58 +0000, Xeslaro encoded:
i have a computer with video card ATI Radeon 9200, i've installed linux-3.2.6 on it and the radeonfb module could be loaded successfully, i could use mplayer -vo fbdev to watch movies, it works really well.
however, when i wanna grab something using ffmpeg -f fbdev -i /dev/fb0, ffmpeg just complains that the pixel format couldn't be recognized.
i used the exactly the ffmpeg binary running on anther computer with intel 945gm integrated graphics card, and ffmpeg -f fbdev -i /dev/fb0 just worked fine.
are there some limitations in ffmpeg with framebuffer device? anyway to solve that problem? thanks.
I implemented only the formats which I could test. Can you debug the device and test the information passed to get_pixfmt_from_fb_varinfo()? It should be rather easy to add an entry to the rgb_pixfmt_map array in fbdev.c.
PS: i downloaded ffmpeg source from git several days ago and its version is 0.11.1.git -- ffmpeg-user random tip #6 Please follow netiquette rules while posting to ffmpeg-user: http://linux.sgms-centre.com/misc/netiquette.php
-----Original Message----- From: ffmpeg-user-bounces@ffmpeg.org [mailto:ffmpeg-user- bounces@ffmpeg.org] On Behalf Of Stefano Sabatini Sent: Tuesday, 28 August 2012 01:56 To: FFmpeg user questions Subject: Re: [FFmpeg-user] ffmpeg -f fbdev doesn't work with some fb drivers
On date Monday 2012-08-27 19:14:58 +0000, Xeslaro encoded:
..snip
however, when i wanna grab something using ffmpeg -f fbdev -i /dev/fb0, ffmpeg just complains that the pixel format couldn't be recognized.
i used the exactly the ffmpeg binary running on anther computer with intel 945gm integrated graphics card, and ffmpeg -f fbdev -i /dev/fb0 just worked fine.
are there some limitations in ffmpeg with framebuffer device? anyway to solve that problem? thanks.
I implemented only the formats which I could test. Can you debug the device and test the information passed to get_pixfmt_from_fb_varinfo()? It should be rather easy to add an entry to the rgb_pixfmt_map array in fbdev.c.
Hi , I'm trying to use the fbdev format on the Raspberry Pi (Raspbian). When I try to to a screen grab or screencast I too get told "pixel format not supported". pi@raspberrypi ~/videos/test $ /usr/local/bin/ffmpeg -f fbdev -frames:v 1 -r 1 -i /dev/fb0 screenshot.jpeg 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 @ 0xeae430] Framebuffer pixel format not supported. /dev/fb0: Invalid argument But I've discovered that this does work: pi@raspberrypi ~/videos/test $ /usr/local/bin/ffmpeg -f rawvideo -codec:v rawvideo -s 1680x1050 -pix_fmt rgb565le -frames:v 1 -r 1 -i /dev/fb0 screenshot-ff01.bmp 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 [rawvideo @ 0x2a835d0] Estimating duration from bitrate, this may be inaccurate Input #0, rawvideo, from '/dev/fb0': Duration: N/A, start: 0.000000, bitrate: 28224 kb/s Stream #0:0: Video: rawvideo (RGB[16] / 0x10424752), rgb565le, 1680x1050, 28224 kb/s, 1 tbr, 1 tbn, 1 tbc Output #0, image2, to 'screenshot-ff01.bmp': Metadata: encoder : Lavf54.63.104 Stream #0:0: Video: bmp, rgb565le, 1680x1050, q=2-31, 200 kb/s, 90k tbn, 1 tbc Stream mapping: Stream #0:0 -> #0:0 (rawvideo -> bmp) Press [q] to stop, [?] for help [rawvideo @ 0x2a8c3a0] Invalid buffer size, packet size 20160 < expected length 3528000 Error while decoding stream #0:0: Invalid argument frame= 1 fps=0.4 q=0.0 Lsize=N/A time=00:00:01.00 bitrate=N/A video:3445kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.000624% So it looks like the Raspberry Pi uses pixel format rgb565le. But I can't use this to create a video stream (I want to pipe it into gstreamer and use the omxh264enc encoder). Can I help fix this? If so, you'll have to take me through the debug steps as I'm not much of a c coder at all. :) Cheers, Dan
Dan Flett <dflett <at> bigpond.net.au> writes:
But I've discovered that this does work:
$ /usr/local/bin/ffmpeg -f rawvideo -codec:v rawvideo -s 1680x1050 -pix_fmt rgb565le -frames:v 1 -r 1 -i /dev/fb0 screenshot-ff01.bmp
[rawvideo <at> 0x2a8c3a0] Invalid buffer size, packet size 20160 < expected length 3528000
This line indicates that it does not work. 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.) Carl Eugen
-----Original Message----- From: ffmpeg-user-bounces@ffmpeg.org [mailto:ffmpeg-user- bounces@ffmpeg.org] On Behalf Of Carl Eugen Hoyos Sent: Wednesday, 10 July 2013 22:06
But I've discovered that this does work:
$ /usr/local/bin/ffmpeg -f rawvideo -codec:v rawvideo -s 1680x1050 -pix_fmt rgb565le -frames:v 1 -r 1 -i /dev/fb0 screenshot-ff01.bmp
[rawvideo <at> 0x2a8c3a0] Invalid buffer size, packet size 20160 < expected length 3528000
This line indicates that it does not work. 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. Dan
-----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@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@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@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
Dan Flett <dflett <at> bigpond.net.au> writes:
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
Thank you for this hint! I wonder what the output here is trying to tell me: rgba 8/0,8/0,8/0,0/0
+ { 16, 11, 5, 0, 16, AV_PIX_FMT_RGB565 }, // raspi
Could you confirm that "AV_PIX_FMT_RGB565LE" works but "AV_PIX_FMT_RGB565BE" shows incorrect colours? Thank you, Carl Eugen
Carl Eugen Hoyos <cehoyos <at> ag.or.at> writes:
+ { 16, 11, 5, 0, 16, AV_PIX_FMT_RGB565 }, // raspi
Could you confirm that "AV_PIX_FMT_RGB565LE" works but "AV_PIX_FMT_RGB565BE" shows incorrect colours?
Never mind, this is not the necessary test. I will commit to my repo and ask Michael to merge. Thank you! Carl Eugen
Dan Flett <dflett <at> bigpond.net.au> writes:
+ { 16, 11, 5, 0, 16, AV_PIX_FMT_RGB565 }, // raspi
Your patch was merged, thank you for working on this! Carl Eugen
From: ffmpeg-user-bounces@ffmpeg.org [mailto:ffmpeg-user- bounces@ffmpeg.org] On Behalf Of Carl Eugen Hoyos Sent: Friday, 12 July 2013 06:14 Dan Flett <dflett <at> bigpond.net.au> writes:
+ { 16, 11, 5, 0, 16, AV_PIX_FMT_RGB565 }, // raspi
Your patch was merged, thank you for working on this!
My pleasure!
participants (4)
-
Carl Eugen Hoyos -
Dan Flett -
Stefano Sabatini -
Xeslaro