Bento4
Bento4 copied to clipboard
Support for roles in files containing multiple audio stream.
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.
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
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>
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.
That would be great ! Let me know, I'll make the changes on my side.
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.
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.
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 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.
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
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)
Can you provide an example?