Skip to content

Get width and height from SPS and PPS #475

Closed Answered by aler9
cedricve asked this question in Questions
Discussion options

You must be logged in to vote

Hello, i remember i posted an example some time ago but i can't find it anymore, anyway, here's what you're looking for.

package main

import (
	"fmt"

	"github.com/bluenviron/gortsplib/v4"
	"github.com/bluenviron/gortsplib/v4/pkg/base"
	"github.com/bluenviron/gortsplib/v4/pkg/format"
	"github.com/bluenviron/mediacommon/pkg/codecs/h264"
)

func main() {
	c := gortsplib.Client{}

	// parse URL
	u, err := base.ParseURL("rtsp://localhost:8554/mystream")
	if err != nil {
		panic(err)
	}

	// connect to the server
	err = c.Start(u.Scheme, u.Host)
	if err != nil {
		panic(err)
	}
	defer c.Close()

	// find available medias
	desc, _, err := c.Describe(u)
	if err != nil {
		panic(err)
	}

	// fin…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cedricve
Comment options

Answer selected by cedricve
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #473 on December 01, 2023 18:15.