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

how to generate dashif compatible mpd files using mp4box #127

Closed
eyebies opened this issue Mar 5, 2014 · 8 comments
Closed

how to generate dashif compatible mpd files using mp4box #127

eyebies opened this issue Mar 5, 2014 · 8 comments
Labels

Comments

@eyebies
Copy link

eyebies commented Mar 5, 2014

Hi,
I am able to load and play the examples on the Stream but when I try to play mpd files I created using mp4box, it doesn't play. The mp4 video i am using is a h264 baseline encoded. Do I have to use any specific options along with mp4box for generating dash if player compatible mpd files. the file plays fine on mp4client though.
thanks
phani

@abiaggi
Copy link

abiaggi commented Mar 12, 2014

I am having the same issue.

@anpa
Copy link

anpa commented Mar 27, 2014

Try this:

  • FFMPEG to transcode:
ffmpeg -codec:a libvo_aacenc -ar 44100 -ac 1 -codec:v libx264 -profile:v baseline -level 13 -b:v 2000k output.mp4 -i test.mp4
  • MP4Box to segment:
MP4Box -dash 10000 -dash-profile live -segment-name output-seg output.mp4

Then it should play with dash.js.

(source: Cyril Concolato answer in http://goo.gl/C5NsXr)

@anpa
Copy link

anpa commented Mar 27, 2014

However when specifying a segment size lower than 10s, it will result in a Video Element Error: MEDIA_ERR_DECODE in dash.js, not sure why.

Is there any restriction related to the segment size?

@dacox
Copy link

dacox commented Dec 8, 2014

I am having problems too. I used FFMPEG to transcode the data:

ffmpeg -codec:a libvo_aacenc -ar 44100 -ac 1 -codec:v libx264 -profile:v baseline -level 13 -b:v 2000k output.mp4 -i test.mp4

and removed the audio(it's not important)

ffmpeg -i output.mp4 -an output_an.mp4

and then I used MP4Box to generate an on-demand dash profile

MP4Box -dash 30000 -dash-profile on-demand -segment-name output-seg output.mp4

This resulted in a .mpd like so

<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.5.1-DEV-rev5542  on 2014-12-08T19:10:05Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT1H0M0.13S" profiles="urn:mpeg:dash:profile:full:2011">
 <ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
  <Title>output_an_dash.mpd generated by GPAC</Title>
 </ProgramInformation>

 <Period duration="PT1H0M0.13S">
  <AdaptationSet segmentAlignment="true" maxWidth="720" maxHeight="480" maxFrameRate="30000/1001" par="3:2">
   <Representation id="1" mimeType="video/mp4" codecs="avc1.64001e" width="720" height="480" frameRate="30000/1001" sar="1:1" startWithSAP="0" bandwidth="800884">
    <SegmentList timescale="30000" duration="900032">
     <Initialization sourceURL="output_an_seginit.mp4"/>
     <SegmentURL media="output_an_seg1.m4s"/>
     ...
     <SegmentURL media="output_an_seg120.m4s"/>
    </SegmentList>
   </Representation>
  </AdaptationSet>
 </Period>
</MPD>

However, when I load it via dashjs, it plays for a second or two, and then gives the error

MediaError {code: 3, MEDIA_ERR_ABORTED: 1, MEDIA_ERR_NETWORK: 2, MEDIA_ERR_DECODE: 3, MEDIA_ERR_SRC_NOT_SUPPORTED: 4} Debug.js:29 BufferController video stop.

Here is the log

Parsing complete: ( xml2json: 12ms, objectiron: 5ms, total: 0.017s)
Debug.js:29 Manifest has loaded.
Debug.js:29 MediaSource is open!
Debug.js:29 Event {clipboardData: undefined, path: NodeList[0], cancelBubble: false, returnValue: true, srcElement: MediaSource…}
Debug.js:29 Video codec: video/mp4;codecs="avc1.64001e"
Debug.js:29 No audio streams.
Debug.js:29 No text tracks.
Debug.js:29 Added 0 inline events
Debug.js:29 Duration successfully set to: 3600.13
Debug.js:29 BufferController video seek: 0
Debug.js:29 BufferController video start.
Debug.js:29 Waiting for more video buffer before starting playback.
Debug.js:29 Marking a special seek for initial video playback.
Debug.js:29 Getting the request for time: 0
Debug.js:29 Index for time 0 is 0
Debug.js:29 SegmentList: 0 / 3600.13
Debug.js:29 loaded video:Media Segment:0 (200, 6ms, 12ms)
Debug.js:29 loaded video:Initialization Segment:NaN (200, 0ms, 66ms)
Debug.js:29 Initialization finished loading: video
Debug.js:29 Got loadmetadata event.
Debug.js:29 Starting playback at offset: 0
Debug.js:29 element loaded!
Debug.js:29 Start Event Controller
Debug.js:29 Buffered video Range: 0 - 30.029999
Debug.js:29 Got enough video buffer to start.
Debug.js:29 Getting the request for time: 30.029999
Debug.js:29 Index for time 30.029999 is 1
Debug.js:29 SegmentList: 30.001066666666667 / 3600.13
Debug.js:29 loaded video:Media Segment:30.001066666666667 (200, 7ms, 9ms)
Debug.js:29 Video Element Error: MEDIA_ERR_DECODE
Debug.js:29 MediaError {code: 3, MEDIA_ERR_ABORTED: 1, MEDIA_ERR_NETWORK: 2, MEDIA_ERR_DECODE: 3, MEDIA_ERR_SRC_NOT_SUPPORTED: 4}
Debug.js:29 BufferController video stop.
Debug.js:29 Getting the request for time: 30.001066666666667
Debug.js:29 Index for time 30.001066666666667 is 1
Debug.js:29 SegmentList: 30.001066666666667 / 3600.13

Using the live profile seems to work, but then it attempts to grab more segments than there actually are.

@philipbulley
Copy link

@dacox Try specifying onDemand (as per docs) instead of on-demand. The MPD you generated uses the full profile due to the typo. See the profiles attribute of the MPD element.

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT1H0M0.13S" profiles="urn:mpeg:dash:profile:full:2011">

Not sure if that solves all of your issues, but it's hopefully a start.

@thanethomson
Copy link

I'm currently struggling to get the dash.js player to play MPDs generated using the live profile (it works fine for me for the onDemand profile). The following MPD file gives me a MEDIA_ERR_SRC_NOT_SUPPORTED error:

<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.5.2-DEV-rev80-g29b60b6-master  on 2015-02-24T08:19:12Z-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT0H41M21.49S" profiles="urn:mpeg:dash:profile:isoff-live:2011">
 <ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
  <Title>myvideo.mpd generated by GPAC</Title>
 </ProgramInformation>

 <Period duration="PT0H41M21.49S">
  <AdaptationSet segmentAlignment="true" lang="eng">
   <SegmentTemplate timescale="44100" media="myvideo_segment_$Number$.m4s" startNumber="1" duration="439466" initialization="myvideo_segment_init.mp4"/>
   <Representation id="1" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="44100" startWithSAP="1" bandwidth="97516">
    <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
   </Representation>
  </AdaptationSet>
  <AdaptationSet segmentAlignment="true" maxWidth="640" maxHeight="360" maxFrameRate="25" par="16:9" lang="eng">
   <SegmentTemplate timescale="12800" media="myvideo_segment_$Number$.m4s" startNumber="1" duration="87741" initialization="myvideo_segment_init.mp4"/>
   <Representation id="2" mimeType="video/mp4" codecs="avc1.42c00d" width="640" height="360" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="645072">
   </Representation>
  </AdaptationSet>
 </Period>
</MPD>

This was generated using the following MP4Box command:

MP4Box -dash 10000 -segment-name myvideo_segment_ -out myvideo.mpd -profile live myvideo_audio.mp4 myvideo_video.mp4

My JavaScript console (Chrome 40.0.2214.111 on OSX Yosemite) looks as follows:

Parsing complete: ( xml2json: 1ms, objectiron: 1ms, total: 0.002s)
dash.debug.js:10611 Manifest has loaded.
dash.debug.js:10611 Manifest has been refreshed.
dash.debug.js:10611 MediaSource is open!
dash.debug.js:10611 [object Event]
dash.debug.js:10611 Added 0 inline events
dash.debug.js:10611 video codec: video/mp4;codecs="avc1.42c00d"
dash.debug.js:10611 ScheduleController video stop.
dash.debug.js:10611 audio codec: audio/mp4;codecs="mp4a.40.2"
dash.debug.js:10611 ScheduleController audio stop.
dash.debug.js:10611 No text data.
dash.debug.js:10611 Duration successfully set to: 2481.49
dash.debug.js:10611 ScheduleController video start.
dash.debug.js:10611 ScheduleController audio start.
dash.debug.js:10611 loaded video:Initialization Segment:NaN (200, 0ms, 8ms)
dash.debug.js:10611 Initialization finished loading: video
dash.debug.js:10611 loaded audio:Initialization Segment:NaN (200, 0ms, 9ms)
dash.debug.js:10611 Initialization finished loading: audio
dash.debug.js:10611 Stalling video Buffer: video
dash.debug.js:10611 Waiting for more video buffer before starting playback.
dash.debug.js:10611 Stalling audio Buffer: audio
dash.debug.js:10611 Waiting for more audio buffer before starting playback.
dash.debug.js:10611 Video Element Error: MEDIA_ERR_SRC_NOT_SUPPORTED
dash.debug.js:10611 undefined
dash.debug.js:10611 ScheduleController video stop.
dash.debug.js:10611 ScheduleController audio stop.

I've been trying all the various options and examples that I've found around the internet, and I just can't seem to get this to work. Any help would be greatly appreciated?

@dsparacio
Copy link
Contributor

Closing bug see #429

@arthur-s
Copy link

arthur-s commented Oct 2, 2015

you have to use keyframes with ffmpeg, for example like this

ffmpeg -i test.mkv -c:v libx264 -r 24 -g 72 -an output.mp4

after that you can dashify it with mp4box

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

9 participants