yashsingh1/xdaforums huggingface dataset:
[Xiaomi Redmi Note 5 Pro Questions & Answers] lukesan:
Ok, very cool find! Observations which I made over the last couple of days

We have 2 'issues' on the redmi note 5 (Whyred) so 1) the bitrate and 2) the highpass

1) is as you say media_profiles_vendor.xml we can easily alter that one. Check out the downloadable MI MIX 2 audio quality ... module for Magisk. Download extract and copy that xml file and set the same permissions 644 I believe. Make a backup of the original first. They set the bitrate really high on that one 256kbit/s I believe which is a bit overkill, but compared to 20mbit/s for the video it is nothing and I rather have overkill than 96kbit/s underwater sound.

So that one is easily fixable.

2) The high pass filter seems to be linked to the AGC. I really like the AGC since it keeps the volume constant and should be the standard for the 'normal' people who do not care about extreme hifi things. I would leave it on if I could only switch off the high pass filter. Shoot a video and it will be perfect for 99.999% of the people. Levels will almost be perfect. People easily understandable etc etc etc.

I would like to switch off the AGC (and the filter) for real audio recordings, meaning classical music etc etc .. this involves always having to check if your level is not to low or if the peaks are not to high causing clipping which means distortion.

For issue 2 the only app that I found that can do this is cinema-fv5. I made an error in my previous text to set it to 8MP since then the stabilization doesn't seem to work properly so I now set that to 2592x1296 which seems pretty 16/9 like to me. If you switch off the AGC in this app then you get AGC off and high pass off. Very low level audio but perfect quality. I guess perfect for a concert. (this weekend there is a local festival here so I can really test (and enjoy))

If you want good audio but mono then you need open camera for now. If you set the microphone to 'mono' you will also hear that the sound is good, setting it to stereo gets the noise cancellation working and it sounds like crap.

I'll try those Mi Max 3 things if I find a bit of time. Lets share knowledge and experience and we'll get it working like it should. This is the only small downside of the redmi note 5 that I have found so far. (and that is coming from an S7)

---------- Post added at 10:54 AM ---------- Previous post was at 10:00 AM ----------

@rocker00 Just flashed it. Does set the bitrate to 288kbit/s which is really high but, like said above compared to video that is peanuts. Better a lot more than what it was. But it does not switch off the AGC or high pass. Since you have the rom can you check and attach another file? The file is in the same path (vendor/ etc) our file on the redmi note 5 is called mixer_paths_skus.xml . I guess it might be a bit different on MI MAX but I guess some more audio is being controlled there.
[Xiaomi Redmi Note 5 Pro Questions & Answers] rocker00:
[MENTION=1743042]lukesan[/MENTION] First please override media_profiles_vendor.xml manually because it looks like the script is not mounting vendor!

Regarding the file, media_profiles_V1_0.xml, mixer_paths_i2s.xml, mixer_paths_mtp.xml, mixer_paths_skus.xml, mixer_paths_skush.xml, mixer_paths_wcd9326.xml, mixer_paths_wcd9335.xml and mixer_paths_wcd9340.xml

are the same md5! but mixer_paths.xml (which i downloaded the whole rom just to get it in order to try to enable dual speaker) is completely different!

Also i have 2 doubts:

1- in build.prop which is in vendor they changed ro.vendor.audio.sdk.fluencetype to fluence which is none in our device(related to noise cancelling)

2-ACDB (Audio Calibration Database) which is completely different in Mi Max 3 cuz it has dual speaker and two speakers at the bottom, and ACDB is controlled by audio.primary.sdm660.so which is different for sure in both, i hope it's not related to that because it will be really a hard job!

here's the mixer_paths.xml am still looking into it maybe i can find something!
[Xiaomi Redmi Note 5 Pro Questions & Answers] lukesan:
Probably it is taking the media_profiles_vendor.xml which I already edited manually. Well to check that our device is capable you could check with Cinema-FV5 lite which is free up to 1280x720 resolution. Disable the AGC and you get a nice clear sound full audio spectrum. I'm on a 8.7.5 rom and when I start to record my image is taken from the upper left corner all zoomed in. Not sure which rom you are on, but could you give that a try?

If it's that *.so file we need to address someone with the right knowledge. I've never decompiled stuff like that.
[Xiaomi Redmi Note 5 Pro Questions & Answers] rocker00:
I'll try the app ASAP and i'll keep trying...never give up ;)

