Remove All Ads from XDA
Honor 9 Lite

[TOOL][MOD][WIN][SHARE] Take Screenshots in Recovery & Aroma!

3,302 posts
Thanks Meter: 5,517
Post Reply Email Thread
[SIZE="4']Note : I'm just sharing the work of the XDA Member.Here's a little introduction by him :[/SIZE]

Originally Posted by makers_mark

This is a tool to capture screenshots while in Recovery or the Aroma Installer.

One big problem people are having when trying to capture screenshots in recovery is the extra framebuffer info that is tacked on to the end of each pixel row. Through a lot of digging and not finding too much information on it, I've finally found a way to determine what dimensions to use for, I believe, all android devices.

Fb2png is a great program, but unfortunately it only works with framebuffers that don't have a stride. FFmpeg is what I use here. That is a major problem with fb2png but it seems like it would be an easy thing to fix. The only thing to get it working, besides some random pixel formats maybe, is taking care of this stride.

I found that if you divide your width, for the nexus 7 2013 it's 1200, by 32, your stride will equal the value to add to 1200 to go up and make it evenly divisible by 32, that is your stride. Look at a bunch of resolutions and the width; the short side, think portrait mode; is usually evenly divisible by 32. Not all the time though, like the case of the Nexus 7 2013, Nexus 5 with 1080, and many more devices nowadays, AND those are the devices fb2png gives distorted screenshots with. Maybe @Phil3759 knows how to fix this for fb2png.

By the way the Nexus 5's stride is 8
1080/32 = 33 with a remainder of 24. 32-24 = 8

Anyways I made this batch script that takes into account your stride, if you have one. If your width is 768 for example, you won't have one because 32 goes into 768 an even 24 times.

Download the RS_all.rar file
Extract it to a new folder.
You will have the programs FFmpeg & ADB. Two .dll files for ADB. And the batch script RUNrs.bat
I assume you have your ADB drivers squared away.
Reboot into your recovery.
Run RUNrs.bat and it will ask you for you screen width in pixels, and your height. Input them.
It will then pull your framebuffer and make a bunch of viewable pngs with different pixel formats.
Don't close the program or anything, but go look in the folder you unzipped everything, and go through the images until you find one that is exactly like you screen, don't settle for close. Look at the filename of the one, and input that into the next prompt for your pixel format.

If I get any feedback I will change the first set of pixel formats to more common ones only, then some rarer ones if the first set didn't work.
Feel free to run 'ffmpeg -pix_fmts' and put in any of the other input-able pixel formats when you are asked to select which one you want to use.
Your set from there, all of that will be saved into settings.cfg.

If you change your recovery, you may have to clear the settings. You can do so easily in the program, or you can just delete settings.cfg
Same thing if you try a different device.

I am severely limited in devices to test. But I'd like to find a universal way with all android devices to pull the screen resolution from the phone/tablet and..
- add a check for the framebuffer in /dev/fb0 instead of just /dev/graphics/fb0. For now, if you get errors and it won't pull the framebuffer. Just change the code in the batch, two different places, from 'adb pull /dev/graphics/fb0 frmbfr' to 'adb pull /dev/fb0 frmbfr'

- make folders for screenshots to go into, and also a temp folder that gets deleted, for the pixel format test images.

- add the double frame buffer, two images. I have already done it, but am a little baffled as some devices seem to have six; or at least room for six raw fb0 NUL 2>&1
ADB pull /dev/graphics/fb0 frmbfr > nul
ECHO __________________________________________________ ____
ECHO Adb is not properly connected.
ECHO Try "Safely Removing" your device from your computer
ECHO Then unplug your usb cable, and reinsert it.
ECHO __________________________________________________ ____
ECHO Press any key to try again.
PAUSE >nul
REM ECHO The width of your framebuffer is %widthwithstride%
SET line=
ECHO %widthwithstride% > temp.tmp
FOR /F "delims=" %%A IN (temp.tmp) DO SET line=%%A
ECHO %width% > temp.tmp
FOR /F "delims=" %%A IN (temp.tmp) DO SET line=%line% %%A
ECHO %height% > temp.tmp
FOR /F "delims=" %%A IN (temp.tmp) DO SET line=%line% %%A
REM echo %width% %height% %stride% %widthwithstride%
REM echo %framebufferpixels% %bytespp%
REM echo %fb0size%
SET TS=%_%.png
FOR /D %%A IN (%pixfmt%) DO call FFMPEG %ffshowb% %ffdebug% -f rawvideo -vcodec rawvideo -pix_fmt %%A -s %widthwithstride%x%height% -i frmbfr -vframes 1 -vf crop=%width%:%height%:0:0 -y %%A%TS%
ECHO Check in the folder you ran this program in and there
ECHO should be several images. If any are a 'correct'
ECHO screenshot, make a note of what pixel format is in
ECHO the start of the filename.
ECHO Example: file that is correct color is rgb565.png
ECHO then you would enter 'rgb565'
SET /p pixfmt=Pixel format?
REM IF %pixfmt%=none GOTO SORRY
ECHO %pixfmt% > temp.tmp
FOR /F "delims=" %%A IN (temp.tmp) DO SET line=%line% %%A
ECHO %line% > settings.cfg
DEL frmbfr
DEL temp.tmp

ADB kill-server -d
SET width=""
SET height=""
SET widthwithstride=""
SET framebufferpixels=""
SET bytespp=""
SET fb0size=""

SET widthwithstride=%1
SET width=%2
SET height=%3
SET pixfmt=%4


Original Thread :
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes