server icon indicating copy to clipboard operation
server copied to clipboard

Multiple stream handling

Open ronag opened this issue 7 years ago • 10 comments

Continuing of #812.

The current behavior is:

  • If filter audio input == 1
    • merge all audio streams into a single multi channel stream
  • If filter video input == 1
    • sort video streams by resolution
    • if video streams count >= 2 and top 2 streams have same resolution
      • alphamerge

This will NOT work 100% of the case, e.g. what if we have multiple quality audio streams etc...

Please help me figure out the edge cases and possible solutions.

ronag avatar Feb 15 '18 11:02 ronag

Checked and working:

  • sort by resolution
  • video stream count == 2 && same resolution alphamerge
  • merge audio streams

What might be an issue is an audiostream with multiple streams of the same type, but in different bitrates. Obviously, the audio streams will be merged, but this could be unwanted behaviour in this case. Do we need a way to disable this functionality?

pkeuter avatar Feb 15 '18 21:02 pkeuter

Merging of all audiotracks in track order regardless of their codec, bitrate etc is exactly the wanted behaviour. Think of main stereo track plus 5.1 surround track. Or stereo main track plus other language mixes etc. Unwanted tracks in output can be simply ignored or dropped.

premultiply avatar Feb 15 '18 22:02 premultiply

This is correct in regular use cases. But when playing a HLS or DASH stream which possibly contains the exact same audiostream, but in different qualities this is unwanted behaviour, and thus it would be good to make it at least possible to turn the automerge off.

Unwanted tracks in output can be simply ignored or dropped.

Can they at this moment?

pkeuter avatar Feb 15 '18 22:02 pkeuter

In broadcast it is fairly common to have separate monotracks, one mono for each stream. And that differs between broadcasters in how to map that. FL C FR or FL FR C That is also the default for Avid DNxHD vc-3 MXF op-1a. So we have to take hight for that.

5opr4ni avatar Feb 15 '18 22:02 5opr4ni

Its the same for HLS and DASH as they also support multi languages etc. You can not simply pass only the track with the highest something and drop the others.

Just decode all and let the user decide what he wants to deembed/hear.

premultiply avatar Feb 16 '18 05:02 premultiply

Which is exactly my point. We need a way to disable the automerge. Currently, to my best of knowing, it is always enabled. Which is good, because most of the files we're playing contain multiple different audio streams like @5opr4ni said. But sometimes, and I've said this in my previous post too, we have a regular stream, which contains the exact same audio, but in different bitrates. In this case it would make sense to disable the automerge by hand.

Again, I don't ask for the automerge to be disabled at all but a way to disable functionality for edge cases.

pkeuter avatar Feb 16 '18 06:02 pkeuter

You can use ffmpeg audio filters in 2.2 af pan=stereo|c0=c6|c1=c7

5opr4ni avatar Feb 16 '18 07:02 5opr4ni

Perfect. "Issue" solved then. This also helps with remapping the streams when the order is incorrect.

pkeuter avatar Feb 16 '18 07:02 pkeuter

Jepp!

5opr4ni avatar Feb 16 '18 07:02 5opr4ni

@ronag I assume this can be closed?

pkeuter avatar Mar 06 '18 18:03 pkeuter