moonlight-stream / moonlight-android

GameStream client for Android
GNU General Public License v3.0
4.31k stars 683 forks source link

LPCM to AC-3 #1095

Open jonathanmassehsj opened 2 years ago

jonathanmassehsj commented 2 years ago

Is your feature request related to a problem? Please describe. If you cannot output LCPM 5.1 or 7.1, it would be nice to have the options to convert to AC-3 or E-AC-3 in Moonlight.

Describe the solution you'd like There is a library that is available "ffmpeg", I'm not sure about the licensing but it should be easy to integrate.

There is also an option to use stream "PipeStream" instead of file. (So moonlight will be able to stream directly to ffmpeg (i.e. LCPM 5.1 or 7.1) and ffmpeg will stream it back to moonlight to the converted fomat like AC-3)

Once received by moonlight it will be able to write the AC-3 stream at AndroidAudioRenderer.java / line 198

Additional context Exemple : https://www.geeksforgeeks.org/how-to-use-ffmpeg-in-android-with-example/

I'm not sure about the licensing if an options like this in moonlight will violate the copyright but inside Nvidia shield there is a similar option (AC-3) transcoding, basically, any sound coming from the computer (GeForce experience) is transcoded into AC-3. image

peerobo commented 2 years ago

I think it will add delay to the audio/video syncing.

veldenb commented 1 year ago

I would also be interested in this option. My Android TV only supports AC3 to my receiver. I would prefer slightly delayed 5.1 audio (a few msec) instead of stereo without delay. Most important to me is that the video isn't delayed with the audio. If a warning is added to the AC3 option that this may delays audio I think it would be fine.

If the delay is too high I can imagine the option becomes useless, so it would be interesting to know how much delay it would introduce. Android TV's are becoming more powerful these days (mine streams 4k@120hz) so i think some extra transcoding wouldn't hurt the performance too much.

edit: just an idea, maybe can Sunshine encode directly in AC3 somehow?

kentyman23 commented 10 months ago

This could be nice for things like the Fire TV Stick 4K Max (1st Gen, 2021) which only do 6 channels of PCM output but support 8 channels for many other codecs. If eAC3 has royalty issues, perhaps Opus would work instead?

See #1295 for some similar discussion.

fidoboy commented 5 months ago

It could be way much better to have this into the Sunshine streaming server, so instead raw PCM audio stream could also be selected AC3 format. The same than it can stream into h264 or h265 or AV1 image formats it could be useful to allow PCM or AC3 formats to the clients.