Is anyone familiar with ffmpeg? Im trying to get a screenshot of my htc one x in recovery and ddms wont work. So I tried to pull the dev/graphic/fb0 file and I have successfully pulled it but i'm unable to get ffmpeg to convert it to a picture format like png or jpeg. I'm running these commands
adb pull /dev/graphics/fb0
ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgba -s 720x1280 -i fb0 -f image2 -vcodec mjpeg fb%d.jpg
When I run it it says option vframes (set the number of video frames to record) cannot be applied to i
nput file fb0 -- you are trying to apply an input option to an output file or vi
ce versa. Move this option before the file it belongs to.
Error parsing options for input file fb0.
Error opening input files: Error number -22 occurred.
What am I doing wrong?
Related
I am simply reposting this from the mytouch thread by elegos, who is the creator of this script, I take no credit for this whatsoever.
Hello there!
This is a G1 / Magic tool to easily convert images in splash screen ones.
This tool is based upon ffmpeg and you need it installed on your system before proceeding (it will prompt you about the program missing in any case)
REQUIREMENTS
ffmpeg installed on your system
Code:
$ sudo apt-get install ffmpeg
a 320x480 image
a 320x480 device (i.e. G1 / Magic) with engineering SPL (S-OFF)
USAGE
Code:
./file [--help][-h]
Prints out how to use the script
Code:
./file your_image_file
Converts your image into a flashable splash screen, if you want the script will continue flashing the file directly.
NOTE: if you wish to make this script work with the Nexus One or any other device which doesn't share the same 320x480 resolution, just change these two variables:
Code:
size_check=307200
size_desc="320x480"
size_check is in bytes, size_desc is just a descriptive string.
I ASSUME NO RESPONSABILITY ABOUT THE USAGE OF THIS SCRIPT. USE IT "AS IS", LOOK AT THE OUTPUTS AND YOU'LL AVOID BRICKS!
Please, if you wish to redistribute this script, give the right credits and don't change the prog_header please (maybe link this discussion in a text file)!
Edit: I have added a already to use script for 320x480 devices only! Or you can make your own script using elegos's code. The script should already be marked as executable, if not then make executable:
http://www.mediafire.com/?wz83iff1eg3fv38
Usage for this script:
Code:
$ ./splash_creator fileimagename.whatever
Here the code is, just slap it in a text file, give it the executive permission (chmod +x filename) and use it!
Code:
#!/bin/bash
prog_header() {
echo "###############################"
echo "####### EleGoS's FFMPEG #######"
echo "# G1/Sapphire/MyTouch3G/Magic #"
echo "### Splash Screen converter ###"
echo "###############################"
echo "version 1.0"
echo ""
}
if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
prog_header
echo "Usage"
echo "$0 your_image_file"
exit 0
fi
warning() {
printf "\e[0;31m$1\e[0m \n"
}
check_ok() {
printf "\e[0;32m$1\e[0m \n"
}
ffmpeg_check=$(which ffmpeg)
size_check=307200
size_desc="320x480"
if [ "$ffmpeg_check" != "" ]; then
OUTPUT=$(echo "$1" | cut -d'.' -f1).raw565
clear
prog_header
ffmpeg -i $1 -f rawvideo -pix_fmt rgb565 $OUTPUT
clear
prog_header
FILESIZE=$(cat $OUTPUT | wc -c)
if [ $FILESIZE -eq $size_check ]; then
check_ok "$OUTPUT is ready to be flashed."
else
rm $OUTPUT
warning "$OUTPUT filesize mismatches! Wrong image size ($size_desc)? Aborted."
exit 0
fi
echo "In order to flash this image you have to plug your phone in fastboot mode."
read -p "Flash it now? (y/n) "
if [ "$REPLY" == "y" ] || [ "$REPLY" == "Y" ]; then
fastboot devices | grep -q "fastboot"
if [ $? -ne 0 ]; then
warning "The USB cable is not plugged, or the device is not in fastboot mode."
echo "To flash the splash screen, manually execute this command once in fastboot mode:"
echo "fastboot flash splash1 $OUTPUT"
exit 0
else
fastboot flash splash1 $OUTPUT
fi
else
echo "To flash the splash screen, execute this command once in fastboot mode:"
echo "fastboot flash splash1 $OUTPUT"
exit 0
fi
else
warning "ffmpeg not found! Please install it before running this script!\ni.e. (DEBIAN) apt-get install ffmpeg / (OSX) sudo port install ffmpeg"
fi
Edit:
elegos said:
- Open the terminal -> nano splash_creator
- copy / paste the code
- [CTRL]+O, then [ENTER]. [CTRL]+X
- chmod +x splash_creator
- Put the image you want as splash screen in a folder where the script is (it is actually in your home)
- Open terminal -> cd your/folder/here
- ./splash_creator your_image_here.whatever
Click to expand...
Click to collapse
Also feel free to post your splash screens here as well
Splash screens
So here's one that mjybarr made, and one I'm using right now, both very nice splash screens
Works like a dream! Thanks for providing this tut.
I'm trying to deconstruct the Android app development process by creating and installing a sample app entirely from the command line (without even using Ant). I've composed a script which seems to work until the very last command, at which point I get the message
134 KB/s (10496 bytes in 0.076s)
pkg: /data/local/tmp/MyActivity-debug.apk
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
Please don't be put off by the fact that my script is a Windows .bat script. I'm just calling code from the SDK's tools and platform-tools directories. Anyway, here's the script. If find what I'm missing that's giving me the NO_CERTIFICATES error, please reply...
call "c:\program files (x86)\Android\android-sdk\tools\android" create project --target 10 --name MyAndroidProject --path c:\MyProjects\MyAndroidProject --activity MyActivity --package com.allmycode.samples
cd \MyProjects\MyAndroidProject
mkdir C:\MyProjects\MyAndroidProject\res
mkdir C:\MyProjects\MyAndroidProject\libs
mkdir C:\MyProjects\MyAndroidProject\bin
mkdir C:\MyProjects\MyAndroidProject\gen
mkdir C:\MyProjects\MyAndroidProject\bin\classes
"C:\Program Files (x86)\Android\android-sdk\platform-tools\aapt.exe" package -f -m -M C:\MyProjects\MyAndroidProject\AndroidManifest.xml -S C:\MyProjects\MyAndroidProject\res -I "C:\Program Files (x86)\Android\android-sdk\platforms\android-9\android.jar" -J C:\MyProjects\MyAndroidProject\gen
"c:\program files\java\jdk1.7.0\bin\javac" -d C:\MyProjects\MyAndroidProject\bin\classes -classpath C:\MyProjects\MyAndroidProject\bin\classes;C:\MyProjects\MyAndroidProject;c:\ant\lib\ant-launcher.jar;"C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip";C:\ant\lib\ant-antlr.jar;C:\ant\lib\ant-apache-bcel.jar;C:\ant\lib\ant-apache-bsf.jar;C:\ant\lib\ant-apache-log4j.jar;C:\ant\lib\ant-apache-oro.jar;C:\ant\lib\ant-apache-regexp.jar;C:\ant\lib\ant-apache-resolver.jar;C:\ant\lib\ant-apache-xalan2.jar;C:\ant\lib\ant-commons-logging.jar;C:\ant\lib\ant-commons-net.jar;C:\ant\lib\ant-jai.jar;C:\ant\lib\ant-javamail.jar;C:\ant\lib\ant-jdepend.jar;C:\ant\lib\ant-jmf.jar;C:\ant\lib\ant-jsch.jar;C:\ant\lib\ant-junit.jar;C:\ant\lib\ant-junit4.jar;C:\ant\lib\ant-netrexx.jar;C:\ant\lib\ant-swing.jar;C:\ant\lib\ant-testutil.jar;C:\ant\lib\ant.jar;"C:\Program Files\Java\jdk1.7.0\lib\tools.jar" -sourcepath C:\MyProjects\MyAndroidProject\src;C:\MyProjects\MyAndroidProject\gen -target 1.5 -bootclasspath "C:\Program Files (x86)\Android\android-sdk\platforms\android-9\android.jar" -encoding UTF-8 -g -source 1.5 c:\MyProjects\MyAndroidProject\src\com\allmycode\samples\*.java
call "C:\Program Files (x86)\Android\android-sdk\platform-tools\dx.bat" --dex --output=C:\MyProjects\MyAndroidProject\bin\classes.dex C:\MyProjects\MyAndroidProject\bin\classes
"C:\Program Files (x86)\Android\android-sdk\platform-tools\aapt.exe" package -f --debug-mode -M C:\MyProjects\MyAndroidProject\AndroidManifest.xml -S C:\MyProjects\MyAndroidProject\res -I "C:\Program Files (x86)\Android\android-sdk\platforms\android-9\android.jar" -F C:\MyProjects\MyAndroidProject\bin\MyActivity-debug-unaligned.apk
"C:\Program Files (x86)\Android\android-sdk\tools\zipalign.exe" -f 4 C:\MyProjects\MyAndroidProject\bin\MyActivity-debug-unaligned.apk C:\MyProjects\MyAndroidProject\bin\MyActivity-debug.apk
start "Launch an emulator" "C:\Program Files (x86)\Android\android-sdk/tools/emulator.exe" -avd Gingerbread
timeout /T 60
"C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe" install -r C:\MyProjects\MyAndroidProject\bin\MyActivity-debug.apk
You need to sign your apk
Hey, I believe all you need to do is sign your .apk with a certificate.
Here is a link about creating a certificate if you dont already have one. I tried to include a link but it wont let me. (sorry im a new user)
Once you have acquired a certificate, you can then use the JDK utitility called jarsigner. The terminal command should be something like this...
jarsigner -verbose -keystore my-release-key.keystore final.apk alias_name
Click to expand...
Click to collapse
Hope this helps ya out.
Is this what I have to do to take a screenshot in the recovery? Using adb:
adb pull /dev/graphics/fb0
ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgba -s 720x1280 -i fb0 -f image2 -vcodec mjpeg fb%d.jpg
EDIT: I tried using ddms.bat while in recovery but it doesn't recognize my phone. I don't know what else to do or why it's not recognizing it. Can someone try with their phone and see if it works?
EDIT 2: ddms.bat works fine to take a screenshot when the device is booted up. Just not in the recovery.
SkizzMcNizz said:
Is this what I have to do to take a screenshot in the recovery? Using adb:
adb pull /dev/graphics/fb0
ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgba -s 720x1280 -i fb0 -f image2 -vcodec mjpeg fb%d.jpg
EDIT: I tried using ddms.bat while in recovery but it doesn't recognize my phone. I don't know what else to do or why it's not recognizing it. Can someone try with their phone and see if it works?
EDIT 2: ddms.bat works fine to take a screenshot when the device is booted up. Just not in the recovery.
Click to expand...
Click to collapse
yes that is correct, however its device specific on the fbX most all are 0, some can be a different number, just try until you find the correct one,
also note that the colors my be off, and if they are simple change the
rgba around,
for instance my red was blue and blue was red,
just changed the order from
rgba to bgra and problem solved
Skizzy034 said:
Is this what I have to do to take a screenshot in the recovery? Using adb:
adb pull /dev/graphics/fb0
ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgba -s 720x1280 -i fb0 -f image2 -vcodec mjpeg fb%d.jpg
EDIT: I tried using ddms.bat while in recovery but it doesn't recognize my phone. I don't know what else to do or why it's not recognizing it. Can someone try with their phone and see if it works?
EDIT 2: ddms.bat works fine to take a screenshot when the device is booted up. Just not in the recovery.
Click to expand...
Click to collapse
That's great, however -vframes belongs to the output.
adb pull /dev/graphics/fb0
ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgba -s 720x1280 -i fb0 -f image2 -vcodec mjpeg -vframes 1 fb%d.jpg
If the device is in landscape mode you have to invert the resolution:
adb pull /dev/graphics/fb0
ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgba -s 1280x720 -i fb0 -f image2 -vcodec mjpeg -vframes 1 fb%d.jpg
Hi Friends!
Is it possible with the same method to take screenshot on normal (not TWRP) LineageOS mode?
Code:
adb pull /dev/graphics/fb0
failed to copy '/dev/graphics/fb0' to './fb0': open failed: Permission denied
What is the correct video device for standard LineageOS mode?
Many thanks!
Davide
This is a quick tip about how to use FFmpeg on android.
- Download FFmpeg Android Java.
- Open it and put the commands properly on the text box and hit "Run".
Examples:
Mux two separate audio and video files into a single one
Code:
-y -i /sdcard/video.mp4 -i /sdcard/audio.m4a -map 0 -map 1 -codec copy /sdcard/result.mp4
Mux video and two separate audio streams
Code:
-y -i /sdcard/video.mp4 -i /sdcard/audio1.mp3 -i /sdcard/audio2.ogg -map 0:0 -map 1:0 -map 2:0 -codec copy /sdcard/result.mkv
http://cfc.kizzx2.com/index.php/muxing-audio-and-video-with-ffmpeg/
http://stackoverflow.com/questions/...eo-and-audio-from-another-video-mapping-issue
Much more commands on the original website: http://ffmpeg4android.netcompss.com/
FFmpeg documentation: https://www.ffmpeg.org/ffmpeg.html
Note:
This is not bootanimation, this is the splash screen (the 'Lenovo' boot logo which is displayed when device is switched ON)
This is for Lenovo Tab10.1 TB-X103F Only..
(For other devices, please send me your splash.img so that I can create a tool for you too.)
Requirements:
1. Rooted Lenovo Tab10.1 TB-X103F (any ROM)
2. Optional: Terminal Emulator app or Custom Recovery or atleast working fastboot in computer
3. You're proceeding at your own risk.
STEPS to create splash.img:
Before proceeding, make sure fastboot is setup properly in your computer (just incase something goes wrong)..
1. Download & Extract this in computer: Lenovo_Tab_10_X103F_Splash_Maker.zip
2. Make sure you have a 1280x800 resolution picture. (landscape)
3. Now rename your picture as logo.png or logo.jpg (according to its format) & replace it inside "pics" folder of the extracted folder.
4. Finally, run the 'Create_Logo.bat' to create splash.img , which you can find inside the "output" folder.
STEPS to flash splash.img:
Optional: To backup your original splash.img:
Code:
dd if=/dev/block/bootdevice/by-name/splash of=/sdcard/splash.img
(Not necessary though.. You may get it from the stock firmware itself.)
Now, Choose any one easy method:
a. To flash from recovery:
Transfer the flashable_splash.zip to your device and flash from TWRP or CWM or Philz or any other custom recovery.
b. To flash from Terminal Emulator:
Transfer the splash.img to your device's Internal Storage, Open Terminal Emulator & enter the following to flash it:
Code:
su
dd if=/sdcard/splash.img of=/dev/block/bootdevice/by-name/splash
c. To flash from Fastboot mode:
Code:
fastboot flash splash splash.img
Note:
Incase something goes wrong or device doesn't bootup, flash the stock splash.img from custom recovery or fastboot.
Credits:
1. @racereed who provided the stock splash.img of Lenovo 10.1 tablet TB-X103F
2. @bornagainpenguin and all others who have contributed for the device which has made this possible.
Hit the Thanks :good: button if it worked for you
You're welcome to post the splash images that you created..
Thanks a lot @GokulNC for the original windows guide
Linux guide
You want to install SimpleSSHD and do all steps except the first and last on a local machine.
# Backup the current splash image and use it for reference
dd if=/dev/block/bootdevice/by-name/splash of=splash-bak.img
# Convert the logo raw image to png
ffmpeg -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 800x1280 -i splash-bak.img -vframes 1 -y logo.png
# Convert the battery raw image to png
ffmpeg -hide_banner -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -skip_initial_bytes 3072000 -s 800x1280 -i splash-bak.img -vframes 1 -y battery.png
# Make your own images in Krita/Gimp
# Convert them to raw and join them to a splash image
ffmpeg -hide_banner -i logo.png -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 800x1280 -y splash1.raw
ffmpeg -hide_banner -i battery.png -f rawvideo -vcodec rawvideo -pix_fmt bgr24 -s 800x1280 -y splash2.raw
cat splash1.raw splash2.raw > splash-new.img
# Apply the new splash image
dd if=splash-new.img of=/dev/block/bootdevice/by-name/splash