FORUMS
Remove All Ads from XDA

Help with how to use FFmpeg

328 posts
Thanks Meter: 324
 
By D3VI0US, Senior Member on 20th February 2013, 09:19 AM
Post Reply Email Thread
Hello Guys

I'm not a developer i'm just trying to do some tutorials in my website and the subject is TWRP on the Galaxy Nexus

i want to take screenshots so i did some searching and found the command adb pull /dev/graphics/fb0
which is pulling the current frame from the recovery in file called fb0 and it's size is 16mb

the next command to turn that file to a jpg pic is ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgba -s 720x1280 -i fb0 -f image2 -vcodec mjpeg fb%d.jpg

which is converting the fb0 to image .. at first it was giving me no such command because the ffmpeg file wasn't there so i did more search and got the files and put the ffmpeg.exe in the fastboot/adb folder and tried the command again but it gives 4 images 3 of them all black and the 4th one with purple color everywhere

the command result was like this



so what do i do wrong ?
 
 
4th March 2013, 03:35 AM |#2  
osm0sis's Avatar
Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,102
 
Donate to Me
More
I'm actually trying to figure this out right now too. Did you work it out?

I had a bit more luck with

ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt bgra -s 720x1280 -i fb0 -f image2 -vcodec mjpeg fb0.jpg

and the pic looks like the color is correct, just garbled. Testing all this out in CWM. Also tried the command with png that I've seen posted elsewhere, but jpg so far looks much closer, just like the resolution is off.

Edit: bgr0 seems to work for both jpg and png, just still seems like a res issue.
4th March 2013, 05:06 AM |#3  
osm0sis's Avatar
Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,102
 
Donate to Me
More
Figured it out by plugging away at dewarping the resolution of the raw fb0 in irfanview.

Apparently on the GN (at least in CWM) the frames in fb0 have an extra 16px tacked on the right-hand side.

adb pull /dev/graphics/fb0 fb0
ffmpeg -loglevel panic -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt bgr0 -s 736x1280 -i fb0 -vcodec png -f image2 fb0-%d.png
mogrify -crop -16 fb0-*.png


That does the trick for me in CWM. Let me know how it goes for TWRP.

Edit: K. Unsubscribing. PM me if you have any questions.
The Following User Says Thank You to osm0sis For This Useful Post: [ View ]
27th March 2013, 12:10 PM |#4  
uwdus's Avatar
Senior Member
Flag Düsseldorf
Thanks Meter: 36
 
More
Thanks a lot, worked for me on Razr HD with TWRP. 736 was the key!!!
Though I had a problem with the colors this made the final trick for me:

adb pull /dev/graphics/fb0
ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgba -s 736x1280 -i fb0 -f image2 -vcodec mjpeg fbd.jpg
17th April 2013, 08:13 PM |#5  
osm0sis's Avatar
Recognized Developer / Recognized Contributor
Flag Halifax
Thanks Meter: 30,102
 
Donate to Me
More
Yeah finding the correct pix_fmt for a specific device definitely seems to be the tricky part; total needle in a haystack.

Either way, for the full list you can type: ffmpeg -pix_fmts


I've just posted up a little automation batch script for the GN over in my "Odds and Ends" thread, so if someone also wants to mod that for their devices, feel free provided you credit me somewhere.
Post Reply Subscribe to Thread

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

Advanced Search
Display Modes