Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,785,512 Members 42,425 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE][CAM] How To Hack SONY Xperia Camera (Bring Higher Bitrate & More Options)

Tip us?
 
Rizal Lovins
Old
(Last edited by Rizal Lovins; 15th April 2014 at 06:00 AM.)
#1  
Rizal Lovins's Avatar
Recognized Developer / Recognized Themer / Recognized Contributor - OP
Thanks Meter 14,747
Posts: 1,453
Join Date: May 2012
Location: Bandung - One ring to rule them all, one ring to find them, one ring to bring them all
Default [GUIDE][CAM] How To Hack SONY Xperia Camera (Bring Higher Bitrate & More Options)

Hello Xperia friends....

from the beginning until now SONY give us bad software camera compared to others OEM


I want to show you how to hack All Xperia Camera

Requirement :

Knowladge in decompile/recompile apps


Hacking Audio Bitrate Video Recording
INFO for smali code

Value 0
Name: LowRate
Type: REG_DWORD
Data: 0x1f400 (SONY use this low bitrate so find this code to replace in the next step)

Value 1
Name: MediumRate
Type: REG_DWORD
Data: 0x2ee00

Value 2
Name: MediumHighRate
Type: REG_DWORD
Data: 0x3e800 (i'm use this code)

Value 3
Name: HighRate
Type: REG_DWORD
Data: 0x4e200
1. Decompile SemcCameraUI.apk
2. Go to smali/com/sonyericsson/android/camera

open Constants.smali using text editor/notepad++ then find this line
Code:
.field public static final VIDEO_AUDIO_BIT_RATE:I = 0x1f400
change RED Color code to code from INFO CODE, example :
Code:
.field public static final VIDEO_AUDIO_BIT_RATE:I = 0x3e800
save it!!!!

3. Go to smali/com/sonyericsson/android/camera/configuration/parameters

open VideoSize$VideoProfile$Builder.smali ( if there smali available, i mean different Xperia have diffierent parameters like older Xperia 2011)

search this code
Code:
0x1f400
then change to
Code:
0x3e800
save it!!!

4. Go to smali/com/sonyericsson/android/camera/configuration/parameters

open VideoSize.smali

search all this code
Code:
0x1f400
then change all code to
Code:
0x3e800
save it!!! Done


LAG ON VIDEO RECORDING ON XPERIA 2011 & XPERIA 2012 (Snapdragon S3/Novathor)???

Here is solution change FORMAT H264 to MPEG4!!!
INFO H264 VS MPEG4
http://www.y-cam.com/blog/mpeg4-vs-h-264-45/

Smali code

H263 is
Code:
0x1
H264 is
Code:
0x2
MPEG4 is
Code:
0x3
1. Go to smali/com/sonyericsson/android/camera/configuration/parameters

open VideoSize.smali using text editor/notepad++ then find this line

(Note the Local maybe different)
Code:
.local v7, "videoFrameRate":I
const/4 v6, 0x2
change to

Code:
.local v7, "videoFrameRate":I
const/4 v6, 0x3
Save it!!! Done


Closer to me? everything about me and my work!!!
DON'T PM me for any question regarding my work, please post in specific thread, anyone can help you, I WON'T respond
Lead Developer of LOVINS DEV : The 2 Brothers - Rizal Lovins & ibanez7
The Following 60 Users Say Thank You to Rizal Lovins For This Useful Post: [ Click to Expand ]
 
Rizal Lovins
Old
(Last edited by Rizal Lovins; 15th April 2014 at 05:59 AM.)
#2  
Rizal Lovins's Avatar
Recognized Developer / Recognized Themer / Recognized Contributor - OP
Thanks Meter 14,747
Posts: 1,453
Join Date: May 2012
Location: Bandung - One ring to rule them all, one ring to find them, one ring to bring them all
Hacking Video Recording Bitrate

INFO for smali code
Value 1
Name: MediumRate
Data: 0xb71b00

Value 2
Name: MediumHighRate
Data: 0x10b0760

Value 3
Name: HighRate
Data: 0x1c9c380

1. Go to smali/com/sonyericsson/android/camera

open Constants.smali using text editor/notepad++ then find this line

For HD 720p
Code:
.field public static final VIDEO_BIT_RATE_EX_HIGH_12M:I = 0xb71b00
change to
Code:
.field public static final VIDEO_BIT_RATE_EX_HIGH_12M:I = 0x10b0760
For FULL HD 1080p
Code:
.field public static final VIDEO_BIT_RATE_EX_HIGH_17_5M:I = 0x10b0760
change to
Code:
.field public static final VIDEO_BIT_RATE_EX_HIGH_17_5M:I = 0x1c9c380
save it!!!

2. Go to smali/com/sonyericsson/android/camera/configuration/parameters

open VideoSize.smali the find this line

For HD 720p
Code:
0xb71b00
change to
Code:
0x10b0760
For FULL HD 1080p
Code:
0x10b0760
change that all code to
Code:
0x1c9c380
save it!!! Done

NOW AFTER EDITING VIDEO AUDIO BITRATE & VIDEO BITRATE YOU NEED TO EDIT media_profile.xml

open media_profile.xml using text editor/notepad++ thenfind this line

FIX 100% Image Quality
Code:
<!ATTLIST ImageEncoding quality (90|80|70|60|50|40) #REQUIRED>
change to
Code:
<!ATTLIST ImageEncoding quality (100|90|80|70|60|50) #REQUIRED>
There is 2 lines code for back camera & front camera

Code:
<ImageEncoding quality="95" />
<ImageEncoding quality="80" />
<ImageEncoding quality="70" />
change all code to
Code:
<ImageEncoding quality="100" />
<ImageEncoding quality="90" />
<ImageEncoding quality="80" />

Adjust the value of smali Video & Audio Video bitrate with media-profile.xml (as you modified it)

There is many lines code for Video you need to change them all, example

Code:
        <EncoderProfile quality="1080p" fileFormat="mp4" duration="60">
            <Video codec="h264"
                   bitRate="17500000"
                   width="1920"
                   height="1080"
                   frameRate="30" />

            <Audio codec="aac"
                   bitRate="156000"
                   sampleRate="48000"
                   channels="2" />
        </EncoderProfile>

        <EncoderProfile quality="720p" fileFormat="mp4" duration="60">
            <Video codec="h264"
                   bitRate="12000000"
                   width="1280"
                   height="720"
                   frameRate="30" />

            <Audio codec="aac"
                   bitRate="156000"
                   sampleRate="48000"
                   channels="2" />
        </EncoderProfile>
change to

Code:
        <EncoderProfile quality="1080p" fileFormat="mp4" duration="60">
            <Video codec="h264"
                   bitRate="20000000"
                   width="1920"
                   height="1080"
                   frameRate="30" />

            <Audio codec="aac"
                   bitRate="256000"
                   sampleRate="48000"
                   channels="2" />
        </EncoderProfile>

        <EncoderProfile quality="720p" fileFormat="mp4" duration="60">
            <Video codec="h264"
                   bitRate="1750000"
                   width="1280"
                   height="720"
                   frameRate="30" />

            <Audio codec="aac"
                   bitRate="256000"
                   sampleRate="48000"
                   channels="2" />
        </EncoderProfile>
Code:
    <VideoEncoderCap name="h264" enabled="true"
        minBitRate="64000" maxBitRate="20000000"
        minFrameWidth="176" maxFrameWidth="1920"
        minFrameHeight="144" maxFrameHeight="1080"
        minFrameRate="15" maxFrameRate="30" />
Code:
    <AudioEncoderCap name="aac" enabled="true"
        minBitRate="8000" maxBitRate="256000"
        minSampleRate="8000" maxSampleRate="48000"
        minChannels="1" maxChannels="2" />
Note maxChannels Number in RED Color, can be 6 or 2


Closer to me? everything about me and my work!!!
DON'T PM me for any question regarding my work, please post in specific thread, anyone can help you, I WON'T respond
Lead Developer of LOVINS DEV : The 2 Brothers - Rizal Lovins & ibanez7
The Following 27 Users Say Thank You to Rizal Lovins For This Useful Post: [ Click to Expand ]
 
Rizal Lovins
Old
(Last edited by Rizal Lovins; 15th April 2014 at 05:20 AM.)
#3  
Rizal Lovins's Avatar
Recognized Developer / Recognized Themer / Recognized Contributor - OP
Thanks Meter 14,747
Posts: 1,453
Join Date: May 2012
Location: Bandung - One ring to rule them all, one ring to find them, one ring to bring them all
EXperimental hacking, Change format RGB_565 to ARGB8888

I use ONLY on Xperia 2011

1. Go to smali/com/sonyericsson/android/camera

open CameraActivity.smali using text editor/notepad++ then find this line

Code:
sget-object v12, Landroid/graphics/Bitmap$Config;->RGB_565:Landroid/graphics/Bitmap$Config;
Code:
sget-object v0, Landroid/graphics/Bitmap$Config;->RGB_565:Landroid/graphics/Bitmap$Config;
Change RED Color code to

Code:
ARGB_8888
2. Go to smali/com/sonyericsson/android/camera

open ImageManager.smali then search for RGB example :
Code:
sget-object v0, Landroid/graphics/Bitmap$Config;->RGB_565:Landroid/graphics/Bitmap$Config;
change all code to
Code:
sget-object v0, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;
3. Go to smali/com/sonyericsson/android/camera/device

open CameraExtensionValues.smali then search for RGB example :
Code:
.field public static final POSTVIEW_FORMAT_RGB565:Ljava/lang/String; = "rgb565"
change to

Code:
.field public static final POSTVIEW_FORMAT_RGB565:Ljava/lang/String; = "argb8888"
save it!!!

Enable inPreferQualityOverSpeed (I Use ONLY on Xperia 2011)

1. Go to smali/com/sonyericsson/android/camera

open CameraActivity.smali

Code:
.local v11, opt:Landroid/graphics/BitmapFactory$Options;
sget-object v15, Landroid/graphics/Bitmap$Config;->RGB_565:Landroid/graphics/Bitmap$Config;

iput-boolean v6, v11, Landroid/graphics/BitmapFactory$Options;->inPreferQualityOverSpeed:Z

iput-object v15, v11, Landroid/graphics/BitmapFactory$Options;->inPreferredConfig:Landroid/graphics/Bitmap$Config;
Look for RED Color it's should be like this
Code:

.local v11, opt:Landroid/graphics/BitmapFactory$Options;
const/4 v6, 0x1
iput-boolean v6, v11, Landroid/graphics/BitmapFactory$Options;->inPreferQualityOverSpeed:Z

iput-boolean v6, v11, Landroid/graphics/BitmapFactory$Options;->inDither:Z

sget-object v15, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;

iput-object v15, v11, Landroid/graphics/BitmapFactory$Options;->inPreferredConfig:Landroid/graphics/Bitmap$Config;


Closer to me? everything about me and my work!!!
DON'T PM me for any question regarding my work, please post in specific thread, anyone can help you, I WON'T respond
Lead Developer of LOVINS DEV : The 2 Brothers - Rizal Lovins & ibanez7
The Following 24 Users Say Thank You to Rizal Lovins For This Useful Post: [ Click to Expand ]
 
Rizal Lovins
Old
(Last edited by Rizal Lovins; 15th April 2014 at 04:35 AM.)
#4  
Rizal Lovins's Avatar
Recognized Developer / Recognized Themer / Recognized Contributor - OP
Thanks Meter 14,747
Posts: 1,453
Join Date: May 2012
Location: Bandung - One ring to rule them all, one ring to find them, one ring to bring them all
Hacking Camera Resolution/MP (More Options)

More Options for Photo (Only work for Xperia 2011 & 2012 Snapdragon S3/Novathor)

For Xperia 2012 Snapdragon S4 and 2013/2014 doesn't work, need to be removing some code in smali, i'm still looking for it

1. Go to res/value

open arrays.xml using text editor/notepad++ then find this line

For 12MP Camera
Code:
<string-array name="ux_recommended_resolution_array_main_12m">
     <item>TWELVE_MP</item>
     <item>NINE_MP</item>
     <item>TWO_MP</item>
     <item>TWO_MP_WIDE</item>
add others line
Code:
<string-array name="ux_recommended_resolution_array_main_12m">
        <item>TWELVE_MP</item>
        <item>NINE_MP</item>
	<item>EIGHT_MP</item>
	<item>FIVE_MP</item>
	<item>THREE_MP_WIDE</item>
        <item>TWO_MP</item>
        <item>TWO_MP_WIDE</item>
For 8MP Camera
Code:
<string-array name="ux_recommended_resolution_array_main_8m">
     <item>EIGHT_MP</item>
     <item>SIX_MP</item>
     <item>TWO_MP</item>
     <item>TWO_MP_WIDE</item>
add others line
Code:
<string-array name="ux_recommended_resolution_array_main_8m">
     <item>EIGHT_MP</item>
     <item>SIX_MP</item>
     <item>FIVE_MP</item>
     <item>THREE_MP</item>
     <item>TWO_MP</item>
     <item>TWO_MP_WIDE</item>

More Options for Video (Work for all Xperia)

1. Go to res/value

open arrays.xml using text editor/notepad++ then find this line

For 20MP Camera
Code:
<string-array name="ux_recommended_video_size_array_main_20m">
     <item>FULL_HD</item>
     <item>HD</item>
     <item>MMS</item>
add others line
Code:
<string-array name="ux_recommended_video_size_array_main_20m">
     <item>FULL_HD</item>
     <item>HD</item>
     <item>FWVGA</item>
     <item>VGA</item>
     <item>QVGA</item>
     <item>MMS</item>
For 13MP Camera
Code:
<string-array name="ux_recommended_video_size_array_main_13m">
     <item>FULL_HD</item>
     <item>HD</item>
     <item>MMS</item>
add others line
Code:
<string-array name="ux_recommended_video_size_array_main_13m">
     <item>FULL_HD</item>
     <item>HD</item>
     <item>FWVGA</item>
     <item>VGA</item>
     <item>QVGA</item>
     <item>MMS</item>
For 12MP Camera
Code:
<string-array name="ux_recommended_video_size_array_main_12m">
     <item>FULL_HD</item>
     <item>HD</item>
     <item>MMS</item>
add others line
Code:
<string-array name="ux_recommended_video_size_array_main_12m">
     <item>FULL_HD</item>
     <item>HD</item>
     <item>FWVGA</item>
     <item>VGA</item>
     <item>QVGA</item>
     <item>MMS</item>
For 8MP Camera FULL HD 1080p
Code:
<string-array name="ux_recommended_video_size_array_main_8m_full_hd">
     <item>FULL_HD</item>
     <item>HD</item>
     <item>MMS</item>
add others line
Code:
<string-array name="ux_recommended_video_size_array_main_8m_full_hd">
     <item>FULL_HD</item>
     <item>HD</item>
     <item>FWVGA</item>
     <item>VGA</item>
     <item>QVGA</item>
     <item>MMS</item>
For 8MP Camera HD 720p
Code:
<string-array name="ux_recommended_video_size_array_main_8m_hd">
     <item>HD</item>
     <item>FWVGA</item>
     <item>QVGA</item>
     <item>MMS</item>
add others line
Code:
<string-array name="ux_recommended_video_size_array_main_8m_hd">
     <item>HD</item>
     <item>FWVGA</item>
     <item>VGA</item>
     <item>QVGA</item>
     <item>MMS</item>
For 5MP Camera HD 720p
Code:
<string-array name="ux_recommended_video_size_array_main_5m_fwvga">
     <item>HD</item>
     <item>FWVGA</item>
     <item>QVGA</item>
     <item>MMS</item>
add others line
Code:
<string-array name="ux_recommended_video_size_array_main_5m_fwvga">
     <item>HD</item>
     <item>FWVGA</item>
     <item>VGA</item>
     <item>QVGA</item>
     <item>MMS</item>
Save it!!!


Closer to me? everything about me and my work!!!
DON'T PM me for any question regarding my work, please post in specific thread, anyone can help you, I WON'T respond
Lead Developer of LOVINS DEV : The 2 Brothers - Rizal Lovins & ibanez7
The Following 28 Users Say Thank You to Rizal Lovins For This Useful Post: [ Click to Expand ]
 
Rizal Lovins
Old
(Last edited by Rizal Lovins; 15th April 2014 at 04:52 AM.)
#5  
Rizal Lovins's Avatar
Recognized Developer / Recognized Themer / Recognized Contributor - OP
Thanks Meter 14,747
Posts: 1,453
Join Date: May 2012
Location: Bandung - One ring to rule them all, one ring to find them, one ring to bring them all
Enable 12MP Superior Auto on Jelly Bean 4.3

How to Install :

- Download the file in attachment
- Copy to system with root explorer etc
- Set permissions to 644 (rw-r--r--)
- Move the file to system>vendor>overlay
- Reboot
- After boot go to settings>apps>all
- Clear data Camera & try open camera app


NOTE : for some device need to rename the apk to android-res.apk and replace the original if is there

Enjoy


Credits :
Thanks to SONY Mobile that made all this possible
Thanks to my old friend @Xperia-Ray for helping me from beginning
Attached Files
File Type: apk com.sonyericsson.android.camera-res.apk - [Click for QR Code] (3.2 KB, 217 views)


Closer to me? everything about me and my work!!!
DON'T PM me for any question regarding my work, please post in specific thread, anyone can help you, I WON'T respond
Lead Developer of LOVINS DEV : The 2 Brothers - Rizal Lovins & ibanez7
The Following 22 Users Say Thank You to Rizal Lovins For This Useful Post: [ Click to Expand ]
 
poria1999
Old
#6  
poria1999's Avatar
Senior Member
Thanks Meter 453
Posts: 342
Join Date: Feb 2013
Location: Tehran
Nice guide man!
Will try it

Sent from my LT18i using Tapatalk 2
Experience The Awesomeness


The Following 2 Users Say Thank You to poria1999 For This Useful Post: [ Click to Expand ]
 
devilmaycry2020
Old
#7  
devilmaycry2020's Avatar
Senior Member
Thanks Meter 122
Posts: 757
Join Date: Apr 2013
Thanks,this guide change audio bitrate only,how about video bitrate?
Click the "Thanks" button if I've helped you
 
cuatzstress
Old
#8  
cuatzstress's Avatar
Senior Member
Thanks Meter 73
Posts: 150
Join Date: Sep 2012
Location: you tell me
Nuhun kang, I'll try ur guide, anyway how to change the photo quality? Is it same method?

Sent from my C1905 using XDA Premium 4 mobile app
 
xperiaz2
Old
#9  
xperiaz2's Avatar
Recognized Themer
Thanks Meter 3,666
Posts: 452
Join Date: Oct 2013
Default wow

awesome guide bro very nice
The Following User Says Thank You to xperiaz2 For This Useful Post: [ Click to Expand ]
 
ramkrsn
Old
#10  
Senior Member
Thanks Meter 75
Posts: 220
Join Date: Oct 2010
Location: Mumbai
Thumbs up It WOKS..... :)

thank you it does work for decompile and recompile of the apk iused this tool


http://forum.xda-developers.com/show....php?t=2326604

awesome....

The Following User Says Thank You to ramkrsn For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes