phoboslab / jsmpeg

MPEG1 Video Decoder in JavaScript
MIT License
6.34k stars 1.43k forks source link

How to achieve 5.1 or at least 2.1 audio? #260

Open revofire opened 5 years ago

revofire commented 5 years ago

So I have a good working build right now but MP2 on JSMPEG is limited to Stereo, I wanted to achieve at least 2.1 or if possible, 5.1. I see in later specs of MP2 that this becomes acceptable. Is JSMPEG capable or will be capable of this in the near future? If not, what is the alternative, what methodology should I use? I don't think MPEG-TS accepts anything else, is it possible to have another audio decoder work simultaneously work in JS with this?

So currently I use OBS that proxies FFMPEG, so if FFMPEG can mix into this revision of MP2 then we're golden for that. Then it's a question of the decoder and making it still stay in sync with the frames...

https://en.wikipedia.org/wiki/MPEG-1#MPEG-2_audio_extensions

jadaradix commented 5 years ago

You should handle audio outside of jsmpeg. jsmpeg only implements mpeg1.

mpeg1 allows mp3 audio, which supports only 2 channels.

I think you will have a hard time getting a browser to play > stereo anyway. I sunk a lot of time to this and tldr: it's not going to happen. The last I heard was Dolby + Edge having a "Windows based" partnership @ http://audioexperience.dolby.com/

AndreaMonzini commented 4 years ago

@revofire as alternative you could consider to produce binaural audio that works with stereo. But then you can experience 3D surround audio mainly with headphones / earphones. I am studying binaural audio and it very interesting :)

https://en.wikipedia.org/wiki/Binaural_recording