yashsingh1/xdaforums huggingface dataset:
[Nexus 4 Android Development] Audioboxer:
I was trying to edit the file so that it would take pictures with less compression as well (changing image encoding settings). Must of messed up there.

Will wait to see if you can release future mods with better image encoding as well :highfive:
[Nexus 4 Android Development] MariusWildfire:
just for 1080p ? isnt it possible for 720p mode aswell? i'm using the 720p mode very often compared to 1080..
[Nexus 4 Android Development] AcmE85:
Sure, just change the value accordingly and you are good to go. I just modified and flashed the file myself.
[Nexus 4 Android Development] 0.0:
What values did you use for 720p?

Sent from my Nexus 4
[Nexus 4 Android Development] AcmE85:
I chose 12mbit instead of 8 for 720p .

Audio 192kbits instead of 92 for 720p & 1080p.

But you can go up to 20mbit for 720p too.
[Nexus 4 Android Development] 0.0:
Do I change the bit rate and the sample rate? Or just the bit rate? Also, how about for 480p. Can I raise it to 20mbit?

The audio is actually 96000, not 92. Is that right?

So for audio, it will be 192000?

Sent from my Nexus 4
[Nexus 4 Android Development] AcmE85:
Only the bitrate. I think you can also change the value for 480p (not tested by me!), though there will be now gain in image quality if you ask me.

On this small resolution this bitrate should be way to high.

Just take a look at the xml in the zip I succesfully flashed.

720p @ 12mbit

1080p @ 20mbit

Audio both @ 192kbit/s

Changed values for photos

No problems so far.
[Nexus 4 Android Development] 0.0:
What about the front facing camera video? Could that be changed? Also, what about the audio for 480p, would it make a difference if I put it as 192kbits?

Sent from my Nexus 4
[Nexus 4 Android Development] AcmE85:
:eek: off to my girlfriend... :victory:
[Nexus 4 Android Development] mohit1234:
Yes the front camera values can also be changed. You just have to edit the values under <CamcorderProfiles cameraId="1">
[Nexus 4 Android Development] geokilla:
Don't have a Nexus 4 yet, but do you guys actually see a difference in terms of quality?
[Nexus 4 Android Development] fresh_TD:
Compared to what???

Sent from my Nexus 4
[Nexus 4 Android Development] geokilla:
Before and after the mod?
[Nexus 4 Android Development] m0h1t:
I used the .xml mod posted by somebody on the previous page.

I'm not noticing any difference on 720p. I'm comparing both versions on my desktop.
[Nexus 4 Android Development] 0.0:
Stereo mode for audio doesn't work. I tried changing the channel to "2" but it didn't do anything. It still said mono on my desktop

Sent from my Nexus 4
[Nexus 4 Android Development] mohit1234:
It does. You just have to change other values.

Here! :D

I'll add how to do it to the OP tomorrow. Just testing out some more audio mods.
[Nexus 4 Android Development] 0.0:
Does stereo really work though? Does it sound like stereo, or is it just mono with 2 channels? I was reading a couple of threads saying that even though it says stereo, its still mono

Also, stereo sound has better quality, in general, over mono right?

Sent from my Nexus 4
[Nexus 4 Android Development] mohit1234:
I can't say for sure whether or not it works like true stereo because there is a very small difference compared to setting it as mono. Probably could be a placebo.

If you want to try, scroll down further in the XML file and you will see somewhere written AudioEncoderCap. Change maxchannels to 2 for all of them. Then do the same edit what you did earlier.

Technically, our N4 may not record true stereo given that it has one microphone. It has another one at the top but afaik, that's used for noise cancelation.. then again, I may be wrong.

One could say that stereo has better quality than mono however its more like this. In stereo if there's a guy talking and walking from left to right, you can feel him moving from left to right because of the sound. It's like if you have headphones on you can hear his voice getting louder in one ear and softer in the other as he moves. In mono irrespective of his position, he sounds the same.
[Nexus 4 Android Development] 0.0:
Hmmm...perhaps I should keep it in mono then, since stereo doesn't really do much

Sent from my Nexus 4
[Nexus 4 Android Development] mohit1234:
If you want, you could try changing it and see if you're getting any better results than me.
[Nexus 4 Android Development] 0.0:
i wouldnt really use stereo for videos. it's not really music or anything professional. but i would do it for the quality. eh, i guess i'll do it, even though its probably placebo since the n4 has only 1 mic

also, just like AudioEncoderCap to change channels, does the VideoEncoderCap need to be changed so that the maxBitRate can be 20000000 for 1080p?
[Nexus 4 Android Development] mohit1234:
I didn't change the VideoEncoderCap values but it still worked without modifying those values. Will test out video quality when changing both.
[Nexus 4 Android Development] gunnner:
Could anyone who has tried the fix have a shot at doing a before/after comparison?
[Nexus 4 Android Development] leets4uc3:
Is it a noticeable difference? If so i would def flash a zip everytime i flash a new ROM (dailyish)

This is cool ****. Thanks for putting in the testing and research guys!
[Nexus 4 Android Development] chachin:
@mohit1234: Do you think this mod would work on the LG Optimus G?
[Nexus 4 Android Development] rosswaa:
I'm loving the idea of this if it works

Has anyone made a side by side video to demonstrate the difference?
[Nexus 4 Android Development] mohit1234:
There is a small difference, makes it less pixelated (less noise).

Yes you can edit your media_profile.xml file and it will work. Editing the xml will work for all phones. Just don't flash the zip I've attached in the first post, I can't say for sure whether it would work on the Optimus G.

Someone has, although, his samples aren't really great. Nonetheless, here's the link.

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

Go to 2:51 to see the samples.
[Nexus 4 Android Development] Lockeskidney:
you need to be rooted to do this?
[Nexus 4 Android Development] 0.0:
Yes

Sent from my Nexus 4
[Nexus 4 Android Development] :
camera keep crashing

Hi everyone so I got into some trouble while doing this...

At first I edited the xml file using es file explorer,

But then that's when I realized my videos are extremely blurry and it won't focus at all. Also like someone earlier said, my camera keep force closing when I switch to the front facing camera.

I tried flashing the stock zip and also the modded one as well, buy it is still keep crashing.

I ran out of ideas to fix it, and my worst decision was not to make an nand back up, really hope someone can help me fix this issue.

Thanks
[Nexus 4 Android Development] mohit1234:
If you flash the stock zip it should fix any issues you are having.

Btw, you're on a Nexus 4, right?

Using that zip on any other device will not fix it. If on any other device, then you will have to get the same xml file from the ROM that you're using and place it in a flashable zip and flash it, or copy and paste it to the system/etc/ folder and set permissions to rw-r--r--.
[Nexus 4 Android Development] :
Yes I'm on a nexus 4

The error I've been getting is unfortunately the gallery has stopped
[Nexus 4 Android Development] mohit1234:
Hmm.. that's weird. Try flashing the stock zip again and then wipe only cache.

If that still doesn't work, your next bet would be to just flash over this the ROM that you are using. Don't wipe anything, just flash the ROM.
[Nexus 4 Android Development] Girn:
Anyway to increase picture quality??
[Nexus 4 Android Development] 0.0:
Look 3 pages back. It'll be within my conversation between me and this other user about it

Sent from my Nexus 4
[Nexus 4 Android Development] Chad_Petree:
So basically google dumbed down the quality of the camera so that videos wouldn't take all the space on the internal memory huh? :rolleyes:

Can someone share some before and after (mod) sample videos?

By the way i read in a couple of reviews that the camera has stero sound at 48 Hz was that a lie?

The stock bitrate from the 720p videos is 8 mbps and the framerate 30 fps?

So to summarize:

1. The video bitrate can go up to 20 Mbps (with 1080p) otherwise the camera crashes, but what about 720p can we set it to record with 20 mbps too?

2. If we increase the framerate to anything above 30 fps ( in 1080p) the camera crashes?

3.The best audio qulity we can get is 284k right? Which i think it could be just placebo effect, its just too much, is there a setting you can recommend? i have to be honest im still confused when people talk about audio bitrate and audio sample rate
[Nexus 4 Android Development] Alex0901:
Have anybody the live wallpaper from the Video?

Edit: i have found it on playstore.

Gesendet von meinem Nexus 4 mit Tapatalk 2
[Nexus 4 Android Development] :


Yeah I didn't want to flash another ROM on top of stock...

But eventually I did and it worked!

Thanks!
[Nexus 4 Android Development] Girn:
Read what I said again ;)
[Nexus 4 Android Development] danyasd:
Doesn't work for me. If I flash the zip (or move the file to /system/etc) the camera at video mode records in 352x288. There's no possibility to change that in the settings :( I'll try flashing back to stock.

@nexus 4 lastest Android 4.1.2

Edit: Even if I flash the Stock Camera, I can't record videos in another setting than 352x288. :( I made a nandroid backup before, but restoring the system partition has no affect to that problem. Very weird.
[Nexus 4 Android Development] cguru:
As far as i know the video from the camera is hardware encoded by the qualcomm chip. There are 3 different h264 profiles. Baseline, mainline and highline. The S4 pro chipset should be capable of all 3 standards. Currently baseline is used.

I think changing baseline to highline encoding should boost quality!
[Nexus 4 Android Development] KonstantinKeller:
Maybe you should tell us that it's called in case other users want it too o.o
[Nexus 4 Android Development] IAmAN00bie:
Hmm, you might be on to something. At the bottom of the media_profiles.xml file, it says that it uses Baseline and to change that you need to change it to the appropriate decimal number for highline, whatever that might be. It says in a comment right above that you can find those numbers in omx_video.h, but I can't seem to find that header file!
[Nexus 4 Android Development] PHenn:
I had this same problem after manually editing the xml file. The quality setting was completely gone and it made a .3gp video file. I have no idea if we missed something or what.
[Nexus 4 Android Development] eRajesh:
Damn! Time to ping some CM or advanced developers?

Did you guys check the audio_xxx files in the same folder? I think we can edit one of the files to change audio sampling from 48Khz to 44.1Khz
[Nexus 4 Android Development] ck2009:
I have the same issue too, trying to change perms, etc to fix it, but no luck yet :(

Edit: Wiping cache and setting perms to rw-r--r-- seems to have done the trick :)
[Nexus 4 Android Development] terr:
I found the .h file referred to in the XML but none of the values I tried did anything. I cant seem to get it off of baseline level 4.0. If anyone else wants to try the omx_video.h is:

http://src.chromium.org/svn/trunk/src/third_party/openmax/il/OMX_Video.h

It might not seem like it would be for Android but this is a 3rd party driver and these values are consistent with what is expected. If anyone figures it out I would love to increase the profile to high.
[Nexus 4 Android Development] 0.0:
hmmm...maybe you should actually try to find it. anyways, its right here: http://xdaforums.com/showpost.php?p=35363919&postcount=29
[Nexus 4 Android Development] Chad_Petree:
This is shaping up real nice :)
[Nexus 4 Android Development] a5ehren:
Going over level 4.0 isn't really necessary for our devices, as the levels only tell the maximum allowed data storage. We don't need to go up unless we figure out how to do 1080p60 (which requires level 4.2). High profile would bring some nice quality stuff - I'll dig into the S4 datasheets to see if their encoder block even supports it.

---------- Post added at 11:41 AM ---------- Previous post was at 10:44 AM ----------

Well, I think the hardware support is there, but I can't make it work with the stock camera app.
[Nexus 4 Android Development] cguru:
Yeah, as far as i know there is hardware support for this profile. I do not own a nexus4, therefore I can't try myself.

Changing this:

<ExportVideoProfile name="h264" profile= "1" level="2048"/>

to one of the following options:

<ExportVideoProfile name="h264" profile= "2" level="2048"/>

<ExportVideoProfile name="h264" profile= "4" level="2048"/>

<ExportVideoProfile name="h264" profile= "8" level="2048"/>

<ExportVideoProfile name="h264" profile= "16" level="2048"/>

<ExportVideoProfile name="h264" profile= "32" level="2048"/>

<ExportVideoProfile name="h264" profile= "64" level="2048"/>

does change something?
[Nexus 4 Android Development] a5ehren:
Not sure. My camera app is jacked up (crashes when I switch to front camera, can't choose video quality in settings wheel), so I'm flashing the latest gapps package to see if it helps (stock ROM/kernel, reverted media_profiles.xml). I know "8" is the one we want for high profile, but I don't know if it'll work.

Edit: GAPPS didn't fix it. Going nuclear and restoring to stock rooted ROM.
[Nexus 4 Android Development] a5ehren:
OK, setting the profile to "8" causes the video quality option to go away in the video recording menu. Gonna call this a dead end for now.
[Nexus 4 Android Development] IAmAN00bie:
I did all of those changes and none worked.

Sent from my Nexus 4
[Nexus 4 Android Development] terr:
I can't seem to find the datasheet for the S4. Can you post a link to it? I would like to see what it has.
[Nexus 4 Android Development] kalipedia:
Flashed the zip and confirmed the mod - so awesome - thanks!
[Nexus 4 Android Development] supercakefish:
Do you have to be rooted for this to work?
[Nexus 4 Android Development] IAmAN00bie:
Yes, you are replacing media_profiles.xml in /system/etc.
[Nexus 4 Android Development] wizshaw:
This is basically what we have so far.. I think..

So far. Image quality improvements. Some audio bit rates changes. 2 channel stereo. Some video bit rates and a possible encoding change. Doesn't seem to be much else. Now who wants to make the file?! :)
[Nexus 4 Android Development] 0.0:
has anyone been able to test out changing the VideoEncoderCap values and see if it makes a difference? idk which values to tamper with
[Nexus 4 Android Development] terr:
So I looked through the code and it looks like it checks with the camera driver if it supports AVC high profile level. I traced it to the point where it requests the info but I don't actually have it running with debug to find out. I will try to get debug output from my phone with the high profile set int he xml file and see if there is something missing.
[Nexus 4 Android Development] cguru:
Found these lines in libstagefright, eventually blocking everything else than Baseline:

// XXX
if (h264type.eProfile != OMX_VIDEO_AVCProfileBaseline) {
ALOGW("Use baseline profile instead of %d for AVC recording",
h264type.eProfile);
h264type.eProfile = OMX_VIDEO_AVCProfileBaseline;
}
[Nexus 4 Android Development] IAmAN00bie:
Damnit. No wonder we can't change it. Did Google do this because the S4 Pro can't encode in High-line?

---------- Post added at 05:07 PM ---------- Previous post was at 04:44 PM ----------

I think at Baseline level 4, the max bitrate is 20,000 http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels

Yes, https://www.dropbox.com/s/3bz87ejq8jvnqw4/media_profiles.xml

720p bitrate increased to 12mbps, 1080p bitrate increased to 20mbps, both audio bitrates at 288k, and image compression minimized as much as possible.
[Nexus 4 Android Development] terr:
Where is the source for this library?

On another note I found this in the logcat output:

W/StagefrightRecorder( 164): Intended video encoding bit rate (20000000 bps) is too large and will be set to (12000000 bps)

I am not sure why that's there since my recordings are showing 20mb bitrate.

I wonder if we can modify that code and rebuild a ROM without forcing Baseline.
[Nexus 4 Android Development] sd_matto:
Thanks for the file. Used everything, except that I standardized on 256K audio.

One question. At line 419, it reads:

"419 <ExportVideoProfile name="h264" profile= "2" level="2048"/> "

Should that be profile = "2" or profile "1"?

Thanks again.
[Nexus 4 Android Development] IAmAN00bie:
Oops, forgot to change that back to 1 after I was done mucking around. No matter, it gets overwritten anyways (see few posts above) and Baseline Level 4.0 is used regardless of what you set there.
[Nexus 4 Android Development] dewadg:
Thank you for sharing this, I did this to my Galaxy W and it works :D
[Nexus 4 Android Development] tstaiano:
ZIP work on 720p or Anyone Have Edits for 720p

First off, I want to say thanks to the OP and other posters for all of the help, time & trial/error work.

I was wondering if the ZIP and/or mod lines given impact/change the recording quality when recording in 720p? I don't always record in 1080 because (1) limited physical size on our (otherwise spectacular) phone & (2) I'm not making movies...personally I feel 720p is perfectly adequate in almost all instances where I record videos.

TIA...
[Nexus 4 Android Development] IAmAN00bie:
Yes, use the file in my post on the previous page. Also :don't quote the entire OP please.

Sent from my Nexus 4
[Nexus 4 Android Development] 3dawg:
If I flash nightlies, does this need to flashed on top of them every time?
[Nexus 4 Android Development] yumcax:
Thanks, would you be able to make a flashable .zip of this?
[Nexus 4 Android Development] 0.0:
yes. or just add this to the 50gapps.sh file in /system/addon.d (or something like that): etc/media_profiles.xml

by doing so, every time you flash it wont get overwritten
[Nexus 4 Android Development] androidsnax:
I second that and thank the OP and others who have helped find this Mod! I prefer to use the 720 video day to day and save the 1080 for one-off's (massive file size!)

Flashing CM10.1 nightlies and sometimes dont have the time to sit and edit the file every time, would be great to have a flashable .zip that changes 720 and 1080...

Thanks again! :cowboy:
[Nexus 4 Android Development] 0.0:
you can edit the 50gapps.sh file in /system/addon.d and put "etc/media_profiles.xml" in the appropriate place so upon every flash, the file will be preserved
[Nexus 4 Android Development] mohit1234:
As already requested by terr, could you please provide the source for the library?

Afaik, the S4 can encode in Highline, not sure why they would force it to baseline though..

Btw, have you found any changes in the image quality by pushing all 3 values to 100? Doubling the memorycap seems to help, however, I can't see any difference at all when bumping the values to 100.

If so, its probably its just me then.

Hmm.. That's weird. Not sure why its giving the error as it is recording at 20mbps.

You probably might also have to change the maxbitrate to 20mbps. The maxbitrate is found near the end of the xml.

I'll try that and see if that fixes that. Thanks for the heads up regarding this! :good:

Also yes we could modify that code and then just compile the libs. We won't need to rebuild the entire ROM. We can transfer the edited libs to the /system/lib/ folder. If I can get my hands on the library source, I should be able to do so and make a flashable zip for convenience.
[Nexus 4 Android Development] MouseX:
Can anybody make compare video?
[Nexus 4 Android Development] a5ehren:
I can confirm increasing the MaxBitRate in the XML keeps this message from showing up in the logcat. I'd guess that the file's metadata is being set from the XML even if the actual encoding is done at a different bitrate, but I don't have time to look at the source and confirm that right now.

I did a test recording at 16mbps (with the max set to 20mbps) and got this out:

I/MPEG4Writer( 171): limits: 2147483647/0 bytes/us, bit rate: 16192000 bps and the estimated moov size 405000 bytes

terr, I'm betting your logcat has this line saying 12 mbps instead if your stagefright message is correct.

If someone has time and my reading is right, we should probably send a bug report into Google. It shouldn't be too hard to have it write the correct value to metadata.
[Nexus 4 Android Development] zephiK:
Didn't really care much about this mod because it was all video but improving camera quality!? Definitely interested!
[Nexus 4 Android Development] androidsnax:
Thanks for the heads up mate, but thats just slightly outside my comfort zone! :eek: :o

Im slowly learning though so hopefully some day Ill know what your talking about! (I had a look and the 50gapps.sh but mine is 70gapps.sh.... ?)

Ill just take baby steps until someone out there makes a .zip! Thanks ;)

