Active Topics

 


Reply
Thread Tools
Posts: 68 | Thanked: 4 times | Joined on Feb 2010 @ Germany
#1
can someone give me a hint to convert a N900

"cat /dev/fb0 > screenshot.fb" to a screenshot.bmp? or png?

rewrite works: cat screenshot.fb > /dev/fb0

BUT:
ffmpeg does not work:
ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 800x480 -i fb-n900.raw -f image2 -vcodec png screenshot.png

fb2png does work on gta2 openmoko, but bot for n900...
I guess the problem is the 32 bit color?


thanks for help
schasch
 
Posts: 1,225 | Thanked: 1,905 times | Joined on Feb 2011 @ Quezon City, Philippines
#2
Originally Posted by schasch View Post
can someone give me a hint to convert a N900

"cat /dev/fb0 > screenshot.fb" to a screenshot.bmp? or png?

rewrite works: cat screenshot.fb > /dev/fb0

BUT:
ffmpeg does not work:
ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 800x480 -i fb-n900.raw -f image2 -vcodec png screenshot.png

fb2png does work on gta2 openmoko, but bot for n900...
I guess the problem is the 32 bit color?


thanks for help
schasch
The color is 24, not 32 bits.
__________________
N9 PR 1.3 Open Mode + kernel-plus for Harmattan
@kenweknot, working on Glacier for Nemo.
 
Posts: 68 | Thanked: 4 times | Joined on Feb 2010 @ Germany
#3
thanks Hurrian
24bit...

any idea how to convert?
 
Posts: 68 | Thanked: 4 times | Joined on Feb 2010 @ Germany
#4
http://www.cnx-software.com/2010/07/...er-screenshot/

gimp does not work too??

>Then open the screenshot as a raw file (Select File Type: Raw Image Data) in Gimp2, enter the width and height as well of the color arrangement, RGB, RGBA etc…
 
Posts: 68 | Thanked: 4 times | Joined on Feb 2010 @ Germany
#5
Hello, noone can give me a hint?

Nokia-N900-51-1:~# cat /dev/fb0 > /home/user/MyDocs/fb-n900-20120228.raw
Nokia-N900-51-1:~# cat /home/user/MyDocs/fb-n900-20120228.raw > /dev/fb0
...is wroking and brings the schot on the screen....

But how is the raw build inside?

FFMPEG:
-------------
user@ubuntu /screenshot-fb$ ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 800x480 -i fb-n900-20120228.raw -f image2 -vcodec png screenshot.png
FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1.3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --extra-version=4:0.5.1-1ubuntu1.3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 4. 0 / 0. 4. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Dec 21 2011 18:37:21, gcc: 4.4.3
Input #0, rawvideo, from 'fb-n900-20120228.raw':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0.0: Video: rawvideo, rgb565, 800x480, 25 tbr, 25 tbn, 25 tbc
Output #0, image2, to 'screenshot.png':
Stream #0.0: Video: png, rgb24, 800x480, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
av_interleaved_write_frame(): I/O error occurred
Usually that means that input file is truncated and/or corrupted.


...but like I wrote, rewrite in fb0 works, so not truncated/corrupted..


fb-n900-20120228.raw (=Screenshot from /dev/fb0)
screenshot.png (Screenshot-Result after ffmpeg the raw)
vnc.png (=Screenshot with VNC)

no ideas?

regards
schasch
Attached Images
  
Attached Files
File Type: zip fb-n900-20120228.raw.zip (51.2 KB, 621 views)
 
Posts: 1 | Thanked: 2 times | Joined on Mar 2012
#6
Try:
ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb32 -s 800x480 -i fb-n900.raw -f image2 -vcodec png screenshot.png

It worked for me.
 

The Following 2 Users Say Thank You to jlancaster For This Useful Post:
Posts: 88 | Thanked: 411 times | Joined on Mar 2010 @ southern Italy
#7
N900 framebuffer memory map it's a bit weird.

cat /dev/fb0 outputs 1966080 bytes, that is 480 scanlines * 4096 bytes.

Only the first 1600 bytes (800 pixels, 16 bits each) are relevant; the following bytes overflow on next scanlines (that is: only 800*480*2=768000 bytes are the actual display image; the remaining 1198080 bytes are wasted duplicates).

Also, the /dev/fb0 format is 5-6-5 (5 bits red, 6 bits green, 5 bits blue), but is packed as 5-5-6 in big-endian (that is: first byte is bbbbbrrr, second byte is rrgggggg: green is in the 6 less significant bits of the 16-bit pixel value, blue is in the 5 high significant bits of the 16-bit pixel).

The following Ruby program fills the screen by only writing on /dev/fb0 (note: any video-related event causing Xorg refresh will redraw screen areas).
Code:
#!/usr/bin/env ruby

def rgb565 r, g, b
  r >>= 3    # shift to skip unused bits
  g >>= 2
  b >>= 3
  [ (r<<6) | g | (b<<11) ].pack('n')  # build & pack to 16 bits
end

samples = [ rgb565(255,0,0), rgb565(0,255,0), rgb565(0,0,255),
            rgb565(50,0,0), rgb565(0,50,0), rgb565(0,0,50),
            rgb565(0,255,255), rgb565(255,255,0) ]

File.open("/dev/fb0", "w") do |fp|    # open framebuffer for write
  480.times do |sl|                   # for every scanline:
    fp.seek sl*4096                   # update framebuffer pointer
    samples.each do |color|           # eight color samples:
      100.times { fp.write color }    # 100 pixels wide column
    end
  end
end
 

The Following 3 Users Say Thank You to alfmar For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 08:05.