Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select and playing different tracks from a stream. #674

Closed
smartic opened this issue Feb 16, 2022 · 2 comments
Closed

Select and playing different tracks from a stream. #674

smartic opened this issue Feb 16, 2022 · 2 comments
Labels

Comments

@smartic
Copy link

smartic commented Feb 16, 2022

Hello

I'm new using OvenMediaEngine and maybe this is a very simple question, but I've gone through documentation and forums with no luck.

I am sending a Streaming with a video track and several audio tracks with OBS. This part is working fine for me.

However, I am unable to select and connect to the different audio tracks in players like VLC or video.js.

Querying through the API, all the tracks are available there apparently:

curl -H "authorization: Basic b21lLWFjY2Vzcy10b2tlbg==" -i 192.168.10.150:8081/v1/vhosts/default/apps/app/streams/stream
HTTP/1.1 200 OK
Content-Length: 952
Server: OvenMediaEngine
Content-Type: application/json;charset=UTF-8

{"message":"OK","response":{"input":{"createdTime":"2022-02-16T17:42:47.697+01:00","sourceType":"SRT","sourceUrl":"SRT://192.168.10.33:53584","tracks":
[{"type":"Video","video":{"bitrate":"0","bypass":false,"codec":"H264","framerate":0.0,"height":1080,"width":1920}},
{"audio":{"bitrate":"0","bypass":false,"channel":2,"codec":"AAC","samplerate":48000},"type":"Audio"},
{"audio":{"bitrate":"0","bypass":false,"channel":2,"codec":"AAC","samplerate":48000},"type":"Audio"},
{"audio":{"bitrate":"0","bypass":false,"channel":2,"codec":"AAC","samplerate":48000},"type":"Audio"},
{"audio":{"bitrate":"0","bypass":false,"channel":2,"codec":"AAC","samplerate":48000},"type":"Audio"}]},
"name":"stream","outputs":[{"name":"stream","tracks":
[{"type":"Video","video":{"bypass":true}},
{"audio":{"bypass":true},"type":"Audio"},
{"audio":{"bypass":true},"type":"Audio"},
{"audio":{"bypass":true},"type":"Audio"},
{"audio":{"bypass":true},"type":"Audio"}]}]},
"statusCode":200}

Do you know how to select and play between the different audio tracks? How can you check the "label", "language" and "enabled" metadata in the .m3u8 output stream?, as discussed in "https://github.com/videojs/http-streaming/blob/main/docs/multiple-alternative-audio-tracks.md"

Thank you very much and greetings.

Here i send you my Server.xml:

OvenMediaEngine origin 192.168.10.150 false
    <!--
    To get the public IP address(mapped address of stun) of the local server.
    This is useful when OME cannot obtain a public IP from an interface, such as AWS or docker environment.
    If this is successful, you can use ${PublicIP} in your settings.
    -->
    <StunServer>stun.l.google.com:19302</StunServer>

    <!-- Settings for the ports to bind -->
    <Bind>
            <!-- Enable this configuration if you want to use API Server -->

            <Managers>
                    <API>
                            <Port>8081</Port>
                            <WorkerCount>1</WorkerCount>
                    </API>
            </Managers>


            <Providers>
                    <!-- Pull providers -->
                    <RTSPC>
                            <WorkerCount>1</WorkerCount>
                    </RTSPC>
                    <OVT>
                            <WorkerCount>1</WorkerCount>
                    </OVT>
                    <!-- Push providers -->
                    <RTMP>
                            <Port>1935</Port>
                            <WorkerCount>1</WorkerCount>
                    </RTMP>
                    <SRT>
                            <Port>9999</Port>
                            <WorkerCount>1</WorkerCount>
                    </SRT>
                    <MPEGTS>
                            <!--
                                    Listen on port 4000~4005 (<Port>4000-4004,4005/udp</Port>)
                                    This is just a demonstration to show that you can configure the port in several ways
                            -->
                            <Port>4000-4003,4004,4005/udp</Port>
                    </MPEGTS>
                    <WebRTC>
                            <Signalling>
                                    <Port>3333</Port>
                                    <!-- If you want to use TLS, specify the TLS port -->
                                    <!-- <TLSPort>3334</TLSPort> -->
                                    <WorkerCount>1</WorkerCount>
                            </Signalling>

                            <IceCandidates>
                                    <!--
                                            If you want to stream WebRTC over TCP, specify IP:Port for TURN server.
                                            This uses the TURN protocol, which delivers the stream from the built-in TURN server to the player's TURN client over TCP.
                                            For detailed information, refer https://airensoft.gitbook.io/ovenmediaengine/streaming/webrtc-publishing#webrtc-over-tcp
                                    -->
                                    <TcpRelay>*:3478</TcpRelay>
                                    <!-- TcpForce is an option to force the use of TCP rather than UDP in WebRTC streaming. (You can omit ?transport=tcp accordingly.) If <TcpRelay> is not set, playback may fail. -->
                                    <TcpForce>true</TcpForce>

                                    <IceCandidate>*:10000/udp</IceCandidate>
                                    <TcpRelayWorkerCount>1</TcpRelayWorkerCount>
                            </IceCandidates>
                    </WebRTC>
            </Providers>

            <Publishers>
                    <OVT>
                            <Port>9000</Port>
                            <WorkerCount>1</WorkerCount>
                    </OVT>
                    <HLS>
                            <Port>8080</Port>
                            <!-- If you want to use TLS, specify the TLS port -->
                            <!-- <TLSPort>443</TLSPort> -->
                            <WorkerCount>1</WorkerCount>
                    </HLS>
                    <DASH>
                            <Port>8080</Port>
                            <!-- If you want to use TLS, specify the TLS port -->
                            <!-- <TLSPort>443</TLSPort> -->
                            <WorkerCount>1</WorkerCount>
                    </DASH>
                    <WebRTC>
                            <Signalling>
                                    <Port>3333</Port>
                                    <!-- If you want to use TLS, specify the TLS port -->
                                    <!-- <TLSPort>3334</TLSPort> -->
                                    <WorkerCount>1</WorkerCount>
                            </Signalling>
                            <IceCandidates>
                                    <!--
                                            If you want to stream WebRTC over TCP, specify IP:Port for TURN server.
                                            This uses the TURN protocol, which delivers the stream from the built-in TURN server to the player's TURN client over TCP.
                                            For detailed information, refer https://airensoft.gitbook.io/ovenmediaengine/streaming/webrtc-publishing#webrtc-over-tcp
                                    -->
                                    <TcpRelay>*:3478</TcpRelay>
                                    <!-- TcpForce is an option to force the use of TCP rather than UDP in WebRTC streaming. (You can omit ?transport=tcp accordingly.) If <TcpRelay> is not set, playback may fail. -->
                                    <TcpForce>true</TcpForce>

                                    <IceCandidate>*:10000/udp</IceCandidate>
                                    <TcpRelayWorkerCount>1</TcpRelayWorkerCount>
                            </IceCandidates>
                    </WebRTC>

                    <!--
                    <FILE>
                            <RootPath>/mnt/shared_volumes</RootPath>
                            <FilePath>/${VirtualHost}/${Application}/${Stream}/${StartTime:YYYYMMDDhhmmss}_${EndTime:YYYYMMDDhhmmss}.ts</FilePath>
                            <InfoPath>/${VirtualHost}/${Application}/${Stream}.xml</InfoPath>
                    </FILE>
                    -->

            </Publishers>
    </Bind>

    <!-- P2P works only in WebRTC -->
    <!--
    <P2P>
            <MaxClientPeersPerHostPeer>2</MaxClientPeersPerHostPeer>
    </P2P>
    -->

    <!--
            Enable this configuration if you want to use API Server

            <AccessToken> is a token for authentication, and when you invoke the API, you must put "Basic base64encode(<AccessToken>)" in the "Authorization" header of HTTP request.
            For example, if you set <AccessToken> to "ome-access-token", you must set "Basic b21lLWFjY2Vzcy10b2tlbg==" in the "Authorization" header.
    -->

    <Managers>
            <Host>
                    <Names>
                            <Name>*</Name>
                    </Names>
                    <!--
                            If you want to set up TLS, set it up by referring to the following:
                    <TLS>
                            <CertPath>path/to/file.crt</CertPath>
                            <KeyPath>path/to/file.key</KeyPath>
                            <ChainCertPath>path/to/file.crt</ChainCertPath>
                    </TLS>
                    -->
            </Host>
            <API>
                    <AccessToken>ome-access-token</AccessToken>
            </API>
    </Managers>


    <VirtualHosts>
            <!-- You can use wildcard like this to include multiple XMLs -->
            <VirtualHost include="VHost*.xml" />
            <VirtualHost>
                    <Name>default</Name>
                    <!--Distribution is a value that can be used when grouping the same vhost distributed across multiple servers. This value is output to the events log, so you can use it to aggregate statistics. -->
                    <Distribution>ovenmediaengine.com</Distribution>

                    <!-- Settings for multi ip/domain and TLS -->
                    <Host>
                            <Names>
                                    <!-- Host names
                                            <Name>stream1.airensoft.com</Name>
                                            <Name>stream2.airensoft.com</Name>
                                            <Name>*.sub.airensoft.com</Name>
                                            <Name>192.168.0.1</Name>
                                    -->
                                    <Name>*</Name>
                            </Names>
                            <!--
                            <TLS>
                                    <CertPath>path/to/file.crt</CertPath>
                                    <KeyPath>path/to/file.key</KeyPath>
                                    <ChainCertPath>path/to/file.crt</ChainCertPath>
                            </TLS>
                            -->
                    </Host>

                    <!--
                    Refer https://airensoft.gitbook.io/ovenmediaengine/signedpolicy
                    <SignedPolicy>
                            <PolicyQueryKeyName>policy</PolicyQueryKeyName>
                            <SignatureQueryKeyName>signature</SignatureQueryKeyName>
                            <SecretKey>aKq#1kj</SecretKey>

                            <Enables>
                                    <Providers>rtmp,webrtc,srt</Providers>
                                    <Publishers>webrtc,hls,dash,lldash</Publishers>
                            </Enables>
                    </SignedPolicy>
                    -->

                    <!--
                    <AdmissionWebhooks>
                            <TargetUrl></TargetUrl>
                            <SecretKey></SecretKey>
                            <Timeout>3000</Timeout>
                            <Enables>
                                    <Providers>rtmp,webrtc,srt</Providers>
                                    <Publishers>webrtc,hls,dash,lldash</Publishers>
                            </Enables>
                    </AdmissionWebhooks>
                    -->

                    <!-- <Origins>
                            <Properties>
                                    <NoInputFailoverTimeout>3000</NoInputFailoverTimeout>
                                    <UnusedStreamDeletionTimeout>60000</UnusedStreamDeletionTimeout>
                            </Properties>
                            <Origin>
                                    <Location>/app/stream</Location>
                                    <Pass>
                                            <Scheme>ovt</Scheme>
                                            <Urls><Url>origin.com:9000/app/stream_720p</Url></Urls>
                                    </Pass>
                                    <ForwardQueryParams>false</ForwardQueryParams>
                            </Origin>
                            <Origin>
                                    <Location>/app/</Location>
                                    <Pass>
                                            <Scheme>ovt</Scheme>
                                            <Urls><Url>origin.com:9000/app/</Url></Urls>
                                    </Pass>
                            </Origin>
                            <Origin>
                                    <Location>/edge/</Location>
                                    <Pass>
                                            <Scheme>ovt</Scheme>
                                            <Urls><Url>origin.com:9000/app/</Url></Urls>
                                    </Pass>
                            </Origin>
                    </Origins> -->

                    <!-- Settings for applications -->
                    <Applications>
                            <Application>
                                    <Name>app</Name>
                                    <!-- Application type (live/vod) -->
                                    <Type>live</Type>
                                    <OutputProfiles>
                                            <!-- Enable this configuration if you want to hardware acceleration using GPU -->
                                            <HardwareAcceleration>false</HardwareAcceleration>
                                            <OutputProfile>
                                                    <Name>bypass_stream</Name>
                                                    <OutputStreamName>${OriginStreamName}</OutputStreamName>
                                                    <Encodes>
                                                            <Audio>
                                                                    <Bypass>true</Bypass>
                                                            </Audio>
                                                            <Video>
                                                                    <Bypass>true</Bypass>
                                                            </Video>
                                                            <!-- <Audio>
                                                                    <Codec>opus</Codec>
                                                                    <Bitrate>160000</Bitrate>
                                                                    <Samplerate>48000</Samplerate>
                                                                    <Channel>3</Channel>
                                                            </Audio>
                                                            <Audio>
                                                                    <Codec>opus</Codec>
                                                                    <Bitrate>160000</Bitrate>
                                                                    <Samplerate>48000</Samplerate>
                                                                    <Channel>5</Channel>
                                                            </Audio>
                                                            <Audio>
                                                                    <Codec>opus</Codec>
                                                                    <Bitrate>160000</Bitrate>
                                                                    <Samplerate>48000</Samplerate>
                                                                    <Channel>7</Channel>
                                                            </Audio>
                                                            <Audio>
                                                                    <Codec>opus</Codec>
                                                                    <Bitrate>160000</Bitrate>
                                                                    <Samplerate>48000</Samplerate>
                                                                    <Channel>8</Channel>
                                                            </Audio>

                                                            <Video>
                                                                    <Codec>vp8</Codec>
                                                                    <Bitrate>1024000</Bitrate>
                                                                    <Framerate>30</Framerate>
                                                                    <Width>1280</Width>
                                                                    <Height>720</Height>
                                                                    <Preset>faster</Preset>
                                                            </Video> -->

                                                    </Encodes>
                                            </OutputProfile>

                                    </OutputProfiles>

                                    <Providers>
                                            <OVT />
                                            <WebRTC />
                                            <RTMP />
                                            <SRT />
                                            <MPEGTS>
                                                    <StreamMap>
                                                            <!--
                                                                    Set the stream name of the client connected to the port to "stream_${Port}"
                                                                    For example, if a client connets to port 4000, OME creates a "stream_4000" stream
                                                                    <Stream>
                                                                            <Name>stream_${Port}</Name>
                                                                            <Port>4000,4001-4004</Port>
                                                                    </Stream>
                                                                    <Stream>
                                                                            <Name>stream_4005</Name>
                                                                            <Port>4005</Port>
                                                                    </Stream>
                                                            -->
                                                            <Stream>
                                                                    <Name>stream_${Port}</Name>
                                                                    <Port>4000,4001-4004</Port>
                                                            </Stream>
                                                            <Stream>
                                                                    <Name>stream_4005</Name>
                                                            <Port>4005</Port>
                                                    </Stream>
                                                    </StreamMap>
                                            </MPEGTS>
                                            <RTSPPull />
                                            <WebRTC>
                                                    <Timeout>30000</Timeout>
                                            </WebRTC>
                                    </Providers>
                                    <Publishers>
                                            <AppWorkerCount>1</AppWorkerCount>
                                            <StreamWorkerCount>8</StreamWorkerCount>
                                            <OVT />
                                            <WebRTC>
                                                    <Timeout>30000</Timeout>
                                                    <Rtx>false</Rtx>
                                                    <Ulpfec>false</Ulpfec>
                                                    <JitterBuffer>false</JitterBuffer>
                                            </WebRTC>
                                            <HLS>
                                                    <SegmentDuration>5</SegmentDuration>
                                                    <SegmentCount>3</SegmentCount>
                                                    <CrossDomains>
                                                            <Url>*</Url>
                                                    </CrossDomains>
                                            </HLS>
                                            <DASH>
                                                   <SegmentDuration>5</SegmentDuration>
                                                    <SegmentCount>3</SegmentCount>
                                                    <CrossDomains>
                                                            <Url>*</Url>
                                                    </CrossDomains>
                                                    <!--
                                                            Enable DASH player to obtain UTCTiming from OME using /time?iso&ms API
                                                    -->
                                                    <UTCTiming>
                                                            <Scheme>urn:mpeg:dash:utc:http-xsdate:2014</Scheme>
                                                            <Value>/time?iso&amp;ms</Value>
                                                    </UTCTiming>
                                            </DASH>
                                            <LLDASH>
                                                    <SegmentDuration>5</SegmentDuration>
                                                    <CrossDomains>
                                                            <Url>*</Url>
                                                    </CrossDomains>
                                                    <!--
                                                            Use default options for UTCTiming
                                                                    - scheme: urn:mpeg:dash:utc:http-xsdate:2014
                                                                    - value: /time?iso&ms
                                                    -->
                                                    <UTCTiming />
                                            </LLDASH>
                                    </Publishers>
                            </Application>
                    </Applications>
            </VirtualHost>
    </VirtualHosts>

CapturaOBS1

@smartic smartic added the help label Feb 16, 2022
@getroot
Copy link
Member

getroot commented Feb 17, 2022

Unfortunately, OvenMediaEnigne's HLS does not yet support multiple audio tracks. In OME, the first video track and the first audio track are muxed into one TS. To solve this, video and audio must be separated in HLS, which we plan to do in the LLHLS task. (#480)

@smartic
Copy link
Author

smartic commented Feb 17, 2022

thank you very much for answering me,
best regards

@smartic smartic closed this as completed Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants