marissa999 / decky-recorder

Other
66 stars 7 forks source link

Implement AAC audio encoding using FAAC #42

Closed DerpyChap closed 1 year ago

DerpyChap commented 1 year ago

This PR changes the audio encoding from MP3 to AAC, which should hopefully improve audio quality and compatibility, especially with Apple devices (fixing #21).

I'm currently using the faac plugin for GStreamer, which involves pulling in the gst-plugins-bad package, which isn't ideal considering the amount of extra plugins being added that will be going unused, but I'm not sure if there's much I can do to cut down on file sizes there (although overall space used still seems fine to me).

Compared to the other AAC encoders for GStreamer, I found FAAC to be the easiest to get working and didn't have any issues, so I just went with that. One thing to be aware of is that its bitrate option uses bits intsead of kilobits, which I've adjusted for in main.py.

I also increased the bitrate to 192 kbps from 128, which should improve audio quality further and helps combat generational loss from YouTube, Twitter and other services re-encoding the audio. 160 would probably also be fine, ultimately this change doesn't really matter too much so feel free to set it to whatever you're most happy with.

In my limited testing things still seem to perform the same as before, although I'd probably recommend double checking things yourself just to make sure.

Sample recording (excuse my poor gamplay lol): https://safe.derpychap.co.uk/eoSbVvNP.mp4

safijari commented 1 year ago

My only concern would be filesize. Is there an impact on the filesize and if yes, how much?

No worries about pulling in more plugins.

DerpyChap commented 1 year ago

My only concern would be filesize. Is there an impact on the filesize and if yes, how much?

No worries about pulling in more plugins.

For a 30 minute recording the filesize will increase by ~14MB at 192kbps, which doesn't seem like it'd be too drastic of an increase to me.

safijari commented 1 year ago

Ok. Approved