BTW, that lib is most likely C++ signed binary so you can't do anything about it!
[Xiaomi Redmi Note 5 Pro Questions & Answers] lukesan:
Just came back from the festival that I told about. The default MIUI video cam.. wow made a complete mess. The AGC went completely crazy and no bass. Using cinema-FV5 ... wow listening to it right now with my earplugs..... it's like I'm still there. Ok the bass sounds (only) a bit distorted, but I was standing at the front and the smart people there handed out headphones that dampened sound to the kids. I myself suffer from tinnitus so I have -20dB earplugs ... even then it was crazy loud.

So cinema-FV5 is definitely a must with music. Not sure if I can upload something on Youtube without violating copyrights. But surely this phone is capable of recording high quality audio for sure.
[Xiaomi Redmi Note 5 Pro Questions & Answers] kellerman40:
Same happened to me. After recording the stage with artists and loud music. It looked OK, stabilised video at 1080p, but sound lacks bass with stock camera app.

I would like to try better camera apps like gcam, just there are ~50 hours for me to wait till I can unlock my bootloader and flash a decent ROM.

Then we could record at 60fps 1080p and 4K@30 with normal audio.
[Xiaomi Redmi Note 5 Pro Questions & Answers] lukesan:
Forget gcam or other roms for now since they use the same audio path. There is another trick I read about but it involves a lot of work and I would hardly call it a working thing unless you spend a lot of time. Check this thread. I know for the MI MIX but same procedure applies for now. https://xdaforums.com/mi-mix-2/how-to/mi-mix-2-video-sound-recording-quality-t3776450

Leave the 60fps and 4K behind if it is in a dark environment. You might end up with dropped frames etc which is really annoying.
[Xiaomi Redmi Note 5 Pro Questions & Answers] Cirra92:
Have you tried it? I've tried your trick with the bitrate increase in media_profiles.xml, though I've set it to 192000 and used the FV-5 disable the AGC and it's much better quality! Although the bass is a bit too much pronounced and the meds and highs are a bit sacrificed, it's still much better than stock. But with the custom settings for audio in FV-5 it makes that "underwater" sound, no matter which combination I used, but I did everything according to your post, only if I leave the default values it works. (I now suspect it was maybe because of the stereo recording option)

I am interested to make some changes using the thread you linked, I'm just afraid not to make a mess of volumes in earpiece or introduce echo during a call or something like that, that's why I'm hesitating.

The AGC makes a total mess of recording, it lowers the quality and introduces background noise.

For the 60fps I'm not sure that works as none of the camera app that I've tried are able to record it (I'm on AOSP based rom) because it depends on the camera blobs, and I'm not sure Xiaomi updated the sources, but they did introduce it in MIUI 10 builds.
[Xiaomi Redmi Note 5 Pro Questions & Answers] lukesan:
Strange that you got the underwater sound. Can you check with this one? https://mediaarea.net/en/MediaInfo Just drag and drop the file on it. It will show the audio properties.

Just to confirm again my settings in FV-5 I changed the resolution to 2592x1296 (turn on handshake thing on where you can actually see where you are recording, weird setting I know). In the 'Audio' settings check the attached screenshot.
[Xiaomi Redmi Note 5 Pro Questions & Answers] Cirra92:
Oh yes I did that, but you didn't check the "Custom audio settings" box so the app uses default system settings rather than the ones you selected. Try it out if you didn't already.

And I've checked with MediaInfo, the video was recorded in 96K (because the app didn't use custom settings), but anyway it should be using maximum possible values the device has set in media_profiles_vendor.xml, which is in my case 192K. I've seen now that media_profiles_V1_0.xml is basically the same file and there is 96K set as maximum, maybe both files need to be changed?
[Xiaomi Redmi Note 5 Pro Questions & Answers] lukesan:
That's normal since it seems you can't overwrite those settings in our current roms it seems. I bought that FV5 but I emailed support and never gotten answer back, to bad. It always takes the settings from that file on the phone it seems. And yes if you see 96Kb/s than it is normal that you hear these metallic sounds. Can you maybe attach the media_profiles_vendor.xml you have in the /system/vendor/etc dir?
[Xiaomi Redmi Note 5 Pro Questions & Answers] Cirra92:
Well recording in 96K instead of 48K which was the case with MIUI 9.5 in GSMArena test is already an improvement, however I'm sure this device is capable of even more. So for now, seems that just disabling AGC made a very good difference, it might just get better if we raise the bitrate even more. I've seen in the thread you linked that they actually modified media_profiles_V1_0.xml in case of LineageOS to raise the bitrate, I will now try that one as well.

Here is my file you requested.
[Xiaomi Redmi Note 5 Pro Questions & Answers] Cirra92:
I confirm that changing the media_profiles_v1_0.xml does increase the bitrate! I have set it to 192K, however since the maximum value that was set for each resolution (I've tested 1080p) is 156K the app used that one based on previous setting. Now every app should use the 156K if we don't alter the bitrate for each resolution separately (that's my guess at least).
[Xiaomi Redmi Note 5 Pro Questions & Answers] rocker00:
I tried this app with the steps you mentioned and yeah, sound is better for sure but it's much better if we can get the same result on stock cam.

let's take it step by step, first is the bit rate, even after using Mi Max 3 files the bit rate remains the same! i checked my old Sony Xperia z2 mediaprofiles.xml and i found the aac bitRate is also 192000, see the video sample result in the 1st pic from sony and second one from note 5 pro!

Now clearly there's something controlling the cam audio beside mediaprofiles.xml since the modifications wasn't enough!

I'll record a log while recording and let's see if i can find any info about that!

[MENTION=5070317]Cirra92[/MENTION] 60 FPS is working on 9.5, i thought like you about blobs but surprisingly no! now i'm on 9.5.19.0 and i just got the camera apk from MIUI 10 and i have 60 FPS!

Also i found another thing which is interesting but it's still not working even on Mi Max 3.....looks like 120 FPS HFR is on the way!

Check this video out: https://www.youtube.com/watch?v=0rjZx_5JD1s (13.06)

I managed to get this setting even if it's still grey!

etc\device_features/whyred.xml just added those lines:

<!--whether support camera video high frame-->

<bool name="support_camera_video_high_frame">true</bool>

let's try to make the cam perfect as much as possible!
[Xiaomi Redmi Note 5 Pro Questions & Answers] Cirra92:
Okay I can confirm one more thing, all of the apps are now using maximum set bitrate that's under each resolution, which is 156K, although the maximum set for AAC is 192K. Anyway at least in AOSP/LOS based roms you need to change both "media_profiles_vendor.xml" and "media_profiles_V1_0.xml", in MIUI I don't know which files are present, can you list the names of media_profiles.xml files on your device?

Also, can you post your media_profiles.xml files here, I want to see whether somewhere in those files the frame rate limit is raised, as all I could see here is 30 fps maximum, maybe that's the reason why 60fps on custom roms is not working.

I can't see the last screenshot however I assume it's that 720p @ 120fps setting, so does it actually work?
[Xiaomi Redmi Note 5 Pro Questions & Answers] rocker00:
In system/etc: media_profiles.xml and media_profiles_V1_0.dtd

in vendor/etc: media_profiles.xml,media_profiles_V1_0.xml and media_profiles_vendor.xml

And yeah it's 720p@120fps but it's still not working as i mentioned but at least there's a hope now!

All the files in the attachment including the last screenshot.
[Xiaomi Redmi Note 5 Pro Questions & Answers] Cirra92:
I forgot to mention about that string for HFR mode set to "True", that whole folder "device_features" I think it's not present on AOSP/LOS based roms, but I've flashed the ported Mi A2 camera Magisk module and it added that folder, along with the whyred.xml file and that string in it.

Weirdly enough, in the ported cam, the slow motion option is working, I've just recorded the video and I've checked on my PC with MediaInfo app it was in 720p but it's 30fps :confused:

The attachments either fail at upload or on my end here :S Please can you share separately both files from vendor/etc? Or upload to GDrive or something like that if it still fails.

Also try to change bitrate in both files, reboot and check whether it makes any difference.
[Xiaomi Redmi Note 5 Pro Questions & Answers] rocker00:
WTF xda!!

https://drive.google.com/file/d/1kijltjiNIQVIskYU_k1KMGMqW1i28Zql/view?usp=sharing

Check out my previous posts in this thread, i followed the changes from Mi Max 3 (same SOC) in all xml files and still the same, also check the video which compares between Mi Max 3 and our device regarding cam audio, there's something beside the xml files which is controlling that!
[Xiaomi Redmi Note 5 Pro Questions & Answers] Cirra92:
Thanks for the files, something is wrong with XDA for days now :S

Yes, there are more files which control the audio recording, but at least the bitrate values are being taken from those 2 files.

Now, I see something weird with your "media_profiles_V1_0.xml" file in vendor/etc. Your audio bitrate cap is 96K for every single resolution, so despite you setting the maximum for AAC codec, you still have limit for each resolution. Do a test by changing for 1080p for example and check if it's raised. I am pretty sure it works on my device, since my cap is 156K and it's recording at 156K now.

Another thing I've seen is that "maxChannel" string has a value of "1" for AAC codec and also for individual resolutions which should indicate that your phone is recording in mono instead of stereo :S That's pretty weird to see Xiaomi setting those values :S

Also take note that there are no "media_profiles_X.xml" files in system/etc here on custom roms, only in vendor/etc, but I guess that if you change what I pointed out it should work.
[Xiaomi Redmi Note 5 Pro Questions & Answers] lukesan:
[MENTION=5070317]Cirra92[/MENTION] You might be mixing up stuff. 48K refers to the sampling freq. This defines the freq recording range = sample freq/2 = max 24KHz

So our ears can hear from approx 20Hz to 20KHz (if you are very young). The 96K you mention is probably the bitrate and is defined in this case in Kbit/s. The higher the better, well you won't hear any difference above 160Kbit/s since it is already AAC encoding.

I'm on a MIUI rom 8.7.x so the file might be different on a custom rom.

Well at least people are looking into it. I guess there is no perfect setting for every case of audio recording but I wouldn't mind having 2 or 3 different camera's on my phone with different profiles.
[Xiaomi Redmi Note 5 Pro Questions & Answers] rocker00:
[MENTION=5070317]Cirra92[/MENTION] Your welcome.

Keep in mind that the files i sent you is the original files from 9.5.19.0 which am not using them right now, am using the files from Mi Max 3 (some files are the same BTW), as i mentioned before there's no any changes except changing the acc bitRate from 156k to 192k and some small extra lines related to .wmv extension.

I've tried with all resolutions, the result is between 90.7k to 93.8k which is crap!

BTW, the only app which i got it working regarding 720p@120fps is snapdragon camera...but the quality is not nice at all!

If you want the app just let me now.
[Xiaomi Redmi Note 5 Pro Questions & Answers] Cirra92:
Yeah I've realized that a bit too late, I knew I made some mistake so had to read my post again and wanted to fix that but I got carried away with those tests, sorry :D

Anyway, I thought you are on custom rom as well, but I've misread that I guess. Based on those files from the stable MIUI 9.5 that are shared, there is a mismatch in values of both "media_profiles_X.xml" files. It might be the case that the "V1_0.xml is being utilized rather than "vendor.xml" but since I've modified them the other way around it doesn't matter as I've raised the bitrate (I hope effectively).

Also I found out why I had that underwater sound with custom settings in FV-5. Apparently if you set Encoding format to Automatic it makes a mess, setting it to AAC-LC works (as that was the encoder the app used when it used system settings).

---------- Post added at 21:58 ---------- Previous post was at 21:49 ----------

Even changing the max cap from 96K for each resolution? If you want, I'll share my .xml file so you can try with that one, they shouldn't be different regarding settings, but I'm not sure how advisable is that.

I have that camera built in, I've tried, the quality is awful, but to my surprise it's working with this Mi A2 port. Anyway sadly the sound is the same as all other apps that have AGC enabled.
[Xiaomi Redmi Note 5 Pro Questions & Answers] rocker00:
[MENTION=5070317]Cirra92[/MENTION] Yeah please share it and I'll compare it with both files in system and vendor to make sure where should i replace it!

The most bad thing is that am not able to try Mi Max 3 cam app since the audio recording is perfect with it...i downloaded both recovery and fastboot ROMs and not able to extract the whole priv-app folder on both and i don't know why!

I think we should request the app from the device forum here.
[Xiaomi Redmi Note 5 Pro Questions & Answers] Cirra92:
Ok so this file goes in vendor/etc, AFAIK there is no such file in system/etc but please do check twice.

Regarding Mi Max 3 I would be more interested to compare the media profiles files rather than the app, we might see interesting stuff there. We may ask in their subforum.
[Xiaomi Redmi Note 5 Pro Questions & Answers] rocker00:
Thanks...tomorrow i will get back with the result.

AGAIN AND AGAIN :D, AM USING MI MAX 3 FILES NOW INCLUDING MEDIAPROFILES.XML :D

the files are here if you want to have a look and compare:

https://drive.google.com/file/d/1Awy3kFWbqwop96raTRtaDkiA4WznOPi_/view
[Xiaomi Redmi Note 5 Pro Questions & Answers] Cirra92:
Yeah, report please so we can try to find the solution.

Oh for f**k sake why am I so distracted today :D Thank you my mind went somewhere else and I forgot :D

In the meantime I am going to try to enable 60fps recording, as some lines are missing from one of the files regarding HFR mode, and I'll maybe try this evening the guide for audio recording that was linked here, it may affect global recording settings.
[Xiaomi Redmi Note 5 Pro Questions & Answers] Cirra92:
[MENTION=4702982]rocker00[/MENTION] Since you have Mi Max 3 files, can you provide here the media_codecs.xml and media_codec_performance.xml from vendor/etc? Thanks :)
[Xiaomi Redmi Note 5 Pro Questions & Answers] rocker00:
Sure...here you go.

https://drive.google.com/file/d/1FBalesWnFN4dT3jd9NYLRXD4B-uh9csa/view
[Xiaomi Redmi Note 5 Pro Questions & Answers] rocker00:
[MENTION=5070317]Cirra92[/MENTION] tried with your file...still the same!
[Xiaomi Redmi Note 5 Pro Questions & Answers] Cirra92:
Well damn, there must be something else controling the bitrate in MIUI. At least we know what needs to be changed on AOSP. I don't plan to flash MIUI anytime soon I guess, so I'm not able to mess around with it :S
[Xiaomi Redmi Note 5 Pro Questions & Answers] lukesan:
So it might be the miui camera, but I highly doubt that since it would sound crappy then on open camera etc

My bet is the *.so file now
[Xiaomi Redmi Note 5 Pro Questions & Answers] rocker00:
:good:

Cinema FV-5 has the option to disable AGC and with some extra steps we managed to get better audio, maybe the same with Mi Max 3 cam app! AGC is disabled by default without settings and the app can controls the aac bitRate!

I will try to get this app ASAP!
[Xiaomi Redmi Note 5 Pro Questions & Answers] lukesan:
I've been emailing the guys from FV5 but unfortunately no reply so far, a bit frustrating since that software works on all my other phones. Not sure if we can mess with open camera since that one I thought is open source. 1 very good universal solution would be good enough for me.
[Xiaomi Redmi Note 5 Pro Questions & Answers] Cirra92:
Well if we assume that Mi Max 3 has the same/similar set of features hence the same/similar files and values, it might be the case that default MIUI app from it doesn't call for info from *.so files to use AGC, but then again it might not have the same audio settings in those *.so files so the app itself might not help. If the 3rd party apps have the same recording quality as the stock one, than it would be clear that there is no AGC (or at least it has been tuned differently).

I've just tested Open camera, it doesn't have the ability to turn off AGC, and it has the same quality as others.

Honestly I don't mind recording with FV-5 for now at least, but it would be good if we can find a solution to disable AGC system-wide.
[Xiaomi Redmi Note 5 Pro Questions & Answers] rocker00:
Bad news!

I successfully managed to extract the app, used it along with the xml files and the same result...LOL!!!

Just now i can confirm that it's all about ****in' libs!
[Xiaomi Redmi Note 5 Pro Questions & Answers] lukesan:
Ok gents... try this https://sourceforge.net/projects/opencamera/files/test_20180612/

Download that version and go into 'video settings' and 'audio source' and choose 'unprocessed' and let me know what you think ;)

edit :crap just plugged in earphones : mono
[Xiaomi Redmi Note 5 Pro Questions & Answers] lukesan:
Wow sounds good. Was a bit busy the last couple of days to really test stuff.

I have 2 hours tomorrow morning to do some testing. My BT speaker arrived today so perfect tomorrow to not use my voice as the only test scenario.

I'm on 8.7.26 Xiaomi.eu rom.

of course I had to give it a quick try : tried 15, 50 and 80 ... all sound the same (good!)
[Xiaomi Redmi Note 5 Pro Questions & Answers] rocker00:
Enjoy it buddy :)

Tomorrow i'll keep testing with more values.

A message to Xiaomi:

stop ****ing your customers with some ****ING numbers and true or false....it's better to deliver the best experience!!!!!!!
[Xiaomi Redmi Note 5 Pro Questions & Answers] lukesan:
Should put back 85 in as a value and see if it's messed up again. Found it really strange that the 3 values sounded the same.

We might actually need to mess with the values of the mic's but I'm not really a fan of that since that could mess up the hands free calls etc

... tomorrow

Well if no change I will leave it at 80 or so. Sound is great like it should (quick testing) and post processing to up the volume can still be applied. Adding bass that is not there is not possible and a AGC that is insanely fast is almost irreversible.

And yes I wonder if Xiaomi does this on purpose to make a difference between more expensive models or not.