use-go / onvif

full and enhanced onvif protocol stack in golang.
MIT License
400 stars 187 forks source link

RTSP Uri Cant‘t Play #6

Closed IoTServ closed 3 years ago

IoTServ commented 3 years ago

The video address I got from this library is “rtsp://192.168.123.211 :554/user=admin password=tlJwpbo6 channel=1 stream=0.sdp?real Stream”, using VLC playback, as long as the sound has no image, the image is black, but the address obtained by another dart library is “rtsp://192.168.123.211 :554/user=admin password=tlJwpbo6 channel=1 stream=1.sdp?real stream” has sound and video. I don't know the difference between them. Is there an example of getting video address. my test Code:

    s := onvif.GetAvailableDevicesAtSpecificEthernetInterface("en7")

    log.Printf("%s", s)
    for _, d := range s {
        d.Authenticate("admin", "")
        log.Println(d.GetServices())
        log.Println(d.GetEndpoint("media"))
        resp, err := d.CallMethod(media.GetProfilesResponse{})
        if err != nil {
            log.Fatal(err)
        }
        bytes, _ := ioutil.ReadAll(resp.Body)
        log.Println(string(bytes))
        resp, err = d.CallMethod(media.GetStreamUri{
            StreamSetup:onvif2.StreamSetup{
                Stream:    "RTP-Unicast",
                Transport: onvif2.Transport{Protocol:"HTTP",Tunnel:nil},
            },
            ProfileToken: "000",
        })
        if err != nil {
            log.Fatal(err)
        }
        bytes, _ = ioutil.ReadAll(resp.Body)
        log.Println(string(bytes))
    }

output Uri: rtsp://192.168.123.211:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream :

截屏2021-01-27 下午9 25 50

dart Code get Uri: rtsp://192.168.123.211:554/user=admin_password=tlJwpbo6_channel=1_stream=1.sdp?real_stream

截屏2021-01-27 下午9 27 52

I don't known the difference between 1.sdp and 0.sdp,Is there an example of getting video address?