Monday, June 2, 2014

Video Colorspace conversion with ffmpegcolorspace and similar Gstreamer Plugin

There are cases when we need colorspace conversion when decoding video with gst-launch tool of Gstreamer. We can use ffmpegcolorspace or videoconvert gstreamer plugin for the same.


$ gst-launch-0.10 -v filesrc location=big_buck_bunny.mp4 ! qtdemux ! vmetadec ! 'video/x-raw-yuv,format=(fourcc)UYVY' ! ffmpegcolorspace ! 'video/x-raw-yuv,format=(fourcc)I420' ! autovideosink


Above example gives you idea about how to tell ffmpegcolorspace plugin about from which format to convert and in what format to give output.

'video/x-raw-yuv,format=(fourcc)UYVY' ! ffmpegcolorspace ! 'video/x-raw-yuv,format=(fourcc)I420'


So just remember above pipeline to convert from UYVY colorspace to I420 colorspace. You can change formats in above pipeline as per your need.

In newer version of gstreamer, ffmpegcolorspace is replaced with videoconvert plugin. So above pipeline for newer version of gstreamer can be represented as below.

 'video/x-raw-yuv,format=(fourcc)UYVY' ! videoconvert ! 'video/x-raw-yuv,format=(fourcc)I420'

Hope that's clear. Let me know should you have any further questions !

Thursday, September 5, 2013

Take backup of your Android phone

Always you might be wondering that how to take backup of your phone if your Phone manufacturer does not provide you backup software. Also you may have seen option of "Backup password" in your Android phone. Do you wonder what's that ?

Following is the way to backup your Android phone and it will answer all your above questions.

1). You need to have "adb" tool in your system. If you don't know what's this, then simply install Android SDK in your system by following procedure on developer.android.com. If you don't want to install whole SDK then just search for adb on google and just download single file for adb.

2). Once USB debugging is on, connect your phone to your PC. Go to the directory where "adb" is placed. Now on the command prompt or terminal write command "adb devices" (for Linux "./adb devices"). The output of the command should list your device with its serial number. If device is not listed then go here and do the settings needed for your device.

3). Now once your device is listed in "adb devices", give command " adb backup -apk -shared -all" (For Linux "./adb.."). This command will ask for confirmation on your phone. Give confirmation and password if you want to encrypt backup file on your phone screen. This will backup everything on your phone including data on your memory card. In your current directory backup.ab file will be created. Keep it safe.

4). When you want to restore your backup after factory reset of your phone, connect your phone and give command "adb restore <your backupfile location>". You will need to provide password on screen of phone if backup file is encrypted. Now wait till command completes its task and you have prompt available again.

That's it. You have your data back again. Enjoy !

Let me know if you have any problems.

Tuesday, September 3, 2013

Flashing Galaxy Nexus with Android 4.3

In this post I will let you know how to flash your Galaxy Nexus having device type "maguro" and yakju** build of Android OS, with latest Android 4.3 factory image provided by Google. (Disclaimer: I have flashed my own phone in the following described way. However do the procedure at your own risk. Don't blame me if you brick your phone.)

1). First of all check that your Galaxy Nexus has device type "maguro" and OS build name "yakju**". You can know this with Android app Android Info under section Software. You can download at https://play.google.com/store/apps/details?id=Android.Info

2). Now you need to have "adb" and "fastboot" tool in your system. If you don't know what's this, then simply install Android SDK in your system by following procedure on developer.android.com

3). Once you have installed "adb" and "fastboot", download the Android 4.3 factory image "yakju" for Galaxy Nexus "maguro" from here.

4). Now open the command prompt (in windows) or Terminal (in Linux). Write "adb" and press enter. It should not give you message like "No such command". Similarly enter "fastboot" and press enter. It also should not give message like "No such command". If both adb and fastboot are working fine its time to move ahead.

5). Now extract the factory image downloaded in step 3.

6). Turn USB debugging on in your Galaxy Nexus. Go to Settings and then Developer options and turn on USB debugging. If you are not able to see the Developer options then go to "About Phone" in Settings and press on Build number 7 times. After that you will be able to see the Developer options.

7). Once USB debugging is on, connect your phone to your PC. Now on the command prompt or terminal write command "adb devices". The output of the command should list your device with its serial number. If device is not listed then go here and do the settings needed for your device.

8). Once device is listed in output of "adb devices" command, go to the extracted factory image directory in command prompt or terminal.

9). First you need to unlock your boot loader. So first reboot your phone into boot loader by giving command "adb reboot bootloader". You can see on the phone the bootloader screen. Now give command "fastboot oem unlock". This command will unlock the bootloader. A confirmation dialogue will be shown on phone screen. To select Yes, drag with volume up and down button and press power button to select. When you press Yes, it will again reboot the phone and the bootloader screen will be shown again.

10). Now you are in the directory of extracted factory image. In the directory you can see file named flash-all.bat, flash-all.sh and others.

11). Windows users execute the flash-all.bat file by simple entering "flash-all.bat" on command prompt and then press enter. Linux users execute the flash-all.sh file by writing "./flash-all.sh" on terminal and then press enter. Make sure you are in the directory of extracted factory image.

12). Now wait till script flashes factory image on your phone. Don't unplug phone. Once all is done, you phone will reboot with new Android 4.3. Enjoy !

13). Once your phone is up, you can lock your boot loader again. To do so, enable USB debugging on phone, connect to PC, and give command "adb reboot bootloader". Once boot loader screen is shown on phone, give command "fastboot oem lock". Your phone is lock and secure again. Enjoy once more !


Let me know if you face some problem in this.