axiomatic-systems / Bento4

Full-featured MP4 format, MPEG DASH, HLS, CMAF SDK and tools
http://www.bento4.com
2k stars 482 forks source link

Wrong value written for minimum height in adaptation set of dash manifest file #262

Closed Natarajan92 closed 6 years ago

Natarajan92 commented 6 years ago

Hi

We are facing a issue of wrong data written to dash.mpd file for minHeight in adaptation set but minimum profile height is proper under representation tag.

<AdaptationSet maxHeight="720" maxWidth="1280" mimeType="video/mp4" minHeight="720" minWidth="1024" segmentAlignment="true" startWithSAP="1">
media-video-1.mp4
</AdaptationSet>

Due to this mismatch data in adaptationset and representation tag will create playback problem or while profile switching from higher profile to lower profile will there be problem?

Bento4 version details for dash.py

./mp4-dash.py Usage: mp4-dash.py [options] [ ...]

Each is the path to a fragmented MP4 file, optionally prefixed with a stream selector delimited by [ and ]. The same input MP4 file may be repeated, provided that the stream selector prefixes select different streams. Version 1.7.0 r613

barbibulle commented 6 years ago

I'm not sure I understand the issue you're describing. Are you saying that when you create a DASH output with two input videos, one with height=X and the other one with height=Y, the minHeight attribute isn't set to MIN(X,Y) ?

Natarajan92 commented 6 years ago

Hi,

I have used three input videos and one audio file for creating dash output.

Video 1 - 4400Kbps 1280x720 Video 2 - 2400Kbps 1280x720 Video 3 - 1200Kbps 1024x576

After packing, the manifest file description of representation tags are proper but in adaptation set element it is not proper

Maximum height mentioned as 720 Maximum width as 1280

Minimum height also 720 but it should be 576 Minimum width 1024

Because of this wrong element in adaptation set will there be any problem on profile switchover?

barbibulle commented 6 years ago

I'll take a look and make sure this gets fixed. I don't think this should cause any real issue in practice however.

barbibulle commented 6 years ago

I've just tried to replicate this issue, but I'm not able to. Trying a simple invocation to 'mp4dash' with 6 different video streams, I get the min and max values as expected:

<?xml version="1.0" ?>
<MPD mediaPresentationDuration="PT12M14.167S" minBufferTime="PT3.00S" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011">
  <!-- Created with Bento4 mp4-dash.py, VERSION=1.8.0-622 -->
  <Period>
    <!-- Video -->
    <AdaptationSet maxHeight="534" maxWidth="1280" mimeType="video/mp4" minHeight="214" minWidth="512" segmentAlignment="true" startWithSAP="1">
      <SegmentTemplate duration="3000" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startNumber="1" timescale="1000"/>
      <Representation bandwidth="686777" codecs="avc1.42C015" frameRate="24" height="214" id="video/avc1/1" scanType="progressive" width="512"/>
      <Representation bandwidth="1116720" codecs="avc1.42C016" frameRate="24" height="294" id="video/avc1/2" scanType="progressive" width="704"/>
      <Representation bandwidth="1534737" codecs="avc1.42C01E" frameRate="24" height="362" id="video/avc1/3" scanType="progressive" width="864"/>
      <Representation bandwidth="1927524" codecs="avc1.42C01F" frameRate="24" height="428" id="video/avc1/4" scanType="progressive" width="1024"/>
      <Representation bandwidth="2361759" codecs="avc1.42C01F" frameRate="24" height="482" id="video/avc1/5" scanType="progressive" width="1152"/>
      <Representation bandwidth="2779983" codecs="avc1.42C01F" frameRate="24" height="534" id="video/avc1/6" scanType="progressive" width="1280"/>
    </AdaptationSet>
    <!-- Audio -->
    <AdaptationSet mimeType="audio/mp4" segmentAlignment="true" startWithSAP="1">
      <SegmentTemplate duration="3000" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startNumber="1" timescale="1000"/>
      <Representation audioSamplingRate="44100" bandwidth="132348" codecs="mp4a.40.2" id="audio/und/mp4a">
        <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
      </Representation>
    </AdaptationSet>
  </Period>
</MPD>

Can you share the media files and exact command-line arguments you used so that I could reproduce your issue on my side?

Natarajan92 commented 6 years ago

Mp4.zip

Please find the attached MP4 file for your verification

Fragmentation Command : mp4fragment --fragment-duration 4004 Bento4TestDash-850.mp4 Bento4TestDash-850.mp4

Packaging Command: mp4-dash.py -f -o Bento4TestDash --profiles=on-demand --mpd-name=dash.mpd Bento4TestDash-2400.mp4 Bento4TestDash-A192.mp4 Bento4TestDash-1200.mp4

Natarajan92 commented 6 years ago

Hi

Are you able to reproduce the issue ?

barbibulle commented 6 years ago

Yes, I'm able to reproduce this. I'll follow up shortly with a fix.