• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

RTSPtoWebRTCgo语言库尝试

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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/[email protected]: 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/

可以看见画面了

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
【Go学习】VSCode中的代码自动补全和自动导入包发布时间:2022-07-10
下一篇:
初始go语言发布时间:2022-07-10
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap