• RTSPtoWebRTC go语言库尝试


    1. go env查看环境变量
    设置某个项的值:如 go env -w GO111MODULE=on

    2. helloworld.go

    package main

    import "fmt"

    func main() {
    fmt.Println("Hello, World!")
    }

    编译:go build helloworld.go生成helloworld.exe
    直接运行:go run helloworld.go


    3. https://github.com/deepch/RTSPtoWebRTC


    GO111MODULE=on go run *.go Windows下不支持
    使用vscode,打开terminal,在termal窗口右上角有个+号,点看,选择git bash,然后执行就可以

    进来后就是一个MINGW64控制台,什么ls cd等命令都可以直接使用了
    migu@DESKTOP-1SNLJOP MINGW64 /c/tanglm/RTSPtoWebRTC-master
    $
    migu@DESKTOP-1SNLJOP MINGW64 /c/tanglm/RTSPtoWebRTC-master
    $ GO111MODULE=on go run *.go
    go: github.com/deepch/vdk@v0.0.0-20210508200759-5adbbcc01f89: Get "https://proxy.golang.org/github.com/deepch/vdk/@v/v0.0.0-20210508200759-5adbbcc01f89.mod": dial tcp 172.217.160.113:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

    migu@DESKTOP-1SNLJOP MINGW64 /c/tanglm/RTSPtoWebRTC-master

    golang国内代理
    https://blog.csdn.net/u013272009/article/details/90139288
    win
    $env:GOPROXY = "https://goproxy.io"
    linxu bash
    export GOPROXY=https://goproxy.io

    go build 生成:RTSPtoWebRTC


    config.json文件修改:rtsp url改为自己要拉的流
    {
    "server": {
    "http_port": ":8083",
    "ice_servers": ["stun:stun.l.google.com:19302"],
    "ice_username": "",
    "ice_credential": ""
    },
    "streams": {
    "H264_AAC": {
    "on_demand": false,
    "disable_audio": true,
    "url": "rtsp://139.224.204.41:8554/D1.264" //修改点
    },

    //后面忽略
    }


    直接运行 ./RTSPtoWebRTC


    leehm@ubuntu:~/Desktop/share/RTSPtoWebRTC$ ./RTSPtoWebRTC
    2021/06/15 14:39:19 Stream Try Connect H264_AAC
    2021/06/15 14:39:19 Server Start Awaiting Signal
    [GIN] 2021/06/15 - 14:48:24 | 301 | 108.999µs | 192.168.192.1 | GET "/"
    [GIN] 2021/06/15 - 14:48:24 | 200 | 472.545µs | 192.168.192.1 | GET "/stream/player/H264_AAC"
    [GIN] 2021/06/15 - 14:48:24 | 200 | 394.777212ms | 192.168.192.1 | GET "/static/js/bootstrap.mi


    然后打开浏览器8083端口,config.json配置

    http://192.168.192.141:8083/

    可以看见画面了

  • 相关阅读:
    C#使用结构体,输入5个人的学号,姓名,分数,按照成绩高低排列打印出来
    数据库考试试题
    数据库存储系统应用,超市小票系统
    数据库变量与语句
    练习:C#---类(身份证号截取生日、验证邮箱、DateTime)
    Chapter 3. 类---String类、Math类、Datetime类
    练习:C#---for循环(整数和、阶乘、楼梯)
    Chapter 2 C#语句---异常语句
    Chapter 2. C#语句---循环语句
    Chapter 2 C#语句---选择语句
  • 原文地址:https://www.cnblogs.com/leehm/p/15379440.html
Copyright © 2020-2023  润新知