*** Easy ADB solution for screenshots in recovery HTC ONE M7 ***

Search This thread

Whiskey103

Senior Moderator / Member Advocate Admin / DC / RT
Staff member
Jun 6, 2009
10,012
20,442
44
Tell me, I’m lost . . .
www.whiskey103.nl
For the ppl that wanted a solution for making screenshots in recovery on HTC ONE M7
Can be handy for troubleshooting/bugreports in Aroma or simply for recovery Themers ;)

Download the ScreenshotFFMPEG_M7.rar
Plugin usb cable in recovery
Extract the package and run the screenshot_run_me_auto_ffmpegM7.bat


thx to Sneakyghost for the ffmpeg values
It runs the following code:

Code:
@echo off
echo ********************************************
echo *                                          *
echo *      ADB-Screenshot Util                 *
echo *      Boot into Recovery                  *
echo *      Plug In USB Cable                   *
echo *      Enjoy ;)                            *
echo *                                          *
echo ********************************************
echo.
pause
echo.
adb kill-server -d >nul 2>&1
adb pull /dev/graphics/fb0 fb0
ffmpeg -vframes 1 -f rawvideo -pix_fmt rgba -s 1088x1920 -i fb0 screenshot.png
del fb0
echo.
echo ********************************************
echo *                                          *
echo *     Output saved as screenshot.png       *
echo *                                          *
echo ********************************************
echo.
pause

XDA:DevDB Information
*** Easy ADB solution for screenshots in recovery HTC ONE M7 ***, a Tool/Utility for the HTC One

Contributors
Whiskey103, Patrics83

Version Information
Status: Stable

Created 2013-08-04
Last Updated 2013-11-17
 
Last edited:

Whiskey103

Senior Moderator / Member Advocate Admin / DC / RT
Staff member
Jun 6, 2009
10,012
20,442
44
Tell me, I’m lost . . .
www.whiskey103.nl
Output should look like this


Code:
********************************************
*                                          *
*      ADB-Screenshot Util                 *
*      Boot into Recovery                  *
*      Plug In USB Cable                   *
*      Enjoy ;)                            *
*                                          *
********************************************

Druk op een toets om door te gaan. . .

* daemon not running. starting it now on port 5037 *
* daemon started successfully *
3138 KB/s (25067520 bytes in 7.800s)
FFmpeg version SVN-r25512, Copyright (c) 2000-2010 the FFmpeg developers
  built on Oct 18 2010 04:06:45 with gcc 4.4.2
  configuration: --enable-gpl --enable-version3 --enable-libgsm --enable-pthread
s --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libmp3lame --
enable-libopenjpeg --enable-libschroedinger --enable-libopencore_amrwb --enable-
libopencore_amrnb --enable-libvpx --arch=x86 --enable-runtime-cpudetect --enable
-libxvid --enable-libx264 --extra-libs='-lx264 -lpthread' --enable-librtmp --ext
ra-libs='-lrtmp -lpolarssl -lws2_32 -lwinmm' --target-os=mingw32 --enable-avisyn
th --cross-prefix=i686-mingw32- --cc='ccache i686-mingw32-gcc' --enable-memalign
-hack
  libavutil     50.32. 3 / 50.32. 3
  libavcore      0. 9. 1 /  0. 9. 1
  libavcodec    52.92. 0 / 52.92. 0
  libavformat   52.83. 0 / 52.83. 0
  libavdevice   52. 2. 2 / 52. 2. 2
  libavfilter    1.52. 0 /  1.52. 0
  libswscale     0.12. 0 /  0.12. 0
[rawvideo @ 0188bf30] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from 'fb0':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: rawvideo, rgba, 1088x1920, 25 tbr, 25 tbn, 25 tbc
[buffer @ 0188ff50] w:1088 h:1920 pixfmt:rgba
[ffsink @ 01749890] auto-inserting filter 'auto-inserted scaler 0' between the f
ilter 'src' and the filter 'out'
[scale @ 01753570] w:1088 h:1920 fmt:rgba -> w:1088 h:1920 fmt:rgb24 flags:0x4
Output #0, image2, to 'screenshot.png':
  Metadata:
    encoder         : Lavf52.83.0
    Stream #0.0: Video: png, rgb24, 1088x1920, q=2-31, 200 kb/s, 90k tbn, 25 tbc

Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=    1 fps=  0 q=0.0 Lsize=      -0kB time=0.04 bitrate=  -4.4kbits/s
video:1030kB audio:0kB global headers:0kB muxing overhead -100.002087%

********************************************
*                                          *
*     Output saved as screenshot.png       *
*                                          *
********************************************

Druk op een toets om door te gaan. . .
 

Phil3759

Inactive Recognized Developer
May 30, 2012
9,561
33,050
Hi @Whiskey103
A use pointed me to your thread here using ffmpeg
I see you managed to decode the fb0 stream in the new devices. Seems like this thing works also on S4
Probably the frame width you modified helps here, maybe other offset things

Now, if I could get this to work in Android...
I found this very interesting, as I was too lazy to build them my self from sources:
https://github.com/guardianproject/android-ffmpeg/downloads

These have all ffmpeg static libs. The binary is dynamically linked though, so you need to mount /system in recovery shell session

Sadly, it doesn't work, the decoded stream is off on my side

If someone can test on his One device would be great
It could be you need to modify command a little to decode all frames:
Code:
ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgba -s 1088x1920 -i fb0 -f image2 -vcodec png image_%05d.png
 

donmarkoni

Senior Member
Sep 21, 2010
1,828
2,174
Belgrade
Hey @Phil3759!

Downloaded ffmpg from pointed location and got this:
Code:
C:\Users\Marko\Desktop\HTC 1\fastboot>adb shell
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
[email protected]:/ # ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgba -s 1088x192
0 -i fb0 -f image2 -vcodec png image_%05d.png
0 -i fb0 -f image2 -vcodec png image_%05d.png                                 <
←[0;39mffmpeg version 0.11.1←[0m←[0;39m Copyright (c) 2000-2012 the FFmpeg developer
s←[0m←[0;39m
←[0m←[0;39m  built on Sep 20 2012 13:28:38 with gcc 4.6.x-google 20120106 (prereleas
e)
←[0m←[0;39m  configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-ru
ntime-cpudetect --prefix=/data/data/org.witness.sscvideoproto --enable-pic --disable
-shared --enable-static --cross-prefix=/opt/android-ndk/toolchains/arm-linux-android
eabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi- --sysroot=/opt/android-ndk/pl
atforms/android-3/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon'
--extra-ldflags=-L../x264 --enable-version3 --enable-gpl --disable-doc --enable-yasm
 --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-pars
ers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --d
isable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmp
eg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-
libx264 --enable-zlib
←[0m←[0;39m  libavutil      51. 54.100 / 51. 54.100
←[0m←[0;39m  libavcodec     54. 23.100 / 54. 23.100
←[0m←[0;39m  libavformat    54.  6.100 / 54.  6.100
←[0m←[0;39m  libavdevice    54.  0.100 / 54.  0.100
←[0m←[0;39m  libavfilter     2. 77.100 /  2. 77.100
←[0m←[0;39m  libswscale      2.  1.100 /  2.  1.100
←[0m←[0;39m  libswresample   0. 15.100 /  0. 15.100
←[0m←[0;39m  libpostproc    52.  0.100 / 52.  0.100
←[0m←[1;31mfb0: No such file or directory
←[0m←[4;31m←[0m1|[email protected]:/ #
 

Phil3759

Inactive Recognized Developer
May 30, 2012
9,561
33,050
Hey @Phil3759!

Downloaded ffmpg from pointed location and got this:
Code:
C:\Users\Marko\Desktop\HTC 1\fastboot>adb shell
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
[email protected]:/ # ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgba -s 1088x192
0 -i fb0 -f image2 -vcodec png image_%05d.png
0 -i fb0 -f image2 -vcodec png image_%05d.png                                 <
←[0;39mffmpeg version 0.11.1←[0m←[0;39m Copyright (c) 2000-2012 the FFmpeg developer
s←[0m←[0;39m
←[0m←[0;39m  built on Sep 20 2012 13:28:38 with gcc 4.6.x-google 20120106 (prereleas
e)
←[0m←[0;39m  configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-ru
ntime-cpudetect --prefix=/data/data/org.witness.sscvideoproto --enable-pic --disable
-shared --enable-static --cross-prefix=/opt/android-ndk/toolchains/arm-linux-android
eabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi- --sysroot=/opt/android-ndk/pl
atforms/android-3/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon'
--extra-ldflags=-L../x264 --enable-version3 --enable-gpl --disable-doc --enable-yasm
 --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-pars
ers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --d
isable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmp
eg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-
libx264 --enable-zlib
←[0m←[0;39m  libavutil      51. 54.100 / 51. 54.100
←[0m←[0;39m  libavcodec     54. 23.100 / 54. 23.100
←[0m←[0;39m  libavformat    54.  6.100 / 54.  6.100
←[0m←[0;39m  libavdevice    54.  0.100 / 54.  0.100
←[0m←[0;39m  libavfilter     2. 77.100 /  2. 77.100
←[0m←[0;39m  libswscale      2.  1.100 /  2.  1.100
←[0m←[0;39m  libswresample   0. 15.100 /  0. 15.100
←[0m←[0;39m  libpostproc    52.  0.100 / 52.  0.100
←[0m←[1;31mfb0: No such file or directory
←[0m←[4;31m←[0m1|[email protected]:/ #

well, you should cat your buffer first...
I am not discussing the basics here to avoid cluttering a thread that should be kept for developing only
 

Whiskey103

Senior Moderator / Member Advocate Admin / DC / RT
Staff member
Jun 6, 2009
10,012
20,442
44
Tell me, I’m lost . . .
www.whiskey103.nl
well, you should cat your buffer first...
I am not discussing the basics here to avoid cluttering a thread that should be kept for developing only

Thing is, it seems somewhat kernel depending, for example latest twrp embedded a different kernel and the screenshot function broke.
Worked on earlier versions, it's really hit or miss sadly.
Honestly I stopped looking into it coz i don't have time to keep checking the changes all the time and don't have proper kernel knowledge either.
Way above my head Sry.

Sent from my HTC One using XDA Premium 4 mobile app
 
Last edited:

donmarkoni

Senior Member
Sep 21, 2010
1,828
2,174
Belgrade
well, you should cat your buffer first...
I am not discussing the basics here to avoid cluttering a thread that should be kept for developing only

Let me take another shot on this... booted recovery... typing paths...:
Code:
C:\Users\Marko\Desktop\HTC 1\fastboot>adb shell
~ # cd sdcard
cd sdcard
/data/media/0 # ./ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgba -s 10
88x1920 -i /dev/graphics/fb0 -f image2 -vcodec png image_%05d.png
./ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgba -
s 1088x1920 -i /dev/graphics/fb0 -f image2 -vcodec png image_%05d.png
ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 20 2012 13:28:38 with gcc 4.6.x-google 20120106 (prerelease)
  configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpude
tect --prefix=/data/data/org.witness.sscvideoproto --enable-pic --disable-shared --e
nable-static --cross-prefix=/opt/android-ndk/toolchains/arm-linux-androideabi-4.6/pr
ebuilt/linux-x86/bin/arm-linux-androideabi- --sysroot=/opt/android-ndk/platforms/and
roid-3/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon' --extra-ldf
lags=-L../x264 --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-d
ecoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enabl
e-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-inde
vs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disabl
e-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --e
nable-zlib
  libavutil      51. 54.100 / 51. 54.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rawvideo @ 0xee5560] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from '/dev/graphics/fb0':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGBA / 0x41424752), rgba, 1088x1920, 25 tbr, 25 tb
n, 25 tbc
[buffer @ 0xef35a0] w:1088 h:1920 pixfmt:rgba tb:1/25 sar:0/1 sws_param:flags=2
[buffersink @ 0xef3810] No opaque field provided
Output #0, image2, to 'image_%05d.png':
  Metadata:
    encoder         : Lavf54.6.100
    Stream #0:0: Video: png, rgba, 1088x1920, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> png)
Press [q] to stop, [?] for help
frame=    2 fps=0.0 q=0.0 size=       0kB time=00:00:00.08 bitrate=   0.0kbits/s
frame=    3 fps=2.9 q=0.0 size=       0kB time=00:00:00.12 bitrate=   0.0kbits/s
frame=    3 fps=2.4 q=0.0 Lsize=       0kB time=00:00:00.12 bitrate=   0.0kbits/s

video:971kB audio:0kB global headers:0kB muxing overhead -100.000000%
/data/media/0 #
Getting three empty image_0000x.png files. First two about 480kB size and third about 8kB.
@Whiskey103's batch file does proper job with your recovery (s/s attached), so I'm guessing you could find a way if you have time and nerves to bear with my ignorance.

Sorry if doing stupid things, just ignore this post and I'll stop. You know I'm pretty much noob, but trying to learn when I have time and opportunity. It's also late and I had a long day at work. Sorry again.
 

Attachments

  • screenshot.jpg
    screenshot.jpg
    147.9 KB · Views: 364

puretone

Senior Member
Jun 16, 2010
200
23
For the ppl that wanted a solution for making screenshots in recovery on HTC ONE M7
Can be handy for troubleshooting/bugreports in Aroma or simply for recovery Themers ;)

Download the ScreenshotFFMPEG_M7.rar
Plugin usb cable in recovery
Extract the package and run the screenshot_run_me_auto_ffmpegM7.bat


thx to Sneakyghost for the ffmpeg values
It runs the following code:

Code:
@echo off
echo ********************************************
echo *                                          *
echo *      ADB-Screenshot Util                 *
echo *      Boot into Recovery                  *
echo *      Plug In USB Cable                   *
echo *      Enjoy ;)                            *
echo *                                          *
echo ********************************************
echo.
pause
echo.
adb kill-server -d >nul 2>&1
adb pull /dev/graphics/fb0 fb0
ffmpeg -vframes 1 -f rawvideo -pix_fmt rgba -s 1088x1920 -i fb0 screenshot.png
del fb0
echo.
echo ********************************************
echo *                                          *
echo *     Output saved as screenshot.png       *
echo *                                          *
echo ********************************************
echo.
pause

XDA:DevDB Information
*** Easy ADB solution for screenshots in recovery HTC ONE M7 ***, a Tool/Utility for the HTC One

Contributors
Whiskey103, Patrics83

Version Information
Status: Stable

Created 2013-08-04
Last Updated 2013-11-17

Wat klinkt dat toch grappig in het Nederlands :)

Sent from my HTC One using xda app-developers app
 

Phil3759

Inactive Recognized Developer
May 30, 2012
9,561
33,050
Thing is, it seems somewhat kernel depending, for example latest twrp embedded a different kernel and the screenshot function broke.
Worked on earlier versions, it's really hit or miss sadly.
Honestly I stopped looking into it coz i don't have time to keep checking the changes all the time and don't have proper kernel knowledge either.
Way above my head Sry.

Sent from my HTC One using XDA Premium 4 mobile app

Same here
We need to fix encoding at kernel level for each device. That's why I dropped it too
 

Whiskey103

Senior Moderator / Member Advocate Admin / DC / RT
Staff member
Jun 6, 2009
10,012
20,442
44
Tell me, I’m lost . . .
www.whiskey103.nl
@Whiskey103
I found the ffmpeg values for the 2013 Nexus 7. I have made a batch file from scratch to save screenshots to the computer. Can I use your idea, and post in the Nexus 7 forum?

Sure. Go ahead and pray that it keeps working on the next recovery version :/

Sent from my HTC One using XDA Premium 4 mobile app
 
Last edited:

Phil3759

Inactive Recognized Developer
May 30, 2012
9,561
33,050
@Whiskey103 and others:
New update version

It adds command line options to disable/enable buffering and to set a custom padding
It also adds a better auto mode for padding

Please test it under adb shell. If your device fails, post the code from adb shell here and we'll try to fix it

--------- deleted as it seems like a dead thread ----

Check my main PhilZ Touch thread for the progress with this one
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 19
    For the ppl that wanted a solution for making screenshots in recovery on HTC ONE M7
    Can be handy for troubleshooting/bugreports in Aroma or simply for recovery Themers ;)

    Download the ScreenshotFFMPEG_M7.rar
    Plugin usb cable in recovery
    Extract the package and run the screenshot_run_me_auto_ffmpegM7.bat


    thx to Sneakyghost for the ffmpeg values
    It runs the following code:

    Code:
    @echo off
    echo ********************************************
    echo *                                          *
    echo *      ADB-Screenshot Util                 *
    echo *      Boot into Recovery                  *
    echo *      Plug In USB Cable                   *
    echo *      Enjoy ;)                            *
    echo *                                          *
    echo ********************************************
    echo.
    pause
    echo.
    adb kill-server -d >nul 2>&1
    adb pull /dev/graphics/fb0 fb0
    ffmpeg -vframes 1 -f rawvideo -pix_fmt rgba -s 1088x1920 -i fb0 screenshot.png
    del fb0
    echo.
    echo ********************************************
    echo *                                          *
    echo *     Output saved as screenshot.png       *
    echo *                                          *
    echo ********************************************
    echo.
    pause

    XDA:DevDB Information
    *** Easy ADB solution for screenshots in recovery HTC ONE M7 ***, a Tool/Utility for the HTC One

    Contributors
    Whiskey103, Patrics83

    Version Information
    Status: Stable

    Created 2013-08-04
    Last Updated 2013-11-17
    2
    Output should look like this


    Code:
    ********************************************
    *                                          *
    *      ADB-Screenshot Util                 *
    *      Boot into Recovery                  *
    *      Plug In USB Cable                   *
    *      Enjoy ;)                            *
    *                                          *
    ********************************************
    
    Druk op een toets om door te gaan. . .
    
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    3138 KB/s (25067520 bytes in 7.800s)
    FFmpeg version SVN-r25512, Copyright (c) 2000-2010 the FFmpeg developers
      built on Oct 18 2010 04:06:45 with gcc 4.4.2
      configuration: --enable-gpl --enable-version3 --enable-libgsm --enable-pthread
    s --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libmp3lame --
    enable-libopenjpeg --enable-libschroedinger --enable-libopencore_amrwb --enable-
    libopencore_amrnb --enable-libvpx --arch=x86 --enable-runtime-cpudetect --enable
    -libxvid --enable-libx264 --extra-libs='-lx264 -lpthread' --enable-librtmp --ext
    ra-libs='-lrtmp -lpolarssl -lws2_32 -lwinmm' --target-os=mingw32 --enable-avisyn
    th --cross-prefix=i686-mingw32- --cc='ccache i686-mingw32-gcc' --enable-memalign
    -hack
      libavutil     50.32. 3 / 50.32. 3
      libavcore      0. 9. 1 /  0. 9. 1
      libavcodec    52.92. 0 / 52.92. 0
      libavformat   52.83. 0 / 52.83. 0
      libavdevice   52. 2. 2 / 52. 2. 2
      libavfilter    1.52. 0 /  1.52. 0
      libswscale     0.12. 0 /  0.12. 0
    [rawvideo @ 0188bf30] Estimating duration from bitrate, this may be inaccurate
    Input #0, rawvideo, from 'fb0':
      Duration: N/A, start: 0.000000, bitrate: N/A
        Stream #0.0: Video: rawvideo, rgba, 1088x1920, 25 tbr, 25 tbn, 25 tbc
    [buffer @ 0188ff50] w:1088 h:1920 pixfmt:rgba
    [ffsink @ 01749890] auto-inserting filter 'auto-inserted scaler 0' between the f
    ilter 'src' and the filter 'out'
    [scale @ 01753570] w:1088 h:1920 fmt:rgba -> w:1088 h:1920 fmt:rgb24 flags:0x4
    Output #0, image2, to 'screenshot.png':
      Metadata:
        encoder         : Lavf52.83.0
        Stream #0.0: Video: png, rgb24, 1088x1920, q=2-31, 200 kb/s, 90k tbn, 25 tbc
    
    Stream mapping:
      Stream #0.0 -> #0.0
    Press [q] to stop encoding
    frame=    1 fps=  0 q=0.0 Lsize=      -0kB time=0.04 bitrate=  -4.4kbits/s
    video:1030kB audio:0kB global headers:0kB muxing overhead -100.002087%
    
    ********************************************
    *                                          *
    *     Output saved as screenshot.png       *
    *                                          *
    ********************************************
    
    Druk op een toets om door te gaan. . .
    2
    --- deleted
    New version in main thread
    still work in progress
    2
    @Whiskey103 and others:
    New update version

    It adds command line options to disable/enable buffering and to set a custom padding
    It also adds a better auto mode for padding

    Please test it under adb shell. If your device fails, post the code from adb shell here and we'll try to fix it

    --------- deleted as it seems like a dead thread ----

    Check my main PhilZ Touch thread for the progress with this one
    2
    fb2png is now universal, hopefully ;)
    At least, until next devices start to break it again
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone