While I was pushing some files trough adb I thought it would be handy to have a script which automates it, a simple bat file in this case, can become very handy if you need to push some system apps for testing. It will show several reboot options afterwards and additionally it can flash a kernel to your device.
I know it's better to just upgrade my Quick Flasher tool, but this was written in 10 min so why not share and upgrade later
co credits:
- stepie22 (helped me in expanding it)
It requires adb in it's directory and the files you want to push as well.
Kernelflasher.bat:
Code:
@echo off
REM /*
REM * cd to the current directory
REM */
cd /d %~dp0
mode con:lines=30
REM /*
REM * Check if adb is available in the path variable, the default path or the current directory.
REM * Asks user if they want to download it if it is not found.
REM */
set found=
set quotedPath="%PATH:;="; "%"
set prog=adb.exe
for %%i in (%quotedPath%) do if exist %%i\%prog% set found=%%i
:adbdetected
REM /*
REM * Added incase usb isn't properly connected
REM */
title Universal Quick Flasher v1.04 - Waiting for device...
echo Waiting for device...
echo Please plugin android device with usb debugging enabled
adb wait-for-device
cls
adb root
adb remount
title Universal Quick Flasher v1.04
goto main
if not ""==%found% goto adbdetected
if exist adb.exe goto adbdetected
if exist "%programfiles%\Android\android-sdk\platform-tools\adb.exe" goto adbdetected
REM /*
REM * Added Windows 7 Default location for android-sdk
REM */
if exist "%USERPROFILE%\android-sdks\platform-tools\adb.exe" goto adbdetected
if exist "%USERPROFILE%\android-sdk\platform-tools\adb.exe" goto adbdetected
goto noadb
:main
cls
echo.
echo *************************************
echo * Universal Quick Flasher v1.04 *
echo * *
echo * By broodplank1337 *
echo * and *
echo * stepie22 *
echo * *
echo * All Filenames are CaseSensitive! *
echo *************************************
echo.
echo What do you want to flash?
echo.
echo [1] App (system app or regular app)
echo [2] Kernel
echo.
echo Optional
echo.
echo [3] Reboot
echo [4] Visit project page
echo.
echo [79] exit
echo.
echo.
set /p choice=:
if "%choice%"=="1" goto app
if "%choice%"=="2" goto kernel
if "%choice%"=="3" goto rmenu
if "%choice%"=="4" goto ppage
if "%choice%"=="79" goto exit
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%choice%'.
pause
goto main
:kernel
cls
echo.
echo Enter kernel name (zImage or boot.img)
set /p kername= Kernel name:
echo.
echo Enter kernel partition number
echo As in (/dev/block/mmcblk0p*) where * is your number
set /p kernum= Kernel Partition Number:
echo.
cls
:kernelck
REM /*
REM * Display for rewiew
REM */
echo.
echo Kernel name: %kername%
echo FLash to : /dev/block/mmcblk0p%kernum%
echo.
set /p valid=Correct (y or n):
if "%valid%"=="y" goto kernelcont
if "%valid%"=="Y" goto kernelcont
if "%valid%"=="n" goto kernel
if "%valid%"=="N" goto kernel
set msg=Incorrent option
goto kernelck
:kernelcont
if not exist %kername% (
set returnto=kernel
goto nofile
)
echo.
echo Flashing %kername% to /dev/block/mmcblk0p%kernum%
adb push %kername% /sdcard/%kername%
adb -d shell su -c "dd if=/sdcard/%kername% of=/dev/block/mmcblk0p%kernum%"
echo.
echo Done! Rebooting Device...
echo.
adb reboot
pause
goto goagain
:app
set /p name=APK Name:
cls
echo.
echo APK Name: %name%
echo APK Type:
echo.
echo [1] System App (/system/app)
echo [2] Framework App (/system/framework)
echo [3] Regular App (/data/system)
echo.
set /p type=:
if "%type%"=="1" goto sysapp
if "%type%"=="2" goto frameapp
if "%type%"=="3" goto normapp
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%type%'.
pause
cls
goto app
:sysapp
if not exist %name% (
set returnto=app
goto nofile
)
adb push %name% /system/app/%name%
adb -d shell chmod 644 /system/app/%name%
cls
echo.
echo Do you want to reboot your device (y/n)?
echo.
set /p choice=:
if "%choice%"=="n" goto goagain
if "%choice%"=="N" goto goagain
if "%choice%"=="y" goto rmenu
if "%choice%"=="Y" goto rmenu
echo ERROR, no option found for '%choice%'
pause
goto sysapp
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%reboot%'.
pause
cls
goto sysapp
:frameapp
if not exist %name% (
set returnto=app
goto nofile
)
adb push %name% /system/framework/%name%
adb -d shell chmod 644 /system/framework/%name%
cls
echo.
echo Do you want to reboot your device (y/n)?
echo.
set /p choice=:
if "%choice%"=="n" goto goagain
if "%choice%"=="N" goto goagain
if "%choice%"=="y" goto rmenu
if "%choice%"=="Y" goto rmenu
echo ERROR, no option found for '%choice%'
pause
goto frameapp
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%reboot%'.
pause
cls
goto frameapp
:normapp
if not exist %name% (
set returnto=app
goto nofile
)
adb install %name%
goto goagain
:rmenu
cls
echo.
echo [1] Shutdown
echo [2] Reboot Normaly
echo [3] Reboot fast
echo [4] Reboot into Recovery
echo [5] Reboot into Bootloader (Download Mode)
echo [9] Main Menu
echo [79] Exit
echo.
set /p rmenu=:
if "%rmenu%"=="1" goto shutdown
if "%rmenu%"=="2" goto reboot
if "%rmenu%"=="3" goto rebootf
if "%rmenu%"=="4" goto rebootr
if "%rmenu%"=="5" goto rebootdl
if "%rmenu%"=="9" goto main
if "%rmenu%"=="79" goto exit
echo.
echo No option found for '%rmenu%'
pause
goto rmenu
:ppage
start http://broodplank.net/?p=729
goto main
:shutdown
echo.
echo Shutting down device.
adb shell reboot -p
goto goagain
:reboot
echo.
echo Rebooting Device Completely.
adb reboot
echo Done!
goto goagain
:rebootf
echo.
echo Rebooting Device Fast (kill system_server)
adb -d shell su -c "busybox killall system_server"
echo Done!
goto goagain
:rebootr
echo.
echo Rebooting Device into Recovery.
adb reboot recovery
goto goagain
:rebootdl
echo.
echo Rebooting Device into Bootloader (Download Mode)
adb reboot bootloader
goto goagain
:nofile
cls
echo.
echo ********************************
echo * That file could not be found *
echo ********************************
echo.
echo Press enter to try again.
set /p nofile=
goto %returnto%
:noadb
cls
echo.
echo ************************
echo * ADB was not detected *
echo ************************
echo.
echo Download?? (y/n)
set /p choice=:
if "%choice%"=="n" goto exit
if "%choice%"=="N" goto exit
if "%choice%"=="y" goto dl
if "%choice%"=="Y" goto dl
echo ERROR, no option found for '%choice%'
pause
goto noadb
:dl
cls
echo.
echo ************************
echo * ADB was not detected *
echo ************************
echo.
echo Downloading adb.rar from broodplank.net...
echo Extract it in: %~dp0
start http://broodplank.net/files/ADB.rar
pause
goto exit
:goagain
cls
echo.
echo Press m to go to the Main Menu,
echo Press any other key to exit.
echo.
set /p goagain=:
if "%goagain%"=="m" goto main
if "%goagain%"=="M" goto main
:exit
echo.
echo.
echo Exiting...
pause
exit
Really useful one..thank u..
Sent from my GT-I9001 using Tapatalk 2
VERY VERY NICE SCRIPT! Omg you're a monster
Inviato dal mio GT-I9001 che di originale non ha più nulla con la CyanogenMod RC1 usando Tapatalk 2.
lontu said:
Really useful one..thank u..
Sent from my GT-I9001 using Tapatalk 2
Click to expand...
Click to collapse
You're welcome
umb3rts said:
VERY VERY NICE SCRIPT! Omg you're a monster
Inviato dal mio GT-I9001 che di originale non ha più nulla con la CyanogenMod RC1 usando Tapatalk 2.
Click to expand...
Click to collapse
Haha, I develop all the time (like 90% of the time that I spend on my computer) so I have a lot of things like these. I will keep producing more and more without question
Usefull as always..
The tools and roms are growing like trees here. I cant update the index on androidworld so fast :silly:
I wish I had enough free time to spend on developing, i have some ideas sometime... but not enough time to learn/write, altough i'm a native Linux user. brood, you are fantastic as always
Inviato dal mio GT-I9001 che di originale non ha più nulla con la CyanogenMod RC1 usando Tapatalk 2.
if i may give you an idea:
you could write an app which does basically this
Code:
:rebootf
echo.
echo Rebooting Device Fast (kill system_server)
adb -d shell su -c "busybox killall system_server"
echo Done!
exit
untill now i had to kill system_server using terminal emulator.
Hey Brood.
Could you make something like a bat to get quick to my adb.exe? I hate it to cd through all the directorys to get to it.
Example:
I want to go to cmd.exe then type "adb" then for example "adb devices" and adb should start? Is that possible?
P.S: As always i love your work. The script is really nice and wellmade with the logo and etc
mrjraider said:
Usefull as always..
The tools and roms are growing like trees here. I cant update the index on androidworld so fast :silly:
Click to expand...
Click to collapse
Thanks and yes it's growing very fast idd!
umb3rts said:
I wish I had enough free time to spend on developing, i have some ideas sometime... but not enough time to learn/write, altough i'm a native Linux user. brood, you are fantastic as always
Inviato dal mio GT-I9001 che di originale non ha più nulla con la CyanogenMod RC1 usando Tapatalk 2.
Click to expand...
Click to collapse
The key is to not spend your computer time on gaming but on developing hehe (works for me). but if you don't have enough time it will become hard
And you're welcome ^^
dr.wtf said:
if i may give you an idea:
you could write an app which does basically this
Code:
:rebootf
echo.
echo Rebooting Device Fast (kill system_server)
adb -d shell su -c "busybox killall system_server"
echo Done!
exit
untill now i had to kill system_server using terminal emulator.
Click to expand...
Click to collapse
Of course I can make that, I'm in linux right now so when i'm back in windows, I will make the app and send it to you.
XeLLaR* said:
Hey Brood.
Could you make something like a bat to get quick to my adb.exe? I hate it to cd through all the directorys to get to it.
Example:
I want to go to cmd.exe then type "adb" then for example "adb devices" and adb should start? Is that possible?
P.S: As always i love your work. The script is really nice and wellmade with the logo and etc
Click to expand...
Click to collapse
Yes that can be achieved by adding: "cd /d %~dp0" in the batch script, the command will automatically cd to it's directory.
And you need to enter "adb shell" to enter the adb shell , else it will close.
adb shell > normal shell usage
adb -d shell ".." > command here
And you're welcome btw
broodplank1337 said:
Yes that can be achieved by adding: "cd /d %~dp0" in the batch script, the command will automatically cd to it's directory.
And you need to enter "adb shell" to enter the adb shell , else it will close.
adb shell > normal shell usage
adb -d shell ".." > command here
And you're welcome btw
Click to expand...
Click to collapse
Thank you very much!! :good:
Hey Brood do you know a nice howto about building an app wich base is a batch file ? Or is ot not possible to buold an android app with batch commands ?
Sent from my GT-I9001 using xda app-developers app
Diablob555 said:
Hey Brood do you know a nice howto about building an app wich base is a batch file ? Or is ot not possible to buold an android app with batch commands ?
Sent from my GT-I9001 using xda app-developers app
Click to expand...
Click to collapse
i think that its impossible because DOS uses its own functions. means that batch commands are especially for windows.
Sent from my GT-I9001 using xda app-developers app
So I'll need java commands ?
Sent from my GT-I9001 using xda app-developers app
What, you haven't updated it here? I feel offended! Na, just joking.
To people who don't know what I'm talking about: http://broodplank.net/?p=729
Sent from my GT-I9001 using xda app-developers app
stepie22 said:
What, you haven't updated it here? I feel offended! Na, just joking.
To people who don't know what I'm talking about: http://broodplank.net/?p=729
Sent from my GT-I9001 using xda app-developers app
Click to expand...
Click to collapse
True, well it's my site so it's not very strange if it gets priority but it's good that you take a look at my site, it has more hidden stuff
v1.4
Code:
@echo off
REM /*
REM * cd to the current directory
REM */
cd /d %~dp0
mode con:lines=30
REM /*
REM * Check if adb is available in the path variable, the default path or the current directory.
REM * Asks user if they want to download it if it is not found.
REM */
set found=
set quotedPath="%PATH:;="; "%"
set prog=adb.exe
for %%i in (%quotedPath%) do if exist %%i\%prog% set found=%%i
:adbdetected
REM /*
REM * Added incase usb isn't properly connected
REM */
title Universal Quick Flasher v1.04 - Waiting for device...
echo Waiting for device...
echo Please plugin android device with usb debugging enabled
adb wait-for-device
cls
adb root
adb remount
title Universal Quick Flasher v1.04
goto main
if not ""==%found% goto adbdetected
if exist adb.exe goto adbdetected
if exist "%programfiles%\Android\android-sdk\platform-tools\adb.exe" goto adbdetected
REM /*
REM * Added Windows 7 Default location for android-sdk
REM */
if exist "%USERPROFILE%\android-sdks\platform-tools\adb.exe" goto adbdetected
if exist "%USERPROFILE%\android-sdk\platform-tools\adb.exe" goto adbdetected
goto noadb
:main
cls
echo.
echo *************************************
echo * Universal Quick Flasher v1.04 *
echo * *
echo * By broodplank1337 *
echo * and *
echo * stepie22 *
echo * *
echo * All Filenames are CaseSensitive! *
echo *************************************
echo.
echo What do you want to flash?
echo.
echo [1] App (system app or regular app)
echo [2] Kernel
echo.
echo Optional
echo.
echo [3] Reboot
echo [4] Visit project page
echo.
echo [79] exit
echo.
echo.
set /p choice=:
if "%choice%"=="1" goto app
if "%choice%"=="2" goto kernel
if "%choice%"=="3" goto rmenu
if "%choice%"=="4" goto ppage
if "%choice%"=="79" goto exit
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%choice%'.
pause
goto main
:kernel
cls
echo.
echo Enter kernel name (zImage or boot.img)
set /p kername= Kernel name:
echo.
echo Enter kernel partition number
echo As in (/dev/block/mmcblk0p*) where * is your number
set /p kernum= Kernel Partition Number:
echo.
cls
:kernelck
REM /*
REM * Display for rewiew
REM */
echo.
echo Kernel name: %kername%
echo FLash to : /dev/block/mmcblk0p%kernum%
echo.
set /p valid=Correct (y or n):
if "%valid%"=="y" goto kernelcont
if "%valid%"=="Y" goto kernelcont
if "%valid%"=="n" goto kernel
if "%valid%"=="N" goto kernel
set msg=Incorrent option
goto kernelck
:kernelcont
if not exist %kername% (
set returnto=kernel
goto nofile
)
echo.
echo Flashing %kername% to /dev/block/mmcblk0p%kernum%
adb push %kername% /sdcard/%kername%
adb -d shell su -c "dd if=/sdcard/%kername% of=/dev/block/mmcblk0p%kernum%"
echo.
echo Done! Rebooting Device...
echo.
adb reboot
pause
goto goagain
:app
set /p name=APK Name:
cls
echo.
echo APK Name: %name%
echo APK Type:
echo.
echo [1] System App (/system/app)
echo [2] Framework App (/system/framework)
echo [3] Regular App (/data/system)
echo.
set /p type=:
if "%type%"=="1" goto sysapp
if "%type%"=="2" goto frameapp
if "%type%"=="3" goto normapp
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%type%'.
pause
cls
goto app
:sysapp
if not exist %name% (
set returnto=app
goto nofile
)
adb push %name% /system/app/%name%
adb -d shell chmod 644 /system/app/%name%
cls
echo.
echo Do you want to reboot your device (y/n)?
echo.
set /p choice=:
if "%choice%"=="n" goto goagain
if "%choice%"=="N" goto goagain
if "%choice%"=="y" goto rmenu
if "%choice%"=="Y" goto rmenu
echo ERROR, no option found for '%choice%'
pause
goto sysapp
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%reboot%'.
pause
cls
goto sysapp
:frameapp
if not exist %name% (
set returnto=app
goto nofile
)
adb push %name% /system/framework/%name%
adb -d shell chmod 644 /system/framework/%name%
cls
echo.
echo Do you want to reboot your device (y/n)?
echo.
set /p choice=:
if "%choice%"=="n" goto goagain
if "%choice%"=="N" goto goagain
if "%choice%"=="y" goto rmenu
if "%choice%"=="Y" goto rmenu
echo ERROR, no option found for '%choice%'
pause
goto frameapp
REM /*
REM * Display error if no valid option was chosen
REM */
echo Error, no option found for '%reboot%'.
pause
cls
goto frameapp
:normapp
if not exist %name% (
set returnto=app
goto nofile
)
adb install %name%
goto goagain
:rmenu
cls
echo.
echo [1] Shutdown
echo [2] Reboot Normaly
echo [3] Reboot fast
echo [4] Reboot into Recovery
echo [5] Reboot into Bootloader (Download Mode)
echo [9] Main Menu
echo [79] Exit
echo.
set /p rmenu=:
if "%rmenu%"=="1" goto shutdown
if "%rmenu%"=="2" goto reboot
if "%rmenu%"=="3" goto rebootf
if "%rmenu%"=="4" goto rebootr
if "%rmenu%"=="5" goto rebootdl
if "%rmenu%"=="9" goto main
if "%rmenu%"=="79" goto exit
echo.
echo No option found for '%rmenu%'
pause
goto rmenu
:ppage
start http://broodplank.net/?p=729
goto main
:shutdown
echo.
echo Shutting down device.
adb shell reboot -p
goto goagain
:reboot
echo.
echo Rebooting Device Completely.
adb reboot
echo Done!
goto goagain
:rebootf
echo.
echo Rebooting Device Fast (kill system_server)
adb -d shell su -c "busybox killall system_server"
echo Done!
goto goagain
:rebootr
echo.
echo Rebooting Device into Recovery.
adb reboot recovery
goto goagain
:rebootdl
echo.
echo Rebooting Device into Bootloader (Download Mode)
adb reboot bootloader
goto goagain
:nofile
cls
echo.
echo ********************************
echo * That file could not be found *
echo ********************************
echo.
echo Press enter to try again.
set /p nofile=
goto %returnto%
:noadb
cls
echo.
echo ************************
echo * ADB was not detected *
echo ************************
echo.
echo Download?? (y/n)
set /p choice=:
if "%choice%"=="n" goto exit
if "%choice%"=="N" goto exit
if "%choice%"=="y" goto dl
if "%choice%"=="Y" goto dl
echo ERROR, no option found for '%choice%'
pause
goto noadb
:dl
cls
echo.
echo ************************
echo * ADB was not detected *
echo ************************
echo.
echo Downloading adb.rar from broodplank.net...
echo Extract it in: %~dp0
start http://broodplank.net/files/ADB.rar
pause
goto exit
:goagain
cls
echo.
echo Press m to go to the Main Menu,
echo Press any other key to exit.
echo.
set /p goagain=:
if "%goagain%"=="m" goto main
if "%goagain%"=="M" goto main
:exit
echo.
echo.
echo Exiting...
pause
exit
This is a tool to capture screenshots while in Recovery or the Aroma Installer.
Your Recovery MUST have ADB enabled or no matter what you do you'll NEVER pull a Screenshot
v1.5
Feb 9, 2014
-Total rewrite of structure and function
-Added check for framebuffer in /dev/fb0
-Added a manual mode where you don't have to have ADB connected as long as you have a file
-Added loops for every pixel format supported as input for FFmpeg
-Added folders for pngs to go into when they are rendered
-Added the option to convert both framebuffers into two seperate images; or grab the top or botom images
One big problem people are having when trying to capture screenshots in recovery, on some devices, 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 open source program, but unfortunately it only works with framebuffers that don't have a stride. FFmpeg is what I use here. FFmpeg is a great open source command line transcoder. It's pretty hefty and can do a vast amount of conversions (audio/video/codecs/images) all from the command line. They are two different beasts with, Fb2png made for the sole purpose of grabbing the framebuffer then converting it into a png file. While FFmpeg is more of a computer side program, and you tell it exactly what you want it to do.
Dealing with the framebuffer we are dealing with raw data. There is 0 extra information in this file, no line size, title, header, no nothing except a continuous write of pixel data. That's great for guessing the exact file size, and that's about it. But to get it to a view-able image, you have to specify where each line starts/stops, and convert the pixel format to whatever you want to use, your file-type.
I found that if you divide your width; the Nexus 5 for example is 1080; by 32, your stride will equal the value to add to that 1080 to go up and make it evenly divisible by 32. The next number up from 1080 that is evenly divisible by 32 is 1088, and those 8 extra pixels is your stride. Height is not as important, as far as what we are doing, simply because everything is read left to right, then advance down. Resolution being divisible by 32, or MOD 32 to graphics people, is becoming not as common on devices nowadays, AND those are the devices fb2png gives distorted screenshots with. Maybe @Phil3759 knows how to fix this for fb2png.
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.
You can also use manual mode and use any raw image you have saved.
Please read the instructions below.
Recovery Screenshot v1.5 batch script
Code:
@ECHO OFF
IF NOT EXIST ffmpeg.exe CALL :NOFILES
IF NOT EXIST adb.exe CALL :NOFILES
CLS
SETLOCAL
SET pixfmt=""
SET FINAME=frmbfr
:TOP
TITLE Recovery Screenshot v1.5 For all devices.
MODE CON:COLS=60 LINES=48
COLOR 0B
ADB kill-server -d >nul 2>&1
SET "ffshowb=-hide_banner"
SET "ffdebug=-loglevel fatal"
IF "%~1"=="-d" (
REM @ECHO ON
SET "ffdebug=-loglevel debug"
SET "ffshowb=%"
MODE CON:COLS=140 LINES=250
COLOR 07
ECHO ______________________________________________________
ECHO DEBUG INFO
ECHO ______________________________________________________
)
IF NOT EXIST "settings.cfg" GOTO CHECK
IF EXIST "settings.cfg" GOTO MAINMENU
:CHECK
CALL :DRAWHEAD
ECHO[
ECHO You don't have a configuration set up...
ECHO[
ECHO Please choose 1 or 2
ECHO[
ECHO 1 - Make a configurations setting
ECHO[
ECHO 2 - Manual Mode
ECHO[
CHOICE /C:12
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF %K%==1 GOTO SETTINGS
IF %K%==2 CALL :MANUALMODE
:MAINMENU
CALL :LOADCONFIG
ECHO[
ECHO Your Settings are....
ECHO Native Resolution %width%X%height%
ECHO Stride=%stride%
ECHO Pixel Format=%pixfmt%
ECHO Save Folder for screenshots is ^"%DATE:/=-%\^"
CALL :DRAWHEAD
ECHO Please choose one of the following...
ECHO[
ECHO 1 - Get the top framebuffer.
ECHO[
ECHO 2 - Get the bottom framebuffer.
ECHO[
ECHO 3 - Get both framebuffers.(2 images)
ECHO[
ECHO 4 - Reset your settings.
ECHO[
ECHO 5 - Manual Mode!
ECHO[
ECHO 6 - Exit
ECHO[
CHOICE /C:123456
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF ERRORLEVEL 3 SET K=3
IF ERRORLEVEL 4 SET K=4
IF ERRORLEVEL 5 SET K=5
IF ERRORLEVEL 6 SET K=6
IF %K%==1 (CALL :GETFBO
CALL :UPPERGET)
IF %K%==2 (CALL :GETFBO
CALL :LOWERGET)
IF %K%==3 (CALL :GETFBO
CALL :UPPERGET)
IF %K%==4 GOTO SETTINGS
IF %K%==5 GOTO MANUALMODE
IF %K%==6 GOTO FINISH
CLS
GOTO MAINMENU
:UPPERGET
CALL :SSNAMINGCONVENTION
SET stoy=" -s %widthwithstride%x%height% -i %FINAME% -vframes 1 -vf crop=%width%:%height%:0:0 -y %folderdate%\%TS%"
CALL :TRANSCODE %stoy%
ECHO[
ECHO SCREENSHOT SAVED AS %folderdate%\%TS%
IF %K%==3 GOTO :LOWER
DEL frmbfr
ECHO Press any key to continue to menu...
PAUSE >NUL & CLS
GOTO :EOF
:LOWERGET
CALL :SSNAMINGCONVENTION
:LOWER
SET /a "cheight=2 * height"
SET stoy=" -s %widthwithstride%x%cheight% -i %FINAME% -vframes 1 -vf crop=%width%:%height%:0:%height% -y %folderdate%\%TSL%"
CALL :TRANSCODE %stoy%
ECHO SCREENSHOT SAVED AS %folderdate%\%TSL%
DEL frmbfr
ECHO Press any key to continue to menu...
PAUSE>NUL & CLS
GOTO MAINMENU
:TRANSCODE
FFMPEG %ffdebug% %ffshowb% -f rawvideo -vcodec rawvideo -pix_fmt %pixfmt% %~1 || GOTO FFHELP "-loglevel debug -f rawvideo -vcodec rawvideo -pix_fmt %pixfmt% %stoy%
GOTO :EOF
:GETLOTSOFPNGS
FOR /D %%A IN (%pixfmt%) DO CALL FFMPEG %ffshowb% %ffdebug% -f rawvideo -vcodec rawvideo -pix_fmt %%A -s %widthwithstride%x%height% -i %FINAME% -vframes 1 -vf crop=%width%:%height%:0:0 -y Pixel_formats\%%A%TS% || GOTO FFHELP LOTSOFPPNGS
GOTO :EOF
:LOADCONFIG
FOR /F "tokens=1,2,3,4,5,6" %%A IN (settings.cfg) DO CALL :PROCESS %%A %%B %%C %%D %%E %%F || GOTO :SETTINGS
GOTO :EOF
:PROCESS
SET width=%1
SET height=%2
SET stride=%3
SET widthwithstride=%4
SET fb0size=%5
SET pixfmt=%6
GOTO :EOF
:SETTINGS
IF EXIST settings.cfg DEL settings.cfg
IF NOT EXIST Pixel_formats\ MKDIR Pixel_formats\
DEL Pixel_formats\*.png
CLS
CALL :DRAWHEAD
ECHO[
ECHO[
ECHO Settings
ECHO[
ECHO Enter your screen width...
ECHO[
SET /P width=Width?
ECHO[
ECHO Enter your screen height...
ECHO[
SET /P height=Height?
CALL :GETFBO
CALL :DOMATH
SET "pixfmt=rgb565,rgb565be,bgr24,rgb24,rgb32,argb,rgba,abgr,bgra,0rgb,rgb0,0bgr,bgr0,gbrp"
SET TS=%_%.png
ECHO[
ECHO[
ECHO Generating test images......
ECHO They will be in the folder 'Pixel_formats'
ECHO[
CALL :GETLOTSOFPNGS
ECHO[
ECHO[
ECHO Check the folder and make a note of the filename of the
ECHO correct screenshot.
ECHO[
ECHO Press any key to continue..
PAUSE >NUL
CLS
CALL :DRAWHEAD
ECHO[
ECHO Please select a menu number...
ECHO[
ECHO 1 - You see your image...
ECHO[
ECHO 2 - Don't see your image..use more formats..?
ECHO[
ECHO 3 - Enter Manual Mode to try your own settings.
ECHO[
ECHO 4 - Exit
ECHO[
CHOICE /C:1234
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF ERRORLEVEL 3 SET K=3
IF ERRORLEVEL 4 SET K=4
IF %K%==1 GOTO INPUTPFMT
IF %K%==2 (DEL Pixel_formats\*.png
ECHO[
CALL :1TO2BYTESPP
ECHO GETTING 1 ^& 2 BYTE/pp formats..
CALL :GETLOTSOFPNGS
ECHO[
CALL :3BYTESPP
ECHO .Getting 3 Byte/pp formats..
CALL :GETLOTSOFPNGS
ECHO[
CALL :4BYTESPP
ECHO ..Getting 4 Byte/pp formats..
CALL :GETLOTSOFPNGS
ECHO[
CALL :5BYTESPP
ECHO ...Getting 5 Byte/pp formats..
CALL :GETLOTSOFPNGS
ECHO[
CALL :6TO8BYTESPP
ECHO ....Getting 6 ^& 8 Byte/pp formats..
CALL :GETLOTSOFPNGS
ECHO[)
IF %K%==3 CALL :MANUALMODE
IF %K%==4 GOTO FINISH
CLS
CALL :DRAWHEAD
ECHO[
ECHO Please select a menu number...
ECHO[
ECHO 1 - You found your screenshot.
ECHO[
ECHO 2 - You didn't find your screenshot.
ECHO[
ECHO 3 - Enter Manual Mode to try your own settings.
ECHO[
ECHO 4 - Exit
ECHO[
CHOICE /C:1234
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF ERRORLEVEL 3 SET K=3
IF ERRORLEVEL 4 SET K=4
IF %K%==1 GOTO INPUTPFMT
IF %K%==2 CALL :HELP
IF %K%==3 GOTO MANUALMODE
IF %K%==4 GOTO FINISH
GOTO :EOF
:HELP
REN frmbfr Framebuffer.raw
REM MODE CON:COLS=80 LINES=68
ECHO[
ECHO[
ECHO[
ECHO[
ECHO If you don't have a valid/correct screenshot in your "Pixel_formats\ folder
ECHO something has happened. I would really appreciate it if you would upload it
ECHO so I could try and find the problem.
ECHO[
ECHO http://forum.xda-developers.com/showthread.php?t=2635736
ECHO[
ECHO There is absolutely no harm in doing this, because the only data stored in it
ECHO is pixel data, that is unless you had something private on your screen;
ECHO then you can keep your framebuffer!
ECHO[
ECHO I have named your framebuffer...'Framebuffer.raw' in
ECHO %~dp0
ECHO Thank You for trying!
ECHO[
ECHO Press any key to exit...
PAUSE >NUL
GOTO FINISH
:DRAWHEAD
ECHO[
ECHO _________________________________________________________-_-
ECHO[
ECHO Recovery Screenshot v1.5
ECHO[
ECHO ____________________________________________________________
ECHO[
ECHO Thanks to Whiskey103 for the idea!!
ECHO Written by makers_mark
ECHO[
ECHO ____________________________________________________________
GOTO :EOF
:INPUTPFMT
CLS
CALL :DRAWHEAD
ECHO[
ECHO Please enter the pixel format to use.
ECHO[
ECHO YOU MUST USE LOWERCASE LETTERS!
ECHO[
ECHO ____________________________________________________________
ECHO Example: If the filename of the image, that is correct, is
ECHO rgb565.png
ECHO Then you would enter 'rgb565'
ECHO ____________________________________________________________
ECHO[
ECHO[
SET /p pixfmt=Pixel format?
CALL :WRITETOFILE %width% %height% %stride% %widthwithstride% %fb0size% %pixfmt%
DEL frmbfr
CLS
GOTO MAINMENU
:SSNAMINGCONVENTION
SET folderdate=%DATE:/=-%
SET folderdate=%folderdate: =%
IF NOT EXIST "%folderdate%\" MKDIR "%folderdate%\"
SET TS=%TIME::=_%
SET TS=%TS:.=%
SET TS=%TS: =%
SET TSL=%TS%
SET TS=%TS%upper.png
SET TSL=%TSL%lower.png
GOTO :EOF
:DOMATH
SET /a "stride=width %% 32"
IF %stride% NEQ 0 SET /a "stride=32 - stride"
SET /a "widthwithstride=stride + width"
FOR /F "usebackq" %%A IN ('frmbfr') DO set fb0size=%%~zA
GOTO :EOF
:GETFBO
CLS
CALL :DRAWHEAD
ECHO[
ECHO[
ECHO Pulling Framebuffer from your device.....
ECHO[
ADB kill-server -d >NUL 2>&1
ADB pull /dev/graphics/fb0 frmbfr>NUL 2>&1 || ADB pull /dev/fb0 frmbfr>NUL 2>&1
IF ERRORLEVEL 1 (cls
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[
ECHO[
ECHO Press any key to try again.
ECHO[
ECHO[
PAUSE >nul
CLS
GOTO GETFBO)
GOTO :EOF
:WRITETOFILE
ECHO %~1 %~2 %~3 %~4 %~5 %~6 > settings.cfg
GOTO :EOF
:FFHELP
MODE CON:COLS=108 LINES=200
COLOR 07
FFMPEG %~1
echo WIDTH=%width%
echo HEIGHT%height%
ECHO STRIDE=%stride%
ECHO Pixel Format is %pixfmt%
echo S to Y=%stoy%
echo Width with stride=%widthwithstride%
ECHO K=%K%
ECHO FINAME=%FINAME%
echo[
echo %1
echo %~1
echo[
ECHO There was an error in ffmpeg.
PAUSE >NUL
GOTO FINISH
:MANUALMODE
IF NOT EXIST Manual_mode\ MKDIR Manual_mode\
CLS
ECHO[
ECHO _________________________________________________________-_-
ECHO MANUAL MODE!
ECHO[
CALL :DRAWHEAD
ECHO[
ECHO I DO NOT ACCOUNT FOR STRIDE IN THIS MODE!
ECHO[
ECHO YOUR WIDTH YOU INPUT WILL BE THE PIXEL THAT TELLS
ECHO FFMPEG TO GO TO THE NEXT LINE!
ECHO[
ECHO TIP: IF YOU ARE WORKING WITH A FRAMEBUFFER, DOUBLE YOUR
ECHO HEIGHT, TO GET THE DOUBLE FRAMEBUFFER.
ECHO[
SET /p width=Width?
ECHO[
SET /p height=Height?
ECHO[
SET "widthwithstride=width"
ECHO ENTER THE FILENAME OF THE RAW IMAGE YOU
ECHO WANT TO LOAD...
ECHO[
ECHO JUST PRESS ENTER TO USE ADB TO PULL FRAMEBUFFER
ECHO[
:NONEXIST
SET /p FINAME=Filename? || SET FINAME=usefb
IF %FINAME%==usefb CALL :GETFBO
IF %FINAME%==usefb (SET FINAME=frmbfr
GOTO MANUALMODEIN)
IF EXIST %FINAME% GOTO MANUALMODEIN
IF NOT EXIST %FINAME% (
ECHO FILE, %FINAME% DOESN'T EXIST.
GOTO NONEXIST)
:MANUALMODEIN
CLS
ECHO[
ECHO _________________________________________________________-_-
ECHO MANUAL MODE!
ECHO[
ECHO FILE= %FINAME%
IF %FINAME%==frmbfr ECHO ^^^^^^^^^^^^THAT IS YOUR DEVICES FRAMEBUFFER!
ECHO[
ECHO WIDTH= %width% HEIGHT= %height%
ECHO[
ECHO Please select the Pixel Formats to use.
ECHO I've grouped them in sets of Bytes Per Pixel
ECHO[
ECHO Please choose one of the following...
ECHO[
ECHO 1 - ALL FORMATS!
ECHO[
ECHO 2 - 2 Bpp
ECHO[
ECHO 3 - 3 Bpp
ECHO[
ECHO 4 - 4 Bpp
ECHO[
ECHO 5 - 5 Bpp
ECHO[
ECHO 6 - 6 ^& 8 Bpp
ECHO[
ECHO 7 - Start Manual mode over (new WxH and file)
ECHO[
ECHO 8 - Go to regular mode.
ECHO[
ECHO 9 - EXIT
CHOICE /C:123456789
IF ERRORLEVEL 1 SET K=1
IF ERRORLEVEL 2 SET K=2
IF ERRORLEVEL 3 SET K=3
IF ERRORLEVEL 4 SET K=4
IF ERRORLEVEL 5 SET K=5
IF ERRORLEVEL 6 SET K=6
IF ERRORLEVEL 7 SET K=7
IF ERRORLEVEL 8 SET K=8
IF ERRORLEVEL 9 SET K=9
IF %K%==1 (CALL :MMNAMINGCONVENTION
CALL :2BPP
CALL :3BPP
CALL :4BPP
CALL :5BPP
CALL :6BPP
ECHO[
ECHO DONE!
ECHO[
ECHO Press any key to continue..
PAUSE>NUL
GOTO MANUALMODEIN)
IF %K%==2 (CALL :MMNAMINGCONVENTION
CALL :2BPP
ECHO[
ECHO DONE!
ECHO[
ECHO Press any key to continue..
PAUSE >NUL
GOTO MANUALMODEIN)
IF %K%==3 (CALL :MMNAMINGCONVENTION
CALL :3BPP
ECHO[
ECHO DONE!
ECHO[
ECHO Press any key to continue..
PAUSE >NUL
GOTO MANUALMODEIN)
IF %K%==4 (CALL :MMNAMINGCONVENTION
CALL :4BPP
ECHO[
ECHO DONE!
ECHO[
ECHO Press any key to continue..
PAUSE >NUL
GOTO MANUALMODEIN)
IF %K%==5 (CALL :MMNAMINGCONVENTION
CALL :5BPP
ECHO[
ECHO DONE!
ECHO[
ECHO Press any key to continue..
PAUSE >NUL
GOTO MANUALMODEIN)
IF %K%==6 (CALL :MMNAMINGCONVENTION
CALL :6BPP
ECHO[
ECHO DONE!
ECHO[
ECHO Press any key to continue..
PAUSE >NUL
GOTO MANUALMODEIN)
IF %K%==7 (DEL frmbfr >NUL
GOTO MANUALMODE)
IF %K%==8 (DEL frmbfr >NUL 2>&1
GOTO TOP)
IF %K%==9 (DEL frmbfr >NUL 2>&1
GOTO FINISH)
GOTO MANUALMODEIN
:2BPP
ECHO[
ECHO CONVERTING 1 ^& 2 Byte/pp IMAGES!
ECHO[
CALL :MMNAMINGCONVENTION
CALL :1TO2BYTESPP
CALL :MAKEPNGSMM
ECHO IMAGES SAVED IN 'Manual_mode\' FOLDER
ECHO[
GOTO :EOF
:3BPP
ECHO[
ECHO ..CONVERTING 3 BYTE/PP IMAGES!
ECHO[
CALL :3BYTESPP
CALL :MAKEPNGSMM
ECHO IMAGES SAVED IN 'Manual_mode\' FOLDER
ECHO[
GOTO :EOF
:4BPP
ECHO[
ECHO ...CONVERTING 4 BYTE/PP IMAGES!
ECHO[
CALL :4BYTESPP
CALL :MAKEPNGSMM
ECHO IMAGES SAVED IN 'Manual_mode\' FOLDER
ECHO[
GOTO :EOF
:5BPP
ECHO[
ECHO ....CONVERTING 5 BYTE/PP IMAGES!
ECHO[
CALL :5BYTESPP
CALL :MAKEPNGSMM
ECHO IMAGES SAVED IN 'Manual_mode\' FOLDER
ECHO[
GOTO :EOF
:6BPP
ECHO[
ECHO ....CONVERTING 6 ^& 8 BYTE/PP IMAGES!
ECHO[
CALL :6TO8BYTESPP
CALL :MAKEPNGSMM
ECHO IMAGES SAVED IN 'Manual_mode\' FOLDER
ECHO[
GOTO :EOF
:MAKEPNGSMM
FOR /D %%A IN (%pixfmt%) DO CALL FFMPEG %ffshowb% %ffdebug% -f rawvideo -vcodec rawvideo -pix_fmt %%A -s %width%x%height% -i %FINAME% -vframes 1 -y Manual_mode\%%A_%width%X%height%_%TS% || GOTO FFHELP
GOTO :EOF
:1TO2BYTESPP
SET "pixfmt=yuv410p,gray,monow,monob,pal8,bgr8,bgr4_byte,rgb8,rgb555be,rgb555le,bgr555be,bgr555le,yuv420p10be,yuv420p10le,yuv420p9be,yuv420p9le,yuv420p,yuv411p,yuv420p,nv12,nv21,rgb444le,rgb444be,bgr444le,bgr444be,yuvj411p,yuyv422,yuv422p,yuvj422p,uyvy422,gray16be,gray16le,yuv440p,yuvj440p,rgb565be,rgb565le,bgr565be,bgr565le,gray8a"
GOTO :EOF
:3BYTESPP
SET "pixfmt=rgb24,bgr24,yuv444p,yuvj444p,yuva420p,yuv420p16le,yuv420p16be,yuv422p10be,yuv422p10le,yuv422p9be,yuv422p9le,yuva420p9be,yuva420p9le,gbrp,0rgb,rgb0,0bgr,bgr0,yuva422p,yuv420p12be,yuv420p12le,yuv420p14be,yuv420p14le,yuv422p12be,yuv422p12le"
GOTO :EOF
:4BYTESPP
SET "pixfmt=argb,rgba,abgr,bgra,yuv422p16le,yuv422p16be,yuv444p9be,yuv444p9le,yuv444p10be,yuv444p10le,gbrp9be,gbrp9le,gbrp10be,gbrp10le,gbrp9be,gbrp9le,gbrp10be,gbrp10le,yuva422p9be,yuva422p9le,yuva420p10be,yuva420p10le,yuva422p10be,yuva422p10le,yuva444p,yuv422p14be,yuv422p14le,gbrap"
GOTO :EOF
:5BYTESPP
SET "pixfmt=yuva444p9be,yuva444p9le,yuva444p10be,yuva444p10le,yuva420p16be,yuva420p16le,xyz12le,xyz12be,yuv444p12be,yuv444p12le,gbrp12be,gbrp12le"
GOTO :EOF
:6TO8BYTESPP
SET "pixfmt=rgb48be,rgb48le,yuv444p16le,yuv444p16be,bgr48be,bgr48le,gbrp16be,gbrp16le,yuva422p16be,yuva422p16le,yuv444p14be,yuv444p14le,gbrp14be,gbrp14le,yuva444p16be,yuva444p16le,rgba64be,rgba64le,gbrap16be,gbrap16le"
GOTO :EOF
:MMNAMINGCONVENTION
SET TS=%TIME::=_%
SET TS=%TS:.=%
SET TS=%TS: =%.png
GOTO :EOF
:FINISH
ADB kill-server -d >nul 2>&1
ENDLOCAL
EXIT
Instructions:
If you have already downloaded a previous version, you do not have to download everything again. The bat file is the only difference between any of the versions. You can copy the script up above for v1.5 and edit the one you already have in Notepad, or any other text editor; Paste the new version in there and save it. And thats it.
Download Recovery Screenshot v1.5
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 if you want to set up a configuration or go into manual mode.
If you have ADB good and ready to go, I would reccommend going ahead and setting up your configuration now.
Enter you native resolution, with width being the short side! Don't adjust for stride either. Your native resolution should be entered.
It will then pull the framebuffer, and convert it into several pngs with different pixel formats.
Go to the folder "Pixel_formats" and look through them and make note of the correct one, specifically the filename of the correct one.
If you see your image, then hit "1" to input the name of the pixel format (which is the name of the png that is right)
If you don't see your screenshot in that folder hit "2" and it will generate a bunch more from various pixel formats.
Look through those, it might take some time LOL, and see if you can skip over the cool looking ones until you see yours.
Hit 1 and go input it.
From there you are good to go. You'll see your configuration in the upper left corner of the main menu window, and it will be persistent when you close the program out. You have the option to grab both framebuffers with this version. You are probably wandering why there's two. Well android uses a double framebuffer. Have you ever noticed that sometimes when you got a screenshot before, it will be a previous screen on there? Android has one screen that is displayed, and another one adjacent to it (they are butted top to bottom) that is meant for drawing on (really quick I might add). The idea behind that (on a fast scale) is: When the device switches to a new frame, the device can render the next screen in a different buffer while the current screen stays displayed. And then pop up that screen when it is ready. If it didn't do that, and used just one framebuffer, then when you go to a different screen, the new screen would have to be processed and drawn over the old screen and just wouldn't look as good. When ANY little bit of information changes on you screen, yes even the minute number on the clock, it draws it quickly and swaps the two buffers. So now all of the sudden your main framebuffer is opposite what it was before. And the other one is the artboard.
Manual mode does not take into account stride. It is just a tool to convert any raw image into pngs, and at the same time figure out what pixel format something, like a splash screen, might be. You don't have to have ADB enabled to use it. You can use a file of you own, just place it in the main folder, and after you supply the width and height, input the file name. If you just press enter instead, it will pull you framebuffer, and you will need ADB for that.
In Manual mode you can select between different pixel formats grouped by Bytes per pixel (1&2 Byte/pp, 3Bpp, 4Bpp, 5Bpp, and 6&8 Byte/pp)
Or you can run them all. If you run into errors with FFmpeg in manual mode, try not to seek too far down with your height in the resolution selection. If you overshoot the expected filesize looking for data, FFmpeg will not convert it.
Notes:
If you change your recovery, you may have to clear the settings, it depends if there is a different pixel format. You can do so easily in the program, or you can just delete 'settings.cfg'
Sometimes your screenshot may seem disorganized or torn. This may happen when the very first screen is drawn, and also in between framebuffer swaps and writes. This is totally normal. This tool grabs your current framebuffer in its current state (in your devices memory). It can't automatically discern if the image is in fact what you see on your device in a given moment. If your screenshot is torn, you can:
Grab both framebuffers (option 3 in normal mode)
Quit hitting buttons to change the screen when you are pulling the framebuffer! lol
Wait for the framebuffer to swap with a clock change, or force it to change by going anywhere in the menu and then back to where you want to get your screenshot. A sub note on that: A button highlighting, and then a screen change will result in two swaps of the framebuffer and your next image will be on the same side of the framebuffer. If your screen was on the top and you hit a button (that highlights), then the next screen will also be on top. If there is no button highlight, hence just a draw of the next screen and a swap: The next screen will be on the opposite side. Same goes for any other change to your device screen, such as a clock digit changing. What was up now is down, and vice versa.
Aroma only uses the top framebuffer. It never calls for a swap, and the bottom framebuffer will stay whatever was last on it.
I do need to thank @Whiskey103 for his work over here. And I promise this is the last time I'll mention you, lol :good:
Changelog:
v1.5
Feb 9, 2014
-Total rewrite of structure and function
-Added check for framebuffer in /dev/fb0
-Added a manual mode where you don't have to have ADB connected as long as you have a file
-Added loops for every pixel format supported as input for FFmpeg
-Added folders for pngs to go into when they are rendered
-Added the option to convert both framebuffers into two seperate images; or grab the top or botom images
v1.1
Feb. 5, 2014
- Fixed algorithm for calculating stride on devices that don't have one.
Thanks for this... helped me to figure out what was wrong with my ffmpeg options that couldn't take good screenshot.
nijel8 said:
Thanks for this... helped me to figure out what was wrong with my ffmpeg options that couldn't take good screenshot.
Click to expand...
Click to collapse
You're welcome. I'm glad you could decipher my babble. I'm going to rewrite it tomorrow to make it a little clearer.
makers_mark said:
You're welcome. I'm glad you could decipher my babble. I'm going to rewrite it tomorrow to make it a little clearer.
Click to expand...
Click to collapse
Wasn't hard at all if you know what to look for...
I was missing the crop option and didn't know about this stride thing also. Was getting images like broken analog TV lol. Now all is good thanks to you. Here is my vbs code I am using for screenshots with my device in return:
Code:
Dim number', file
number = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Do
If (objFSO.FileExists("" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\recovery_" & number & ".png" & "")) Then
number = number +1
' Wscript.Echo number
End If
If (objFSO.FileExists("" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\recovery_" & number & ".png" & "")) Then
Else
Set objShell = WScript.CreateObject("WScript.Shell")
Return = objShell.Run ("adb pull /dev/graphics/fb0", 1, true)
objShell.Run ("""" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\ffmpeg.exe" & """" & " -vcodec rawvideo -f rawvideo -pix_fmt rgb0 -s 1088x1920 -i " & """" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\fb0" & """" & " -vf crop=1080:1920:0:0 -y " & """" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\recovery_" & "" & number & ".png""")
objShell.Run ("adb kill-server")
End If
Loop While (objFSO.FileExists("" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\recovery_" & number & ".png" & ""))
WScript.Sleep(1000)
If (objFSO.FileExists("" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\fb0" & "")) Then
objFSO.DeleteFile("" & objFSO.GetParentFolderName(wscript.ScriptFullName) & "\fb0" & "")
End If
nijel8 said:
Wasn't hard at all if you know what to look for...
I was missing the crop option and didn't know about this stride thing also. Was getting images like broken analog TV lol. Now all is good thanks to you. Here is my vbs code I am using for screenshots with my device in return:
Click to expand...
Click to collapse
Looks good! Don't know if you have an ulterior motive for making your own numbered files, but just so you know in the future, ffmpeg has a built in numbering feature. %03d.png as the filename would give you 001.png, 002.png... %02d.png would give you 01.png, 02.png... and so on. Here is a link, and sorry if you already knew that. Scroll down to 3.7.
makers_mark said:
Looks good! Don't know if you have an ulterior motive for making your own numbered files, but just so you know in the future, ffmpeg has a built in numbering feature. %03d.png as the filename would give you 001.png, 002.png... %02d.png would give you 01.png, 02.png... and so on. Here is a link, and sorry if you already knew that. Scroll down to 3.7.
Click to expand...
Click to collapse
didn't know that either... thanks for the tip.
EDIT:Looks like I need my numbering code, I can't find a way to continue the naming sequence for multiple screenshots if file already exists or I am missing something...
nijel8 said:
didn't know that either... thanks for the tip.
EDIT:Looks like I need my numbering code, I can't find a way to continue the naming sequence for multiple screenshots if file already exists or I am missing something...
Click to expand...
Click to collapse
There isn't anyway that I know of inside of ffmpeg to do that globally, the way to do it is on your side (like you were doing). I didn't notice your number was saved.:good:
Aung Thiha said:
....how do I enable ADB on recovery mode....
Click to expand...
Click to collapse
+1. did not work. device: Micromax A116 Canvas HD. recovery: TWRP v2.6.3.0.
thanks
m0han said:
+1. did not work. device: Micromax A116 Canvas HD. recovery: TWRP v2.6.3.0.
Click to expand...
Click to collapse
Your recovery has to have ADB enabled! I wish I could tell you I know how to enable adb on all recoveries, but I can't.
Aung Thiha said:
but how do I enable ADB on recovery mode. Sorry for my noob question.
Click to expand...
Click to collapse
I don't know. Your best bet is to ask in the forum thread you downloaded your recovery from.
Sent from my Nexus 7 using XDA Premium HD app
Thanks For The Tool... Its Working Fine...
Device: QMobile A900 (MT6589)
Screen Resolution: 720x1280
Stride: 16
Pixel Format: rgb565
1) Don't Know If Its A Bug But The Screenshot Taken With Option (1 - Get the top framebuffer.) Seems Cropped A Bit At Bottom...
Please Check Attached PNGs
2) Screenshot Taken With Option (2 - Get the bottom framebuffer.) Is Fine... :good:
m0han said:
+1. did not work. device: Micromax A116 Canvas HD. recovery: TWRP v2.6.3.0.
Click to expand...
Click to collapse
Brother, There Is No ADB Inside TWRPv2.6.3 For CanvasHD... I Think Its Removed By Your Recovery Maker Due To Small Size Recovery Partition...
EnerJon said:
Thanks For The Tool... Its Working Fine...
Device: QMobile A900 (MT6589)
Screen Resolution: 720x1280
Stride: 16
Pixel Format: rgb565
1) Don't Know If Its A Bug But The Screenshot Taken With Option (1 - Get the top framebuffer.) Seems Cropped A Bit At Bottom...
Please Check Attached PNGs
2) Screenshot Taken With Option (2 - Get the bottom framebuffer.) Is Fine... :good:
Click to expand...
Click to collapse
Thanks for the feedback! What you are seeing is something with twrp, I think. I've noticed on mine, if I try to capture the splashscreen on twrp quickly at boot; it will do that same thing at the bottom on my screenshot too. If you look at it when it boots twrp draws like the whole top of the screen then quickly the very bottom as its calling for a fb swap. Even after my Nexus is sitting there for a minute, one framebuffer will look like that until the clock on twrp changes. Then it's fine.
Not real sure what causes it, but have you tried to do it after that? Does it do it everytime? If you open settings.cfg is this the first four numbers in it; 720 1280 16 736 ?
makers_mark said:
Thanks for the feedback! What you are seeing is something with twrp, I think. I've noticed on mine, if I try to capture the splashscreen on twrp quickly at boot; it will do that same thing at the bottom on my screenshot too. If you look at it when it boots twrp draws like the whole top of the screen then quickly the very bottom as its calling for a fb swap. Even after my Nexus is sitting there for a minute, one framebuffer will look like that until the clock on twrp changes. Then it's fine.
Not real sure what causes it, but have you tried to do it after that? Does it do it everytime? If you open settings.cfg is this the first four numbers in it; 720 1280 16 736 ?
Click to expand...
Click to collapse
No Its Not The SplashScreen... Its Main Screen Which Comes Right After SplashScreen...
Yes It Works Fine After Clock Changes...
Yes It Do It Everytime After First Bootup...
Yes The First Four Numbers Are Same...
720 1280 16 736 7536640 rgb565
Great Tool...!
EnerJon said:
No Its Not The SplashScreen... Its Main Screen Which Comes Right After SplashScreen...
Yes It Works Fine After Clock Changes...
Yes It Do It Everytime After First Bootup...
Yes The First Four Numbers Are Same...
720 1280 16 736 7536640 rgb565
Great Tool...!
Click to expand...
Click to collapse
Thanks for pointing that out. Added to the OP:
Notes:
If you change your recovery, you may have to clear the settings, it depends if there is a different pixel format. You can do so easily in the program, or you can just delete 'settings.cfg'
Sometimes your screenshot may seem disorganized or torn. This may happen when the very first screen is drawn, and also in between framebuffer swaps and writes. This is totally normal. This tool grabs your current framebuffer in its current state (in your devices memory). It can't automatically discern if the image is in fact what you see on your device in a given moment. If your screenshot is torn, you can:
Grab both framebuffers (option 3 in normal mode)
Quit hitting buttons to change the screen when you are pulling the framebuffer! lol
Wait for the framebuffer to swap with a clock change, or force it to change by going anywhere in the menu and then back to where you want to get your screenshot. A sub note on that: A button highlighting, and then a screen change will result in two swaps of the framebuffer and your next image will be on the same side of the framebuffer. If your screen was on the top and you hit a button (that highlights), then the next screen will also be on top. If there is no button highlight, hence just a draw of the next screen and a swap: The next screen will be on the opposite side. Same goes for any other change to your device screen, such as a clock digit changing. What was up now is down, and vice versa.
Aroma only uses the top framebuffer. It never calls for a swap, and the bottom framebuffer will stay whatever was last on it.
Keep Up The Good Work...!
EnerJon said:
..... Its Removed By Your Recovery Maker Due To Small Size Recovery Partition...
Click to expand...
Click to collapse
maybe you're right. now, is there a recovery for canvas hd that has adb enabled? thanks for any info.
m0han said:
maybe you're right. now, is there a recovery for canvas hd that has adb enabled? thanks for any info.
Click to expand...
Click to collapse
Try TWRPv2.5.0 or CWMR or CTR For Your CanvasHD... Their Size Iz Small, So The Chances Are High For ABD In These Recoveries... But I Personally Tested Your TWRPv2.6.3... ADB Is Not Included In It...
m0han said:
+1. did not work. device: Micromax A116 Canvas HD. recovery: TWRP v2.6.3.0.
Click to expand...
Click to collapse
makers_mark said:
Your recovery has to have ADB enabled! I wish I could tell you I know how to enable adb on all recoveries, but I can't.
Click to expand...
Click to collapse
makers_mark said:
I don't know. Your best bet is to ask in the forum thread you downloaded your recovery from.
Sent from my Nexus 7 using XDA Premium HD app
Click to expand...
Click to collapse
I am using same series device CANVAS 2+ and it worked on CWM recovery.
Thanks @makers_mark