Giter Site home page Giter Site logo

go-dash's Introduction

go-dash godoc

A Go library for generating MPEG-DASH manifests.

Install

go get -u github.com/zencoder/go-dash

Supported Features

  • Profiles
    • Live
    • On Demand
  • Adaption Sets / Representations / Roles
    • Audio
    • Video
    • Subtitles
    • Multiple periods (multi-part playlist)
  • DRM (ContentProtection)
    • PlayReady
    • Widevine

Known Limitations (for now) (PRs welcome)

  • No PSSH/PRO generation
  • Limited Profile Support

Example Usage

See the examples/ directory.

Development

make test

CI

This project builds in Circle CI

License

Apache License Version 2.0

go-dash's People

Contributors

bahern avatar bcasinclair avatar brycefisher avatar cawb07 avatar elbadawimustafa avatar hatondo-bcov avatar hikeh avatar jjeyaprakash avatar jslching avatar juliancooper avatar jyehbrightcove avatar liuyanhit avatar madhumathisg avatar martinlindhe avatar mattetti avatar mbowbc avatar mend-for-github-com[bot] avatar miyukki avatar mjneil avatar philcluff avatar soldiermoth avatar sparrc avatar stuarthicks avatar thomshutt avatar vish91 avatar zsiec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-dash's Issues

Reversing the order of the playlist

I noticed your data structure has changed (my code that uses your library won't build) from 74b837a so that we have lists of AdaptionSets in lists of Periods IIUC.

I have legacy code like:

func reversempd(s []*mpd.Representation) []*mpd.Representation {
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}
	return s
}
	if order == "desc" {
		for i, v := range m.Period.AdaptationSets {
			log.Println(i, v)
			v.Representations = reversempd(v.Representations)
			for j, r := range v.Representations {
				log.Println(j, r, "id", *r.ID)
			}
		}
	}

For reversing the order of the playlist which is needed for some reason or another. Can you suggest a way of realizing my reversal use case in light of the changes?

Examples fails to compile

go-dash$ make examples-ondemand
# command-line-arguments
examples/ondemand.go:15:55: not enough arguments in call to audioAS.AddNewContentProtectionSchemeWidevineWithPSSH
        have ()
        want ([]byte)
examples/ondemand.go:25:55: not enough arguments in call to videoAS.AddNewContentProtectionSchemeWidevineWithPSSH
        have ()
        want ([]byte)
Makefile:38: recipe for target 'examples-ondemand' failed
make: *** [examples-ondemand] Error 2

InbandEventStream should be an element, slice

CommonAttributesAndElements.InbandEventStream has an XML tag to be an attribute, but should be an element:

InbandEventStream         *DescriptorType       `xml:"inbandEventStream,attr"`

should be

InbandEventStream         *DescriptorType       `xml:"InbandEventStream,omitempty"`

otherwise it will never be unmarshaled.

I think is is valid to have multiple InbandEventStream elements, which would need more than just this fix.

InbandEventStream         []DescriptorType      `xml:"InbandEventStream,omitempty"`

Using go-dash as a mpd parser

I would like to use go-dash in order to parse and extract data from an mpd file. What I'm looking is a way to get the URL from the last video and audio segments among other information from the mpd. Is it already implemented on go-dash ? Is there a method to get an URL for a segment ? I'm most interest in a dynamic manifest, but both dynamic and static should be supported.

If it is not supported yet, are you interested on a PR ? Could you give me any tips to get me started ?

Question about generating and parsing Multi Period Dash

Hey guys, I have a quick question about the <MPD> object structure and def. I think I understand that we have period and Periods to be backwards compatible I think for those who want to generate a single period dash without the ID ?
My question is around the multi period dash where an extra and empty Period is getting attached when a NewMPD() is being created.
e.g
I wrote this small test to show this

func TestNewMPDMultiPeriod(t *testing.T) {
	m := NewMPD(DASH_PROFILE_LIVE, VALID_MEDIA_PRESENTATION_DURATION, VALID_MIN_BUFFER_TIME,
		AttrAvailabilityStartTime(VALID_AVAILABILITY_START_TIME))
	require.NotNil(t, m)
	for i := 0; i < 2; i++ {
		period := m.AddNewPeriod()
		period.ID = strconv.Itoa(i)
	}
	ms, _ := m.WriteToString()

	expectedMPD := &MPD{
		XMLNs:                     Strptr("urn:mpeg:dash:schema:mpd:2011"),
		Profiles:                  Strptr((string)(DASH_PROFILE_LIVE)),
		Type:                      Strptr("static"),
		MediaPresentationDuration: Strptr(VALID_MEDIA_PRESENTATION_DURATION),
		MinBufferTime:             Strptr(VALID_MIN_BUFFER_TIME),
		AvailabilityStartTime:     Strptr(VALID_AVAILABILITY_START_TIME),
		period:                    nil,
		Periods:                   []*Period{&Period{ID: "0"}, &Period{ID: "1"}},
	}

	expectedString, err := expectedMPD.WriteToString()
	require.NoError(t, err)
	actualString, err := m.WriteToString()
	require.NoError(t, err)

	require.EqualString(t, expectedString, actualString)
}

which will give you an error


    require.go:99: Expected <?xml version="1.0" encoding="UTF-8"?>
        <MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" mediaPresentationDuration="PT6M16S" minBufferTime="PT1.97S" availabilityStartTime="1970-01-01T00:00:00Z">
          <Period id="0"></Period>
          <Period id="1"></Period>
        </MPD>
         but got <?xml version="1.0" encoding="UTF-8"?>
        <MPD xmlns="urn:mpeg:dash:schema:mpd:2011" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" mediaPresentationDuration="PT6M16S" minBufferTime="PT1.97S" availabilityStartTime="1970-01-01T00:00:00Z">
          <Period></Period>
          <Period id="0"></Period>
          <Period id="1"></Period>
        </MPD>

I think that extra <Period></Period> is unwanted and shouldn't be present in the manifest.

Let me know if this test makes sense ? Coz I see the other tests were written in a similar way but might make sense back in day before when it was a single period only support, so one would just assume that a an empty period is created with NewMPD() and we call GetCurrentPeriod() to fetch current period.

Is ErrSegmentTemplateLiveProfileOnly correct?

I can't download the spec right now, because the ISO download gives me a 403 constantly, but on-demand profile with segment templates does pass schema validation. I haven't tested beyond that though.

If it doesn't break the spec, it would be nice to be able to generate on-demand MPDs using a segment template, because long videos with relatively short segments means generating quite large MPDs if every segment needs to be explicitly written to a segment list.

Go Module support

Hello,

Great project you got here, I would like to suggest support for go's latest VGO modules feature, this makes managing librarys like this alot easier currently you can work around the lack of VGO support by using
go get github.com/zencoder/go-dash@latest
But it would be nice to have native support

go.mod is missing v3 label

From https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher

If the module is version v2 or higher, the major version of the module must be included as a /vN at the end of the module paths used in go.mod files (e.g., module github.com/my/mod/v2, require github.com/my/mod/v2 v2.0.1) and in the package import path (e.g., import "github.com/my/mod/v2/mypkg"). This includes the paths used in go get commands (e.g., go get github.com/my/mod/[email protected]. Note there is both a /v2 and a @v2.0.1 in that example. One way to think about it is that the module name now includes the /v2, so include /v2 whenever you are using the module name).

go.mod thusly should be module github.com/zencoder/go-dash/v3 (note the added /v3)

Otherwise, other projects attempting to import this module will encounter the following error:

go: github.com/zencoder/go-dash/[email protected]: go.mod has non-.../v3 module path "github.com/zencoder/go-dash" (and .../v3/go.mod does not exist) at revision v3.0.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.