Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,809,359 Members 40,652 Now Online
XDA Developers Android and Mobile Development Forum

[MOD] Video Bitrate Control (20-50mbps vs 10mbps stock) **NOW with demo link***

Tip us?
 
CouttsPhotog
Old
(Last edited by CouttsPhotog; 8th January 2012 at 06:53 PM.)
#1  
Member - OP
Thanks Meter 25
Posts: 50
Join Date: Feb 2011
Default [MOD] Video Bitrate Control (20-50mbps vs 10mbps stock) **NOW with demo link***

I was tinkering with media_profiles.xml yesterday and it appears that modifying the bitrate settings in here affects the camera. The stock bitrate min/max values are:

min: 64000
max: 12000000

Videos shot with these settings are usually 6-10mbps bitrate. I have changed these values to:

min: 35000000
max: 60000000

And my videos are now between 20mbps and 50mbps (huge leap!). The file sizes are bigger but I'm assuming this has to mean the videos will be somewhat better quality (my guess is mostly in low light when the ISO is cranked higher). I don't understand very well how these values are all used in here, but adjusting the bitrate ones does make a difference. Although framerate for 1080p says 30 here, they always come off camera at 24fps so I'm not sure if framerate (or any other changes) will work here.


Any value higher than 60000000 for the max will cause the camera app to crash, so I think this is a good max for now. This mod has been done on countless other devices, so I'm in no way discovering anything new, I just decided to poke around and see what changes work


Here's some more details for what to modify (to apply this mod to 720p and 1080p):

Starting at line 127:
Code:
        <EncoderProfile quality="720p" fileFormat="mp4" duration="30">
            <Video codec="h264"
                   bitRate="60000000"
                   width="1280"
                   height="720"
                   frameRate="30" />
            <Audio codec="aac"
                   bitRate="96000"
                   sampleRate="48000"
                   channels="1" />
        </EncoderProfile>

        <EncoderProfile quality="1080p" fileFormat="mp4" duration="30">
            <Video codec="h264"
                   bitRate="60000000"
                   width="1920"
                   height="1080"
                   frameRate="30" />
            <Audio codec="aac"
                   bitRate="96000"
                   sampleRate="48000"
                   channels="1" />
        </EncoderProfile>
And one other spot, line 340:
Code:
    <VideoEncoderCap name="h264" enabled="true"
        minBitRate="35000000" maxBitRate="60000000"
        minFrameWidth="176" maxFrameWidth="1920"
        minFrameHeight="144" maxFrameHeight="1080"
        minFrameRate="15" maxFrameRate="30" />


Additional mod:
People have claimed on other devices changing this setting produces higher quality images from the camera, starting at line 216:
Code:
        <ImageEncoding quality="100" />
        <ImageEncoding quality="80" />
        <ImageEncoding quality="70" />
        <ImageDecoding memCap="20000000" />




Steps to apply the mod:
1) have ADB setup and working (not explaining that here, plenty of other threads for this)
2) cd to some directory to work in (I just use the desktop), ensure ADB is in your path (google that part)
3)
Code:
adb pull /etc/media_profiles.xml .
to pull the media_profiles.xml file to whatever folder you're in with the terminal.
4) Make your modifications, save the file (maybe keep a backup of the original file if you want).
--- workaround because adb remount doesn't work] ---
5)
Code:
adb push media_profiles.xml /sdcard/download
6) Use root explorer to move the media_profiles.xml file from your downloads folder to the /etc folder (make sure to mount /etc as R/W before you try to move).
7) Reboot phone, all set!

EDIT
- or just use Root Explorer (available in the market) to do the changes, reboot the phone and you're done!


edit
Demo video shot at 45mbps:
http://www.youtube.com/watch?v=J2r6zPYlRD0

http://www.youtube.com/watch?v=XCbNs1hEEjU


Hope somebody else finds this as useful as me!
The Following 8 Users Say Thank You to CouttsPhotog For This Useful Post: [ Click to Expand ]
 
Mach3te
Old
#2  
Mach3te's Avatar
Member
Thanks Meter 4
Posts: 72
Join Date: May 2008
Location: Connecticut
Any way this can be packaged up into a CWM flashable zip file to make it easier on those who are not familiar with using ADB?
Galaxy Nexus (CDMA/LTE)
Rooted/Unlocked
The Following User Says Thank You to Mach3te For This Useful Post: [ Click to Expand ]
 
birkholze
Old
#3  
Member
Thanks Meter 25
Posts: 65
Join Date: Jan 2009
Location: Clyde
Quote:
Originally Posted by Mach3te View Post
Any way this can be packaged up into a CWM flashable zip file to make it easier on those who are not familiar with using ADB?
Second this. I tend to surf XDA for and apply mods like this while on the toilet at work.

Sent from my Galaxy Nexus using Tapatalk
The Following 17 Users Say Thank You to birkholze For This Useful Post: [ Click to Expand ]
 
kichard
Old
#4  
Senior Member
Thanks Meter 15
Posts: 235
Join Date: May 2011
Location: State College, PA
Quote:
Originally Posted by birkholze View Post
Second this. I tend to surf XDA for and apply mods like this while on the toilet at work.

Sent from my Galaxy Nexus using Tapatalk
Best time for m0dz. Please zip


Sent from my Galaxy Nexus using XDA App
 
fiveoh
Old
#5  
Member
Thanks Meter 0
Posts: 51
Join Date: Aug 2010
You can also use soemthing like Root Explorer to make these changes directly on the phone.

Change the directory to R/W
Long press on the file and when the menu pops up, select Open with Text editor.

Make your changes

Save and exit.

Make sure the permissions are RW R R

Pull the battery and reboot.
 
kjwalker
Old
#6  
Senior Member
Thanks Meter 39
Posts: 128
Join Date: Feb 2010
Quote:
Originally Posted by birkholze View Post
Second this. I tend to surf XDA for and apply mods like this while on the toilet at work.

Sent from my Galaxy Nexus using Tapatalk
This man knows what's up. Especially since I'm on the toilet right now

Sent from my Galaxy Nexus using xda premium
Phone: OG Droid (CM7) >> Galaxy Nexus (ParanoidAndroid, franco.Kernel)
Tablet: Kindle Fire (ParanoidAndroid)
The Following 5 Users Say Thank You to kjwalker For This Useful Post: [ Click to Expand ]
 
deyna
Old
#7  
deyna's Avatar
Member
Thanks Meter 9
Posts: 94
Join Date: Dec 2010
Location: Hernando, MS
Quote:
Originally Posted by kjwalker View Post
This man knows what's up. Especially since I'm on the toilet right now

Sent from my Galaxy Nexus using xda premium
[OT]now I'm wondering if I should be too[/OT]

Have you tried taking two videos that are as close to identical as possible, one with the stock settings and the other with the mod? That would show if it effects the quality at all.
 
C.Hatfield
Old
#8  
C.Hatfield's Avatar
Senior Member
Thanks Meter 131
Posts: 720
Join Date: Oct 2010
Location: Too FAR East
Default Root Explorer Method

I just used the 'RE' method and it worked just fine [MAKE SURE TO TOGGLE RW, LONG-PRESS ON FILE, OPEN IN TEXT EDITOR, MAKE MOD's (BE CAREFUL TO MAKE SURE YOU'RE MOD'ing EXACTLY WHAT'S IN THE OP !!) THEN SAVE CHANGES & EXIT > AFTER THAT, HOPEFULLY WE PROFIT

... however, I cannot comment on the difference the modifications have made. If the OP is correct in his research, then I can't see why this MOD wouldn't be a PLUS !
BTW, Just to be SAFE, I moved a copy of my unmodified media_profiles.xml to my sdcard ... 'RE' will automatically create a .bak file when changes are made, but im extra cautious when modifying certain system files that I haven't dealt with before .... better safe than sorry, they say
The Following User Says Thank You to C.Hatfield For This Useful Post: [ Click to Expand ]
 
CouttsPhotog
Old
(Last edited by CouttsPhotog; 8th January 2012 at 03:34 PM.)
#9  
Member - OP
Thanks Meter 25
Posts: 50
Join Date: Feb 2011
Glad to see some replies!

I haven't done an exact side by side test yet, but typically higher bitrate will produce better quality gradients in videos (things like smoke, color changes in walls, etc) and should be especially noticeable in low light video where the ISO is very high.

I got the idea because I was a developer of Magic Lantern for a while this past year, and one of the great features it adds to canon dslr cameras is the ability to raise the bitrate (from 25mbps or so up to almost 80mbps), and makes a huge difference in quality.

Generally things with high complexity cause it to shoot at a higher bitrate as well (since it is a variable bitrate, it changes). Examples would be trees with lots of tree branches and stuff.

I'll try to get a comparison up later this week, I'm still waiting for my macbook pro to be shipped back from applecare.




---
I just shot a video walking around outside and it ended up being 45mbps. I can't upload though, youtube is having some issues.. will try again later today and post it here.
The Following User Says Thank You to CouttsPhotog For This Useful Post: [ Click to Expand ]
 
jamdev12
Old
#10  
Member
Thanks Meter 4
Posts: 30
Join Date: Nov 2010
Quote:
Originally Posted by CouttsPhotog View Post
Glad to see some replies!

I haven't done an exact side by side test yet, but typically higher bitrate will produce better quality gradients in videos (things like smoke, color changes in walls, etc) and should be especially noticeable in low light video where the ISO is very high.

I got the idea because I was a developer of Magic Lantern for a while this past year, and one of the great features it adds to canon dslr cameras is the ability to raise the bitrate (from 25mbps or so up to almost 80mbps), and makes a huge difference in quality.

Generally things with high complexity cause it to shoot at a higher bitrate as well (since it is a variable bitrate, it changes). Examples would be trees with lots of tree branches and stuff.

I'll try to get a comparison up later this week, I'm still waiting for my macbook pro to be shipped back from applecare.




---
I just shot a video walking around outside and it ended up being 45mbps. I can't upload though, youtube is having some issues.. will try again later today and post it here.
Thanks for the MOD. Since I like modding as well, I've put this into Axi0m2.3 and saved as a personal Clockwork image. Only thing that I notice is that since my sdcard file system is fat32, I can only capture about 5 minutes worth of video. I'll have to check out the difference as well and either format my sdcard ext4 or disable the mod.

Thanks again for the tweaks.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes