How to edit /etc/media_profiles.xml on Android 10 with Magisk - Magisk

The fine people at OnePlus hardcoded a maximum audio bitrate of 96000Bps into /etc/media_profiles.xml and even camera apps like Cinema 4k that provide the option of setting a higher bitrate with external microphones are overridden by this standard value.
With Android 10 it seems there is no way to edit this file and have an app read a higher value such as 320kBps.
From what I understand there is a Magisk module that lets you edit build.prop, so I wonder whether there is a way to achieve this with a similar approach?

Same situation here. I need more video bitrate for recording (60fps UHD)

Copy the file to your internal storage, edit it the way you want it and then create a Magisk module to systemlessly replace the file.
Done.

Related

[Q] Camera Mods - media_profiles.xml

I have amended some values in the xml file, but are not reflected on the pictures or videos themselves (still standard bit-rate reported), higher bit-rate etc. Any ideas what else needs to be amended to allow higher bitrates? The APK itself? libs?
Regards

[GUIDE]Record better videos+low light fps workaround+increase bitrate on the Redmi 2

So you want to record more natural looking videos on your Redmi 2? Maybe so you get more headroom when video editing? Or does recording in low light look too choppy? Then this might be for you!
After reading Redmi 2 on XDA and checking out FreeDCam, I can say that it’s the best looking video recorder I’ve tried on my phone.
Of course you want to see some samples (Sorry if the samples aren’t that great but there weren’t any colourful flowers around. )
YouTube samples
Outside and sunny...
CM Snap
FreeDCam
Outside...
CyanogenMod Snap
FreeDCam
FreeDCam with some adjustments
Low light with workaround
CyanogenMod Snap
FreeDCam
This camera app will give you more manual controls than any other video recording app plus, you can even change them while recording! Here’s some specific settings that you should change…
Exposure: Adjust so nothing looks too dark or too bright (find the balance).
Contrast: Change to 0 (or something slightly higher). I guess the problem with other apps is that the contrast is set too high and makes shadows look too dark and highlights look too bright.
Sharpness: Set to 0 as the video will look more soft and natural. Sharpening after recording (i.e. using a program) seems to look better…
Denoise: Turn off as colours get washed out and we start to lose some of that detail. (Or keep it on if you really hate noise.)
There’s some issues regarding focussing, manual focus doesn’t seem to work. If you want to set your focus to infinity, after launching the app, set the focus to auto, tap to focus once and then set your focus to infinity.
Ok great now I can record better videos! But at night the video looks blurry, choppy…
The reason why this happens is so that more light can enter the camera for longer, causing the video to look blurry, choppy and noisy. Here is a workaround where you can now record at a constant 30fps even in the dark! This idea came from some OnePlus thread where you could rename a front camera video binary file to the rear camera video binary as the front camera records at a constant 30fps. Be aware there is a trade-off and it is that dark places won’t be as bright at 30fps compared to 15fps!
If you don’t do this, then 15fps could actually be helpful as you can see more with less light! FreeDCam will help a lot with a low light situation with the increased exposure and decreased contrast. You’ll get more noise though. You can either activate the denoiser and/or run a denoiser plugin after you have recorded your video.
(Note: I’m not responsible for anything that might happen on your phone. I’ve only tested this on cm13 so the files might be different across different roms.)
Note that this mod will affect all apps that record video and dark places will look very dark.
Go to /vendor/lib/
Copy the name libchromatix_ov8865_sunny_default_video.so and then back it up (rename it to something like libchromatix_ov8865_sunny_default_video.so1
Create a copy of libchromatix_ov2680_5987fhq_default_video.so and rename it to libchromatix_ov8865_sunny_default_video.so
To revert change libchromatix_ov8865_sunny_default_video.so1 back to libchromatix_ov8865_sunny_default_video.so
Increase bitrate…
You can increase the video bitrate with FreeDCam (or any other video recording app if you mess with media_profile.xml) so you can record all that fine detail (including especially the noise). Here, we’ll change the bitrate to 40Mbps.
Just head to /system/etc/media_profiles.xml and look for: (tip: near the end)
<VideoEncoderCap name="h264" enabled="true"
minBitRate="64000" maxBitRate="20000000"
minFrameWidth="176" maxFrameWidth="1920"
minFrameHeight="144" maxFrameHeight="1088"
minFrameRate="15" maxFrameRate="30"
maxHFRFrameWidth="1920" maxHFRFrameHeight="1080"
maxHFRMode="120" />
Click to expand...
Click to collapse
Change maxBitRate to 40000000 and save. This edit only tells the phone the maximum bitrate it can encode at.
In FreeDCam, make sure you’re in 1080p! Change video bitrate to 40000000 and audio bitrate 320000. Be aware that the video size will now be around 300MB/min so make sure you have plenty of storage. (I tried using an USB OTG Drive. It works! But the USB device interfered with the microphones and created noise. )
So yeah. The difference might not be that noticeable to some, but to me, it looks a lot better to me. While recording, the viewfinder might lag a bit but in the actual recorded video, it’ll be fine. I might put more samples up or maybe you try this out and get some samples for me! Hopefully there are some people here who are interested in video. :good:
My first thread
Awesome!! Works flawlessly with this app!
why dont you just give the edited file
gamernayeem said:
why dont you just give the edited file
Click to expand...
Click to collapse
Of what?
magmar452 said:
Of what?
Click to expand...
Click to collapse
media_profiles.xml
gamernayeem said:
media_profiles.xml
Click to expand...
Click to collapse
I'll make a flashable zip for both the mods
magmar452 said:
I'll make a flashable zip for both the mods
Click to expand...
Click to collapse
thanks
If you can you post guide for better picture quality in general,I am overwhelmed by amount of options it provides can you post screenshots of balanced set of options to choose specifically for our device. Thanks for this thread anyway .
rohitsonone said:
If you can you post guide for better picture quality in general,I am overwhelmed by amount of options it provides can you post screenshots of balanced set of options to choose specifically for our device. Thanks for this thread anyway .
Click to expand...
Click to collapse
Sorry, this is a video specific guide. I'm making some flashable zips and I'll put some screenshots when I have time. Perhaps @shanx_verma can make a picture guide? If I have lots of time then maybe I'll make one.
Prioritizing FPS Over Exposure
Hi magmar452.
Thank you very much for this. This is some juicy detail you uncovered here!
magmar452 said:
Go to /vendor/lib/
Copy the name libchromatix_ov8865_sunny_default_video.so and then back it up (rename it to something like libchromatix_ov8865_sunny_default_video.so1
Create a copy of libchromatix_ov2680_5987fhq_default_video.so and rename it to libchromatix_ov8865_sunny_default_video.so
To revert change libchromatix_ov8865_sunny_default_video.so1 back to libchromatix_ov8865_sunny_default_video.so
Click to expand...
Click to collapse
My front-facing camera also goes into "Slideshow Mode" in low light, so following your exact steps above didn't work for me. However, I fiddled a bit and found what does work for me:
Trade exposure for fps priority:
1. Go to /vender/lib/
2. Rename "libchromatix_ov8865_sunny_default_video.so" to "libchromatix_ov8865_sunny_default_video.so1"
3. Create a copy of "libchromatix_ov8865_sunny_hfr_60fps.so" and rename it to "libchromatix_ov8865_sunny_default_video.so"
EDIT1: Getting decent night time results using "libchromatix_ov8865_q8v18a_default_video.so" as the source. It actually allows me proper exposure/fps control. "libchromatix_ov8865_q8v18a_hfr_60fps.so" handles similarly, but prioritizes fps.
EDIT2: Various vendor libs from github/TheMuppets/xiaomi/cancro also work. However, results are all over the place.
This isn't a proper fix, but it's really good to be Slideshow-free.
Samples:
ov8865_sunny (default): youtu.be/pS544qW35ZM
ov8865_q8v18a: youtu.be/PcCC95EIceg
imx226_video_hdr: youtu.be/E79zcYlq7pU
pexxie said:
Hi magmar452.
Thank you very much for this. This is some juicy detail you uncovered here!
My front-facing camera also goes into "Slideshow Mode" in low light, so following your exact steps above didn't work for me. However, I fiddled a bit and found what does work for me:
1. Go to /vender/lib/
2. Rename "libchromatix_ov8865_sunny_default_video.so" to "libchromatix_ov8865_sunny_default_video.so.org"
3. Create a copy of "libchromatix_ov8865_sunny_hfr_60fps.so" and rename it to "libchromatix_ov8865_sunny_default_video.so"
EDIT: I'm getting decent night time results using "libchromatix_ov8865_q8v18a_default_video.so" as the source. It actually allows me proper exposure/fps control.
Not sure why it works, but it works. Maybe it's coincidence. I still get the occasional brief dips to 20-odd fps, but they're too infrequent to be a nuisance. It's not a proper fix, but it's really good to be Slideshow-free.
Short Samples: Original & Hack Job
Original: youtu.be/3VHuGj33vp4
Hack Job: youtu.be/oEH2E7t_5EI
P.S. I'm running CyanogenMod Nightly 6.0.1 (wt88047) on my Redmi 2 Pro (2014817)
Click to expand...
Click to collapse
I think most roms have switch to the lollipop canera blobs and that's why the front camera is choppy now to fix the 'dark video' problem. I've switched to Resurrection Remix, there are some few changes that had to be made to the instructions (getting the old front camera file) so I can still get 30fps.I'll check it out renaming to the 60fps file. Currently I'm quite busy
magmar452 said:
So you want to record more natural looking videos on your Redmi 2? Maybe so you get more headroom when video editing? Or does recording in low light look too choppy? Then this might be for you!
Afterreading Redmi 2 on XDA and checking out FreeDCam, I can say that it’s the best looking video recorder I’ve tried on my phone.
Of course you want to see some samples (Sorry if the samples aren’t that great but there weren’t any colourful flowers around. )
YouTube samples
Outside and sunny...
CM Snap
FreeDCam
Outside...
CyanogenMod Snap
FreeDCam
FreeDCam with some adjustments
Low light with workaround
CyanogenMod Snap
FreeDCam
This camera app will give you more manual controls than any other video recording app plus, you can even change them while recording! Here’s some specific settings that you should change…
Exposure: Adjust so nothing looks too dark or too bright (find the balance).
Contrast: Change to 0 (or something slightly higher). I guess the problem with other apps is that the contrast is set too high and makes shadows look too dark and highlights look too bright.
Sharpness: Set to 0 as the video will look more soft and natural. Sharpening after recording (i.e. using a program) seems to look better…
Denoise: Turn off as colours get washed out and we start to lose some of that detail. (Or keep it on if you really hate noise.)
There’s some issues regarding focussing, manual focus doesn’t seem to work. If you want to set your focus to infinity, after launching the app, set the focus to auto, tap to focus once and then set your focus to infinity.
Ok great now I can record better videos! But at night the video looks blurry, choppy…
The reason why this happens is so that more light can enter the camera for longer, causing the video to look blurry, choppy and noisy. Here is a workaround where you can now record at a constant 30fps even in the dark! This idea came from some OnePlus thread where you could rename a front camera video binary file to the rear camera video binary as the front camera records at a constant 30fps. Be aware there is a trade-off and it is that dark places won’t be as bright at 30fps compared to 15fps!
If you don’t do this, then 15fps could actually be helpful as you can see more with less light! FreeDCam will help a lot with a low light situation with the increased exposure and decreased contrast. You’ll get more noise though. You can either activate the denoiser and/or run a denoiser plugin after you have recorded your video.
(Note: I’m not responsible for anything that might happen on your phone. I’ve only tested this on cm13 so the files might be different across different roms.)
Note that this mod will affect all apps that record video and dark places will look very dark.
Go to /vendor/lib/
Copy the name libchromatix_ov8865_sunny_default_video.so and then back it up (rename it to something like libchromatix_ov8865_sunny_default_video.so1
Create a copy of libchromatix_ov2680_5987fhq_default_video.so and rename it to libchromatix_ov8865_sunny_default_video.so
To revert change libchromatix_ov8865_sunny_default_video.so1 back to libchromatix_ov8865_sunny_default_video.so
Increase bitrate…
You can increase the video bitrate with FreeDCam (or any other video recording app if you mess with media_profile.xml) so you can record all that fine detail (including especially the noise). Here, we’ll change the bitrate to 40Mbps.
Just head to /system/etc/media_profiles.xml and look for: (tip: near the end)
Change maxBitRate to 40000000 and save. This edit only tells the phone the maximum bitrate it can encode at.
In FreeDCam, make sure you’re in 1080p! Change video bitrate to 40000000 and audio bitrate 320000. Be aware that the video size will now be around 300MB/min so make sure you have plenty of storage. (I tried using an USB OTG Drive. It works! But the USB device interfered with the microphones and created noise. )
So yeah. The difference might not be that noticeable to some, but to me, it looks a lot better to me. While recording, the viewfinder might lag a bit but in the actual recorded video, it’ll be fine. I might put more samples up or maybe you try this out and get some samples for me! Hopefully there are some people here who are interested in video. :good:
My first thread
Click to expand...
Click to collapse
Can you make a guide for MI 5? I'm trying to record guitar videos but it's choppy
luigi0824 said:
Can you make a guide for MI 5? I'm trying to record guitar videos but it's choppy
Click to expand...
Click to collapse
Sorry I don't have an Mi 5. See if lowering resolution helps or not having enough light causes this issue.
flashable zip is there?
It will be easy then

How To Guide Capturing CinamaDNG on the ZTE Axon 30 Ultra

The still under heavy development MotionCam enables the ZTE Axon 30 Ultra to capture RAW video in form of CinemaDNG.
This is virtually a sequence of DNG frames with a seperate audio track generated by the app.
The app allows cropping from the full resolution of the sensor (but no scaling) so that you can create content that the free version of DaVinci Resolve is able to process.
The app detects all of the camera modules on the back.
During capture tha app stores the data in a container. From within the app the DNG sequence can be exported from each container.
In DaVinci Resolve you can simply add the complete folder to the timline and apply any grading there like on any other video clip except there is so much more range for processing without the result falling apart.
Besides the ablity to capture RAW video there ist also the opportunity to create naturally looking JPEG images on each of the modules on the ZTE Axon 30 Ultra. An option to store DNGs is there as well. Also an interesting burst mode that captures a rapid sequence of images that can than be used in the app to create a single output image where you can control the settings in a wide variety of parameters. The app provides a night mode on all the camera modules as well. Maybe not as perfect as on the GCam but good enough.
A sample of the output from the main camera on YouTube
Original HEVC (H.265) clip on OneDrive for download
A sample of the output from the 35mm equivalent module on YouTube
Original HEVC (H.265) clip from the 35mm equivalent on OneDrive for download

Themes / Apps / Mods Modded camera with improved audio quality for Realme GT2

Since there was no fix, provided by Realme, for the quality of the audio in videos recorded with the stock camera app, and unlocking the bootloader is still not available for the RMX3311 (EU) the only way to improve the audio was to modify another camera app, without loosing stock camera features, like 60fps, stabilization, etc.
So, I've decompiled and modified the GCam port from SHAMIM (SGCAM) and changed the audio source from "Camcorder" to "Voice recognition" (see https://developer.android.com/reference/android/media/MediaRecorder.AudioSource), is not perfect but much better than stock.
I've also included the configuration xml for SGCAM 8.4 with basic settings for Realme GT2 so the quality of photos and videos be similar to the stock camera.
Working (after importing my config xml) :
- Back (main) camera: FHD videos 30/ 60fps, 4k 30fps, image quality equal to stock camera
- Improved sound quality in video recordings for front and back camera
- Front camera 60fps
Not working:
- Slow motion (works partially)
- Aux cameras (wide and macro)
- HDR+ or HDR+Enhanced if activated the colors are bad, inaccurate, too artificial. Can be improved but I personally like the results without hdr+, so I don't care to make them work.
I've created two builds because the recorded audio channels are reversed, (android 13, fw c.06), you can check using stock sound recorder, if you speak to top mic the sound plays on bottom speaker, mono for current situation (with reversed channels) and stereo for when (if) they will fix the channels order.
Install instructions:
1. Download the modified SGCAM from here:
mono: https://uploadnow.io/f/G4Ctrh7
or
stereo:
https://uploadnow.io/f/lJBRS1t
2. Download the Realme GT2 config file for SGCAM 8.4: Lcfg1.xml (attached to this post)
3. Install SGCAM, open once, allow permissions, (needed to create folders for configs)
4. Copy Lcfg1.xml to [phone internal storage]/SGCAM/XML/Lcfg1.xml
5. Import Lcfg1.xml by double tapping the blank space between shutter button and switch camera button (see the attached screenshot)
6. Leave a message if it helped you
reserved
Will test, nice work. Still angry at Realme for crippling the device like this.
This is sooooooooooo much better
In case if someone wonders, there is a xml for the GT 2 Pro, which the ultrawide camera works with, and it also works on our GT 2, but the picture quality is very low and noisy.
https://forum.xda-developers.com/t/gcam-for-realme-gt2-pro.4429173/post-87701663
It is in the attachments.
@hdavid1 For the aux cameras (wide and macro) to work you need GCAM, with package name com.ss.android.ugc.aweme But those have an issue, the photos taken with the main camera are shifted to the right (they have a black border on the left) - tested only on my GT2.
hdavid1 said:
In case if someone wonders, there is a xml for the GT 2 Pro, which the ultrawide camera works with, and it also works on our GT 2, but the picture quality is very low and noisy.
https://forum.xda-developers.com/t/gcam-for-realme-gt2-pro.4429173/post-87701663
It is in the attachments.
Click to expand...
Click to collapse
just tested that xml file and it's not working. My SGCAM build is not derived from the com.ss.android.ugc.aweme package, because of the reason posted above.
wizard8400 said:
just tested that xml file and it's not working. My SGCAM build is not derived from the com.ss.android.ugc.aweme package, because of the reason posted above.
Click to expand...
Click to collapse
hi there i have the gt but the 1 with the same audio issue i can open the bootloader so i can fix it but i dont know how can you provide me some guidence pls?
@alex61194, I didn't understand your request. Can you rephrase, please. And use punctuation, it really helps
wizard8400 said:
@alex61194, I didn't understand your request. Can you rephrase, please. And use punctuation, it really helps
Click to expand...
Click to collapse
sry, tipped too fast, i have the realme gt 5g, and have the same issue as your phone but in my case i can open the bootloader and be root, but i dont know what i have to change to fix the mic issue(i saw i have to edit mixed_paths.xlm), honestly i dont care about video but about voice recording in general
post here your mixer_paths.xml and I'll have a look, I don't think it's the same as on the gt2
Have you tried out other Audio Sources and if that changes anything or is Voice Recognition the best for this device?
@smashda Yes I've tried them all, and voice recognition is the only one with acceptable results. Sources like unprocessed is too low, voice com. has too much noise canceling, etc.
wizard8400 said:
post here your mixer_paths.xml and I'll have a look, I don't think it's the same as on the gt2
Click to expand...
Click to collapse
here you go https://mega.nz/file/8odHXDSB#IhmdD1ntn4fMyeRpMVZnNj-uiSBNUG9kOuseiC8bBjo
@alex61194
*!!! have a backup so you can restore from custom recovery, just in case.
1.make sure you are editing mixer_paths.xml from /vendor/etc
2. modify the file according to the instructions from the screenshots.
3.after saving the file verify/set the permissions to be rw-r-r (like before)
4. reboot the phone, check if the modifications are still there
5. try a recording see if something changed. Do not expect to fix or improve something. This is just a test to see if we are on the right path.
6. tell me the results.
@wizard8400 bruh we have GT 2 Indian variant RMX3312 with an unlocked bootloader. We, unfortunately don't have TWRP. Can you give some suggestions?
@Ptathavi I think is possible with magisk:
first you need to flash a patched boot image (patched by magisk) to have root
and then something like: https://forum.xda-developers.com/t/how-to-change-files-in-the-directory-system-with-magisk.4454489/
or try searching something like "edit system file with magisk"
wizard8400 said:
@Ptathavi I think is possible with magisk:
first you need to flash a patched boot image (patched by magisk) to have root
and then something like: https://forum.xda-developers.com/t/how-to-change-files-in-the-directory-system-with-magisk.4454489/
or try searching something like "edit system file with magisk"
Click to expand...
Click to collapse
Thank you bro, much appreciated. I'll try. Since I've root there's posibility
Ptathavi said:
Thank you bro, much appreciated. I'll try. Since I've root there's posibility
Click to expand...
Click to collapse
How did you root it? Did you flash the patched boot img from magisk?
Prinve said:
How did you root it? Did you flash the patched boot img from magisk?
Click to expand...
Click to collapse
Join our group for help
Mod. edit: social media link removed. alecxs
What!!! I have been searching for this for so long but i couldn't find it, searches only showed Neo 2 and Pro and as there were no posts in XDA i thought development hasn't started yet so i was learning/trying to build twrp and build device tree for it. Thanks for the link

General Deleted

Deleted
Hi! I've tested the mod but it's not working, bitrate is still at 96, test with "media info" from Google play...
I think you need to modify the file from /odm/etc/, those from vendor are not used by android anymore. Check my magisk module regarding what files I've changed and how I've did it, here: https://forum.xda-developers.com/t/...-recording-quality-mod-magisk-module.4587667/
I will also include a higher bitrate, it helps a little, but I'm more focused on reducing the white/static noise and tuning the equalizer...
Keep up the good work!
I test it with stock RUI C10 EU, with stock camera on 4K 60FPS but again the bitrate is 96kbps.
Thanks for letting me know I'll try to do some more revisions on this
Temporary removing file to prevent further problems for people

Categories

Resources