[Galaxy S 4 i9506 Android Development] Yoshi_523:
I found out how to fix a bug in Lineage ROM that was causing Open Camera and most camera apps to record video with only low quality 96Kbps AAC audio. Now I can record my videos with high bitrate 320Kbps AAC audio. I'm hoping this should make a big difference especially once I connect my external Rode VideoMic.

So I noticed that older videos I recorded on Open Camera with my old official Samsung ROM (based on Android 5.01) recorded with 256Kbps AAC audio. This was when I recorded at the max resolution for my Samsung S4 which is 1080p. However I recently wiped the OS and loaded the latest Unofficial Lineage ROM from this XDA thread (based on Android 10). When recording videos in the full 1080p in Open Camera they only came out with low quality 96Kbps AAC audio. I tried changing all settings in Open Camera. I could easily change the video bit rate but nothing changed the audio bit rate. Annoying as some other video camera apps like the outdated Cinema FV-5 (from 2015) seems to work fine for adjusting the audio bitrate as well as the video bitrate.

Anyway long story short I found that the settings are in a file called "media_profiles.xml" (or something very similar like "media_profiles_V1_0.xml") under the Root folder. For Android 5 it's under the "/etc/" folder in root folder. For Lineage based on Android 10 it's under "/vendor/etc/" folder in root folder. So you'll need root privillages to edit the file and file explorer that allowes access to the root folder with an inbuilt txt editor (I use MiXplorer).

Open the media_profiles.xml in a txt editor. There will be a number of video profiles each under the heading of the camera it's associated with. For this example I'm editing a video profile under:

<CamcorderProfiles cameraId="0">

"cameraId=0" is my main back camera and my front camera is under the heading "cameraId=1". If you have multiple camera be aware of this as each one starting from 0 then 1, 2, 3 ect will have video profiles. I'll keep it simple and show the example for the main camera but then you can repeat for other cameras if you wish.

Under the heading: <CamcorderProfiles cameraId="0"> I am looking for profiles listed as 1080p as this is the highest res my camera supports. Here is my example:

</EncoderProfile>

<EncoderProfile quality="1080p" fileFormat="mp4" duration="30">

<Video codec="h264"

bitRate="17000000"

width="1920"

height="1080"

frameRate="30" />

<Audio codec="aac"

bitRate="96000"

sampleRate="48000"

channels="2" />

I simply change bitRate="96000" to 320000.

Lastly I need to check the setting further down the page for the AAC Audio Codec Profile.

Here's the example I'm looking for:

<AudioEncoderCap name="aac" enabled="true"

minBitRate="8192" maxBitRate="256000"

minSampleRate="8000" maxSampleRate="48000"

minChannels="1" maxChannels="2" />

I simply change maxBitRate="256000" to 320000. Save media_profiles.xml and exit txt editor & file manager. Restart phone.

In Open Camera settings I select the video resolution option of 1080p (as this is the connected to the profile name we just edited). Now I can record a video. And when I open it and check the file details (such as in MXPlayer) it clearly shows it's recorded in 320Kbps AAC audio.

I've attached 2 screenshots of the Media_Profiles.xml showing the edits I've done as explained above to get 320Kbps AAC audio to work when recording 1080p video.