KirovBvulgaru / google-cast-sdk

Automatically exported from code.google.com/p/google-cast-sdk
0 stars 0 forks source link

.mpd DASH manifest generated with MP4Box does not work #172

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Install MP4Box for ubuntu

2. use any .mp4 file (big_buck_bunny_1080p.mp4 for example)
  MediaInfo: MPEG-4 (Base media/ version 2) AVC/AAC(LC)

3. MP4Box -profile "main" -frag 10000 -dash 30000 -segment-name seg_ 
big_buck_bunny_1080p.mp4

What is the expected output? What do you see instead?

Video streaming is expected, but all i get is error :

Uncaught InvalidStateError: An attempt was made to use an object that is not, 
or is no longer, usable. media_player.js:102
h.Ue media_player.js:102
 [ 56.135s] [cast.player.api.Player] error
 media_player.js:24
Tb media_player.js:24
Pb.xf media_player.js:24
Ab.log media_player.js:19
bc media_player.js:38
h.Lc media_player.js:117
Fatal Error - 1 

What version of the product are you using? On what operating system?

Ubuntu 13.04. CastVideos-android and sample_media_receiver.html projects are 
used

Please provide any additional information below.

I get this .mpd file:

<?xml version="1.0"?>
<!-- MPD file Generated with GPAC version 0.5.1-DEV-rev4065 -->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" 
type="static" mediaPresentationDuration="PT0H9M56.50S" 
profiles="urn:mpeg:dash:profile:isoff-main:2011">
 <ProgramInformation moreInformationURL="http://gpac.sourceforge.net">
  <Title>big_buck_bunny_1080p_dash.mpd generated by GPAC</Title>
 </ProgramInformation>

 <Period id="" duration="PT0H9M56.50S">
  <AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="24" par="16:9">
   <ContentComponent id="1" contentType="video"  lang="und"/>
   <ContentComponent id="2" contentType="audio"  lang="eng"/>
   <Representation id="1" mimeType="video/mp4" codecs="avc1.4d4028,mp4a.40.02" width="1920" height="1080" frameRate="24" sar="1:1" audioSamplingRate="48000" startWithSAP="1" bandwidth="4421321">
    <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
    <SegmentList timescale="1000" duration="32527">
     <Initialization sourceURL="bunny_init.mp4"/>
     <SegmentURL media="bunny_1.m4s"/>
     <SegmentURL media="bunny_2.m4s"/>
     <SegmentURL media="bunny_3.m4s"/>
     <SegmentURL media="bunny_4.m4s"/>
     <SegmentURL media="bunny_5.m4s"/>
     <SegmentURL media="bunny_6.m4s"/>
     <SegmentURL media="bunny_7.m4s"/>
     <SegmentURL media="bunny_8.m4s"/>
     <SegmentURL media="bunny_9.m4s"/>
     <SegmentURL media="bunny_10.m4s"/>
     <SegmentURL media="bunny_11.m4s"/>
     <SegmentURL media="bunny_12.m4s"/>
     <SegmentURL media="bunny_13.m4s"/>
     <SegmentURL media="bunny_14.m4s"/>
     <SegmentURL media="bunny_15.m4s"/>
     <SegmentURL media="bunny_16.m4s"/>
     <SegmentURL media="bunny_17.m4s"/>
     <SegmentURL media="bunny_18.m4s"/>
     <SegmentURL media="bunny_19.m4s"/>
     <SegmentURL media="bunny_20.m4s"/>
     <SegmentURL media="bunny_21.m4s"/>
     <SegmentURL media="bunny_22.m4s"/>
    </SegmentList>
   </Representation>
  </AdaptationSet>
 </Period>
</MPD>

When i test this .mpd with DASH-validator 
(http://www-itec.uni-klu.ac.at/dash/?page_id=605), i get that everything is 
valid:

XSD for checking: DASH International Standard XSD
Upload: big_buck_bunny_1080p_dash.mpd
Type: application/octet-stream
Size: 1.998046875 Kb
Temp file: /tmp/phpAjNL1X

XLink resolving successful Valid

Start MPD validation
====================

MPD validation successful – DASH is valid! Valid

Start Schematron validation
===========================

Schematron validation successful – DASH is valid! Valid.

Is this caused by .mpd file structure or media_player itself? 

Original issue reported on code.google.com by vanst...@gmail.com on 27 Feb 2014 at 4:52

Attachments:

GoogleCodeExporter commented 8 years ago
I have avoided a problem in which SegmentTemplate elements are not direct 
children of AdaptationSet elements(issue #170), so i have SegmentList under 
Representation.

Original comment by vanst...@gmail.com on 27 Feb 2014 at 5:06

GoogleCodeExporter commented 8 years ago
There is an issue with the codecs attribute in your manifest.  Since the mime 
type is "video/mp4", the codecs attribute should be just "avc1.4d4028" (yours 
is "avc1.4d4028,mp4a.40.02").

Original comment by vadi...@google.com on 27 Feb 2014 at 5:58

GoogleCodeExporter commented 8 years ago
I understand, however MP4Box generated that, not me. 
Removed mp4a.40.02, but error are still there:

Uncaught InvalidStateError: An attempt was made to use an object that is not, 
or is no longer, usable. media_player.js:102
 [142.251s] [cast.player.api.Player] sourceclose
 media_player.js:24
######### MEDIA ELEMENT ERROR [object Event] sample_media_receiver.html:173
 [142.448s] [cast.receiver.MediaManager] Load metadata error
 cast_receiver.js:19
### Media Manager - LOAD METADATA ERROR: 
{"senderId":"3:com.google.sample.cast.refplayer-191","message":{"currentTime":0,
"media":{"streamType":"BUFFERED","duration":0,"contentType":"video/mp4","content
Id":"http://192.168.0.100/media/googlecast_sdk_dash/googlecast.mpd","metadata":{
"subtitle":"DASH","studio":"DASH","images":[{"url":"http://cdn.appstorm.net/mac.
appstorm.net/mac/files/2013/09/chromecast_icon.png","height":0,"width":0},{"url"
:"http://i-ekb.ru/wp-content/uploads/2013/08/Chromecast_App_Icon_Large.jpg","hei
ght":0,"width":0}],"title":"Google cast 
SDK","metadataType":1}},"requestId":3,"autoplay":true}} 
sample_media_receiver.html:428
 [142.476s] [cast.receiver.MediaManager] Resetting media element
 cast_receiver.js:19
 [142.489s] [cast.receiver.MediaManager] Sending error message to 3:com.google.sample.cast.refplayer-191
 cast_receiver.js:19
 [142.497s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"3:com.google.sample.cast.refplayer-191","data":"{\"requestId\":3,\"type\":\"LOAD_FAILED\"}"}
 cast_receiver.js:19
 [142.369s] [cast.player.api.Player] error
 media_player.js:24
### HOST ERROR - Fatal Error: code = 1 sample_media_receiver.html:599
 [142.397s] [cast.player.api.Player] error
 media_player.js:24
### HOST ERROR - Fatal Error: code = 1 

Original comment by vanst...@gmail.com on 27 Feb 2014 at 6:32

GoogleCodeExporter commented 8 years ago
[Just a comment from the submitter of issue #170 and #141.]

I assume that MP4Box is including both video and audio codecs in the same 
attribute for you because you are are segmenting a single file with multiplexed 
video and audio, and thus ending up with a single Representation in a single 
AdaptationSet.

Unless you're trying to produce something HLS-like with segmented MPEG-2 TS 
data, then I think that you'll typically want the video and audio data to be 
retrievable separately by the DASH client—so that, for example, the video 
bitrate can be adapted independently.  So, I would suggest trying to first 
separate the audio and video (perhaps at multiple bitrates) into separate MP4 
files and then run "MP4Box -dash" on that set of files. 

I haven't tried a SegmentList-based MPD with media_library.js, so I don't know 
if they are supported by media_player.js yet.  You could always try a 
SegmentTemplate MPD and (before the #170 fix is published) transform the MPD to 
work around that bug.

Original comment by peter.jo...@qrclab.com on 27 Feb 2014 at 8:00

GoogleCodeExporter commented 8 years ago
Thank you for your response.

Yes, you are totally right, that can be a problem (multiplexed audio and video).
I am testing all my .mpd manifest files with MP4Client, and when i try to 
reproduce streams generated with MP4Box, screen is black, however sound works 
normally. Because of that, I will definitely try to so separarate audio and 
video into mp4 files.

As far as i know, DASH has support for multiplexed audio and video, so i am 
curious why my generated muliplexed adaptations don't work in MP4Client and 
Chromecast.

Also, i have tried MPDs with SegmentTemplate, and thay don't work too. 

I will continue my research in area of various adaptive streaming protocols 
(i'm new :), though), and i hope i ll manage to find a solution.  

Original comment by vanst...@gmail.com on 27 Feb 2014 at 10:15

GoogleCodeExporter commented 8 years ago
A segment list MPD is supported, for example this will work:

http://commondatastorage.googleapis.com/gtv-videos-bucket/dash/BigBuckBunny/bunn
y_10s/BigBuckBunny_10s_isoffmain_url_relative_DIS_23009_1_v_2_1c2_2011_08_30.mpd

You can test it with desktop Chrome or Chromecast, e.g. load this in Chrome:

http://storage.googleapis.com/gtv-videos-bucket/player/player.html?url=http://co
mmondatastorage.googleapis.com/gtv-videos-bucket/dash/BigBuckBunny/bunny_10s/Big
BuckBunny_10s_isoffmain_url_relative_DIS_23009_1_v_2_1c2_2011_08_30.mpd

Original comment by vadi...@google.com on 28 Feb 2014 at 12:20

GoogleCodeExporter commented 8 years ago
Okay, that is good.

I did the following:

- demuxed audio and video (MP4Box -raw 1 spiderman.mp4, MP4Box -raw 2 
spiderman.mp4)
- placed both raw files to separate .mp4 containers (MP4Box -add .....)
- generated .mpd files for both .mp4 files (main profile)
- manually joined two manifests into one (i should find a way to do it 
automatically)
- Tested with MP4Client , everything works well (both audio and video)
- Tried with Chromecast, and :

Uncaught TypeError: Converting circular structure to JSON 
sample_media_receiver.html:393
 [  8.165s] [cast.player.api.Player] error                                                 media_player.js:24
Tb media_player.js:24
### HOST ERROR - Fatal Error: code = 1 sample_media_receiver.html:599
window.mediaHost.onError

Which profiles for DASH are supported? 

My mpd is attached.

Original comment by vanst...@gmail.com on 28 Feb 2014 at 8:43

Attachments:

GoogleCodeExporter commented 8 years ago
######### MEDIA ELEMENT LOAD START sample_media_receiver.html:145
 [ 19.983s] [cast.player.api.Player] sourceopen
 media_player.js:24
 [ 20.045s] [cast.player.core.QualityManager] 0: from -1 to 0
 media_player.js:24
 [ 20.052s] [cast.player.core.QualityManager] 1: from -1 to 0
 media_player.js:24
######### MEDIA ELEMENT STALLED 

What this means? Why is stalled? What is the cause of that?

Original comment by vanst...@gmail.com on 28 Feb 2014 at 9:29

GoogleCodeExporter commented 8 years ago
[Again just the user from comment #4 here.]

You can create a single MPD from a single MP4Box -dash command just by listing 
all of the constituent MP4 files.

That "TypeError: Converting circular structure to JSON" seems to be a bug in 
the sample_media_receiver.html assuming that it can stringify any event object 
to JSON—I've encountered it in various cases too.

The error code = 1 is from the media library.  Glancing at your 
spiderman_dash.mpd, I don't have a guess what's causing the problem, though.

Original comment by peter.jo...@qrclab.com on 28 Feb 2014 at 4:04

GoogleCodeExporter commented 8 years ago

Yes, i have found that. Thank you for your answer, and hint about bug in 
sample_media_receiver.html. 

If i am able to play spiderman_dash.mpd in MP4Client, and not in CC, i suspect 
that there is a bug. It must be something with segmentation process that can't 
be handled by CC. 

Have you tried to create DASH and play it in CC ? If you are successful, and i 
am not, there must be a problem with my projects.

I ll list my steps in creating .mpd:

MP4Box -raw 1 spiderman.mp4
MP4Box -raw 2 spiderman.mp4

MP4Box -add spiderman_track1.h264 spiderman_video.mp4
MP4Box -add spiderman_track2.aac spiderman_audio.mp4

MP4Box -profile main -frag 10000 -dash 30000 -segment-name seg_%s -url-template 
-out spiderman_dash.mpd spiderman_audio.mp4 spiderman_video.mp4

//play
MP4Client spiderman_dash.mpd

Original comment by vanst...@gmail.com on 28 Feb 2014 at 4:26

GoogleCodeExporter commented 8 years ago
Could you please provide a zip archive that reproduces this and includes the 
segments and the manifest?  You could try using a short video for a repro case.

Original comment by vadi...@google.com on 28 Feb 2014 at 7:37

GoogleCodeExporter commented 8 years ago
[Responding to comment #10:]

Yes, we have created a number of DASH video samples using MP4Box that play on a 
Chromecast.  When using the new media_library.js, I've had to workaround issue 
#170 as described, but it looks like your spiderman_dash.mpd already does that 
(SegmentTemplate is direct child of AdaptationSet, not in the Representation).

In case it helps, here is an example of the MP4Box command we're using for 
creating 5-second-segment *.m4s files and a SegmentTemplate-based foo.mpd file 
given five unmultiplexed foo*.mp4 files, one for audio and 4 bitrates of video:

MP4Box -dash 5000 -segment-name 'dashseg--foo' -url-template -bs-switching no 
-out foo.mpd -rap foo_2ch_48000sps_192kbps.mp4 foo_500kbps.mp4 foo_1000kbps.mp4 
foo_2000kbps.mp4 foo_4000kbps.mp4

Original comment by peter.jo...@qrclab.com on 28 Feb 2014 at 8:01

GoogleCodeExporter commented 8 years ago

Ok, when i use your command with 1 audio and 1 video (attached: sample_01 and 
ss_01), there is no sound in MP4Client. Command:
MP4Box -dash 5000 -segment-name 'seg_' -url-template -bs-switching no -out 
sample_dash.mpd -rap audio.mp4 video.mp4

CC gives me load metadata error (ss_1) because you don't have different 
segments for audio and video..
What -rap represents?

********************************************************************************
******************

My example just gives me STALLED message and that is end (sample 02 and ss_02). 
There is a sound when trying to play with MP4Client.

Command:
MP4Box -profile main -frag 10000 -dash 30000 -segment-name seg_%s -url-template 
-out sample_dash.mpd audio.mp4 video.mp4.

This is so frustrating, i really don't know what's wrong with my commands...

Original comment by vanst...@gmail.com on 3 Mar 2014 at 9:15

Attachments:

GoogleCodeExporter commented 8 years ago
However if i put this: -segment-name seg_%s, it will separate audio and video 
segments, and segment_template will be under representation (BAD).
Your command with -segment-name 'dashseg--foo' gives joined audio and video 
commands, but gives me load metadata error.

Original comment by vanst...@gmail.com on 3 Mar 2014 at 9:26

GoogleCodeExporter commented 8 years ago
My apologies!  I was careless when anonymizing my example MP4Box 
command—indeed I meant it to say "-segment-name 'dashseg--%s'", so the whole 
command would become:

MP4Box -dash 5000 -segment-name 'dashseg--%s' -url-template -bs-switching no 
-out foo.mpd -rap foo_2ch_48000sps_192kbps.mp4 foo_500kbps.mp4 foo_1000kbps.mp4 
foo_2000kbps.mp4 foo_4000kbps.mp4

And yes, that produces an MPD that triggers issue #170, but I expect that that 
bug will be fixed soon per its comment #3, and until then I have been 
post-processing MPDs to work around it.

Original comment by peter.jo...@qrclab.com on 3 Mar 2014 at 4:09

GoogleCodeExporter commented 8 years ago
Okay, i hope that this bug will be solved soon. Anyway, i am glad i can 
contribute somehow, because chromecast is quite interesting subject.
Thank you for your help, i appreciate that :)

Original comment by vanst...@gmail.com on 4 Mar 2014 at 1:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I have created .mpd dash generated by MP4BOX successfully. But it cannot play 
in Google Chrome but only with MP4Client?
Does anybody knows a javascript library that can play the .mpd file syntax 
produced by MP4BOX?

Original comment by elclairm...@gmail.com on 30 Mar 2014 at 4:28

GoogleCodeExporter commented 8 years ago
Since issue #170 is closed, I am closing this one as well.

Original comment by anad...@google.com on 20 Jul 2014 at 10:31

GoogleCodeExporter commented 8 years ago
I got the same proplem with #1. My .mpd file work well at Internet Explorer but 
in Chrome I get error "Multiplexed representations are intentionally not 
supported, as they are not compliant with the DASH-AVC/264 guidelines". How can 
i pass this? 

Original comment by ducthien...@gmail.com on 26 Oct 2015 at 9:35