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

Support for roles in files containing multiple audio stream. #91

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

smwhr
Copy link

@smwhr smwhr commented Aug 18, 2016

Specify either via

--role-map 1:main,2:main,3:commentary,4:commentary

or

--role-map-file roles.json

with roles.json containing :

{"1":{"role":"main"}, "2":{"role":"main"}, "3":{"role":"commentary"}, "4":{"role":"commentary"}}

The output is compatible with DashJS player.

@barbibulle
Copy link
Contributor

There's already an (undocumented) interface for setting the roles:
Using the --attributes command line option (which can be used once or more), you can set attributes for different parts of the presentation, including roles.
Example:
mp4dash --attributes video:role=main video.mp4

@smwhr
Copy link
Author

smwhr commented Aug 24, 2016

Maybe I'm mistaken, but if I have 2 audio streams in my source file that have the same bitrate (±10%) and the same language (and obviously the same codec), they become undistinguishable because the key of the dict is

adaptation_set_name = ('audio', track.language, track.codec_family)

so AddDescriptor never gets to be applied to individual streams, only to a group of them.

And furthermore, despite having wildly different roles (one is commentary, one is the actual soundtrack)(and to complicate the matter, I have them in both english and french, and each in 2 qualities), they finish in the same Adaptation set at the end which is not the intended output.

What I want in the end is something along the lines of :

<MPD>
 <Period>
  <!-- video -->
  <AdaptationSet mimeType="video/mp4">
    <Representation bandwidth="228964"></Representation>
    <Representation bandwidth="113904"></Representation>
  </AdaptationSet>
  <!-- audio -->
  <AdaptationSet mimeType="video/mp4" lang="en" mimeType="audio/mp4">
    <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
    <Representation audioSamplingRate="48000"></Representation>
    <Representation audioSamplingRate="16000"></Representation>
  </AdaptationSet>
  <AdaptationSet mimeType="video/mp4" lang="en" mimeType="audio/mp4">
    <Role schemeIdUri="urn:mpeg:dash:role:2011" value="commentary"/>
    <Representation audioSamplingRate="48000"></Representation>
    <Representation audioSamplingRate="16000"></Representation>
  </AdaptationSet>
  <AdaptationSet mimeType="video/mp4" lang="fr" mimeType="audio/mp4">
    <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
    <Representation audioSamplingRate="48000"></Representation>
    <Representation audioSamplingRate="16000"></Representation>
  </AdaptationSet>
  <AdaptationSet mimeType="video/mp4" lang="fr" mimeType="audio/mp4">
    <Role schemeIdUri="urn:mpeg:dash:role:2011" value="commentary"/>
    <Representation audioSamplingRate="48000"></Representation>
    <Representation audioSamplingRate="16000"></Representation>
  </AdaptationSet>
 </Period>
</MPD>

@barbibulle
Copy link
Contributor

I see what you mean. I was planning on adding support for grouping tracks together (not just for audio, but for alternate video angles too), using a unified mechanism. That would handle this case of multiple versions (with different roles) of audio tracks with the same language. I should have that feature ready fairly soon.

@smwhr
Copy link
Author

smwhr commented Aug 24, 2016

That would be great ! Let me know, I'll make the changes on my side.

@smwhr
Copy link
Author

smwhr commented Aug 7, 2017

Hi @barbibulle, do you know if your universal grouping mechanism is still scheduled in a near future ?
The same problem is arising in the mp4-hls.py script : same codec and language lead to only 1 alternate audio stream to be selected and actually exported in the final hls directory. I think it would be nice to have the same mechanism here.

If you're busy at the moment, to do hesitate to contact me and maybe we can discuss what you intended to do and I can implement it.

best and thanks for the great work and updates on the rest of the code.

@st1ng2
Copy link

st1ng2 commented May 21, 2020

I see what you mean. I was planning on adding support for grouping tracks together (not just for audio, but for alternate video angles too), using a unified mechanism. That would handle this case of multiple versions (with different roles) of audio tracks with the same language. I should have that feature ready fairly soon.

Is this feature implemented? If yes, give an example please, I can not find (or understand) from the documentation.

@barbibulle
Copy link
Contributor

I see what you mean. I was planning on adding support for grouping tracks together (not just for audio, but for alternate video angles too), using a unified mechanism. That would handle this case of multiple versions (with different roles) of audio tracks with the same language. I should have that feature ready fairly soon.

Is this feature implemented? If yes, give an example please, I can not find (or understand) from the documentation.

Yes, the current version allows you to specify labels on the audio sources, which can be used tp keep multiple tracks with the same language and codec and bitrate. Is that what you're looking for? I can give an example if that's the case.

@st1ng2
Copy link

st1ng2 commented May 22, 2020

I see what you mean. I was planning on adding support for grouping tracks together (not just for audio, but for alternate video angles too), using a unified mechanism. That would handle this case of multiple versions (with different roles) of audio tracks with the same language. I should have that feature ready fairly soon.

Is this feature implemented? If yes, give an example please, I can not find (or understand) from the documentation.

Yes, the current version allows you to specify labels on the audio sources, which can be used tp keep multiple tracks with the same language and codec and bitrate. Is that what you're looking for? I can give an example if that's the case.

I am looking for command, that allows grouping of DASH/HLS audio for different quality videos (e.g. stereo for low quality video, surround for high quality video) If possible, please, give an example command.

@StephanGerbeth
Copy link

Hi,

I also need this option for viewpoints. Can you publish a sample how to use it?

mp4dash --mpd-name=manifest.mpd --hls --attributes video:{urn:mpeg:dash:role:2011}viewpoint=vp1 ../tmp-video-1080.mp4 ../tmp-video-720.mp4 ../tmp-audio-en.mp4 ../tmp-audio-es.mp4 \[+format=webvtt,+language=de\]../de.vtt \[+format=webvtt,+language=en\]../en.vtt

With the solution above I only have one video adaptation set with a viewpoint declaration. But i need multiple video adaptation sets with different viewpoint declarations :)
How can I do that?

Cheers
Stephan

@ai-93
Copy link

ai-93 commented Jul 7, 2021

I see what you mean. I was planning on adding support for grouping tracks together (not just for audio, but for alternate video angles too), using a unified mechanism. That would handle this case of multiple versions (with different roles) of audio tracks with the same language. I should have that feature ready fairly soon.

Is this feature implemented? If yes, give an example please, I can not find (or understand) from the documentation.

Yes, the current version allows you to specify labels on the audio sources, which can be used tp keep multiple tracks with the same language and codec and bitrate. Is that what you're looking for? I can give an example if that's the case.

@barbibulle could you provide an example for this case that you mentioned(multiple track with same language and specify label)

@AswinParanji
Copy link

Can you provide an example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants