Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP CouttsPhotog

6th January 2012, 02:49 PM   |  #1  
OP Member
Thanks Meter: 25
 
50 posts
Join Date:Joined: Feb 2011
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!
Last edited by CouttsPhotog; 8th January 2012 at 07:53 PM.
The Following 8 Users Say Thank You to CouttsPhotog For This Useful Post: [ View ]
6th January 2012, 07:42 PM   |  #2  
Mach3te's Avatar
Member
Flag Connecticut
Thanks Meter: 4
 
72 posts
Join Date:Joined: May 2008
More
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?
The Following User Says Thank You to Mach3te For This Useful Post: [ View ]
6th January 2012, 08:15 PM   |  #3  
Member
Flag Clyde
Thanks Meter: 25
 
65 posts
Join Date:Joined: Jan 2009
More
Quote:
Originally Posted by Mach3te

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: [ View ]
6th January 2012, 08:19 PM   |  #4  
Senior Member
Flag State College, PA
Thanks Meter: 15
 
235 posts
Join Date:Joined: May 2011
More
Quote:
Originally Posted by birkholze

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
6th January 2012, 09:00 PM   |  #5  
Member
Thanks Meter: 0
 
51 posts
Join Date:Joined: 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.
6th January 2012, 10:36 PM   |  #6  
Senior Member
Thanks Meter: 40
 
131 posts
Join Date:Joined: Feb 2010
More
Quote:
Originally Posted by birkholze

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
The Following 5 Users Say Thank You to kjwalker For This Useful Post: [ View ]
6th January 2012, 10:47 PM   |  #7  
deyna's Avatar
Member
Flag Hernando, MS
Thanks Meter: 9
 
94 posts
Join Date:Joined: Dec 2010
More
Quote:
Originally Posted by kjwalker

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.
7th January 2012, 09:05 AM   |  #8  
C.Hatfield's Avatar
Senior Member
Flag Too FAR East
Thanks Meter: 132
 
724 posts
Join Date:Joined: Oct 2010
More
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: [ View ]
8th January 2012, 04:12 PM   |  #9  
OP Member
Thanks Meter: 25
 
50 posts
Join Date:Joined: 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.
Last edited by CouttsPhotog; 8th January 2012 at 04:34 PM.
The Following User Says Thank You to CouttsPhotog For This Useful Post: [ View ]
8th January 2012, 05:12 PM   |  #10  
Member
Thanks Meter: 4
 
30 posts
Join Date:Joined: Nov 2010
Quote:
Originally Posted by CouttsPhotog

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.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes