google chrome – HTML5 video player: How the audio stream is chosen when there are multiple options
I’m building a web app to run on my home LAN, which will stream video files from a central server to whichever device I feel like watching on.
These video files (.mp4, .mkv, etc.) often have multiple audio streams/tracks. These streams within a single file may or may not vary in encoding (AAC, AC3, MP3, etc.).
My question is, how can I predict which audio stream will actually be used when the video is played in an HTML5 element? (I have a feeling this might vary from browser to browser, so if I have to pick one for the sake of the question, let’s go with Google Chrome).
I’ve been able to figure out some information by trial and error, but I haven’t been able to find any actual documentation. For example, I know that Google Chrome refuses to play AC3 audio. When presented with a video file containing only an AC3 audio stream, it will play silently (no sound). Presented with a video containing both an AC3 stream and an AAC stream, it will play the latter- the only one it supports.
However, I don’t know what method it uses to, say, pick between two AAC streams. Does it just pick the one with the lowest stream index? Does it attempt to filter based on the tagged language of the stream? Does it evaluate the connected hardware and take channels into account (e.g., selecting a 5.1 stream when appropriate hardware is connected)?
I’d appreciate if anyone can link to any documentation regarding the above. I’ve been searching for hours and haven’t managed to find any. Or, short of that, share your experience. Ideally, I’d like to be able to structure my audio streams in a way where my ‘preferred’ streams are used when supported, and progressively worse streams are used as fallbacks when compatibility is worse.
Read more here: Source link
