Skip to content

sout: duplicate: Properly handle ES string IDs

Alaric Senat requested to merge asenat/vlc:sout-duplicate-str-id into master

For uniqueness of the ES string IDs, duplicate should synthesize different ES IDs for each duplicated ES. This patch-set add a /duplicated-stream suffix to the duplicated ES followed by the stream number. The original ES keeps their former ES ID.

Example:

               +-----------+ -- video/1 ---------------------->
               |           | -- audio/2 ---------------------->
 -- video/1 -->| duplicate | -- video/1/duplicated-stream-1 -->
 -- audio/2 -->|           | -- audio/2/duplicated-stream-1 -->
               |           | -- video/1/duplicated-stream-2 -->
               +-----------+ -- audio/2/duplicated-stream-2 -->

Additionally, I've added an optional `suffix` parameter to the duplicated streams. The ES ID suffix can be used to synthesize meaningful ES IDs.

By default, duplicated ES string IDs follows the .../duplicated-stream-N scheme. This approach is great for scenarios where users don't mind ES naming or for simple stream output chains. For advanced stream output chains where ES ID needs to be easily readable or tied to a context, specifying the ES ID suffix become important.

For example, the following pipeline outputs an HLS stream with two renditions of the video track:

duplicate{
    dst="",                                                                # Forward all original tracks to the sink.
    dst="transcode{vcodec=h264,height=480}", select="video", suffix="low", # Duplicate and downscale the video track.
}:hls{
    variants={
      {video/1},    # Rendition 1: The original video track.
      {video/1/low} # Rendition 2: Suffixed downscaled video track.
    }
}
Edited by Alaric Senat

Merge request reports