***EDIT***

Just noticed OP has been updated!

Nice 1
[Nexus 4 Android Development] ragmanchu:
I am using stock rom with franco kernel

i have installed the newest flash file and i get a FC when i switch the camera to video record mode.

i have tried to revert back to stock camera file and i get the same FC error when trying to use video record mode.

is there any advice how to get this working again?
[Nexus 4 Android Development] cguru:
https://android.googlesource.com/pl...35cf86fd5b2d5/media/libstagefright/ACodec.cpp

As someone already said, exchanging the compiled library should be enough...
[Nexus 4 Android Development] mohit1234:
Hmm.. ok thanks for testing that out, ill also try the same thing and see if im also getting the same logcat response. If so, we should definitely send a bug report to Google and in the meantime, we can try and fix it. Ill check out the sources.

This was always regarding camera quality. It was previously just reducing the noise present in video recording.

That's weird. I'm also on Franco's kernel but not on the stock ROM and I'm not getting any issues.

Do the following:-

Flash the stock zip via recovery and then wipe cache only. That should get you back to stock.

If you want another try at the mod, flash the mod zip and then wipe cache only.

Let me know if you have any issues.
[Nexus 4 Android Development] Chad_Petree:
Image Decoding Memory Cap has been doubled from 20mb to 40mb. (Image quality seems to have become slightly better)

What does this mean? Is it for pictures or video?
[Nexus 4 Android Development] mohit1234:
Pictures.
[Nexus 4 Android Development] Chad_Petree:
But what exactly does it do?
[Nexus 4 Android Development] mohit1234:
It prevents images from being compressed and hence prevents quality from reducing.
[Nexus 4 Android Development] Chad_Petree:
So it means the images taken by the phone can be up to 40 mbs instead of 20 mb?

Hmm I don't know must images are at most 10 MB so I don't see how this could help us :(
[Nexus 4 Android Development] mohit1234:
That is true, however if you take pictures with and without the mod, you can see that there is a small increase in image quality.
[Nexus 4 Android Development] ragmanchu:
I have tried flashing stock with just wiping cache and still can't fix the FC issue
[Nexus 4 Android Development] mohit1234:
That should have fixed it. :confused:

Use a file explorer and go to system/etc/ and make sure that the file has permissions as rw-r--r--. If it doesn't change it and reboot.

If that doesn't work, restore your nandroid backup, and if you haven't done that then flash your rom over it without wiping.
[Nexus 4 Android Development] Chad_Petree:
Any updates on changing baseline to highline ? :confused:
[Nexus 4 Android Development] mohit1234:
I'm working on it. I've got the files and I've made the necessary edits. Now I'm working on compiling the source and then forcing it to run highline.

Having a few issues with compiling though.. :confused:
[Nexus 4 Android Development] ragmanchu:
perfect, this has worked =)

thanks a lot for all your help!!
[Nexus 4 Android Development] Chad_Petree:
Damn you're fast! take your time :) we're waiting patiently :good:
[Nexus 4 Android Development] Shaky156:
Edit: nvm
[Nexus 4 Android Development] terr:
<deleted>