实战Golang流媒体:探索开源项目lal
发表时间: 2023-09-07 07:04
这里分类和汇总了欣宸的全部原创(含配套源码):
https://github.com/zq2599/blog_demos
git clone git@github.com:q191201771/lal.git
sh build.sh
lal git:(master) tree bin bin├── analyseflv├── benchrtmpconnect├── calcrtmpdelay├── customize_lalserver├── dispatch├── flvfile2es├── lalserver├── modflvfile├── pullhttpflv├── pullrtmp├── pullrtmp2hls├── pullrtmp2pushrtmp├── pullrtmp2pushrtsp├── pullrtsp├── pullrtsp2pushrtmp├── pullrtsp2pushrtsp└── pushrtmp0 directories, 17 files
./bin/lalserver -c conf/lalserver.conf.json
023/03/25 17:03:24.653855 INFO start: 2023-03-25 17:03:24.645 - base.go:352023/03/25 17:03:24.654433 INFO wd: /Users/will/temp/202303/25/lal - base.go:362023/03/25 17:03:24.654442 INFO args: ./bin/lalserver -c conf/lalserver.conf.json - base.go:372023/03/25 17:03:24.654456 INFO bininfo: GitTag=v0.33.0. GitCommitLog=a2db8795128e716a223404bd39aa215600d1f753 readme. GitStatus=cleanly. BuildTime=2023.03.25.162056. GoVersion=go version go1.19.3 darwin/arm64. runtime=darwin/arm64. - base.go:382023/03/25 17:03:24.654462 INFO version: lal v0.33.0 (github.com/q191201771/lal) - base.go:392023/03/25 17:03:24.654467 INFO github: https://github.com/q191201771/lal - base.go:402023/03/25 17:03:24.654472 INFO doc: https://pengrl.com/lal - base.go:412023/03/25 17:03:24.655115 INFO start web pprof listen. addr=:8084 - server_manager__.go:1652023/03/25 17:03:24.655862 INFO add http listen for httpflv. addr=:8080, pattern=/ - server_manager__.go:1872023/03/25 17:03:24.659345 INFO add https listen for httpflv. addr=:4433, pattern=/ - server_manager__.go:1982023/03/25 17:03:24.659393 INFO add http listen for httpts. addr=:8080, pattern=/ - server_manager__.go:1872023/03/25 17:03:24.659401 INFO add https listen for httpts. addr=:4433, pattern=/ - server_manager__.go:1982023/03/25 17:03:24.659407 INFO add http listen for hls. addr=:8080, pattern=/hls/ - server_manager__.go:1872023/03/25 17:03:24.659413 INFO add https listen for hls. addr=:4433, pattern=/hls/ - server_manager__.go:1982023/03/25 17:03:24.660094 INFO start rtmp server listen. addr=:1935 - server.go:562023/03/25 17:03:24.661125 INFO start rtmps server listen. addr=:4935 - server.go:712023/03/25 17:03:24.661157 INFO start rtsp server listen. addr=:5544 - server.go:812023/03/25 17:03:24.661328 INFO start rtsps server listen. addr=:5322 - server.go:952023/03/25 17:03:24.661623 INFO start http-api server listen. addr=:8083 - http_api.go:48
./ffmpeg \-re \-stream_loop -1 \-i ../videos/sample.mp4 \-c copy \-f flv \'rtmp://127.0.0.1:1935/live/test110'
Output #0, flv, to 'rtmp://127.0.0.1:1935/live/test110': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf60.3.100 Stream #0:0(und): Video: h264 (Main) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 1086 kb/s, 25 fps, 25 tbr, 1k tbn (default) Metadata: creation_time : 1970-01-01T00:00:00.000000Z handler_name : VideoHandler vendor_id : [0][0][0][0] Stream #0:1(und): Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz, 5.1, fltp, 383 kb/s (default) Metadata: creation_time : 1970-01-01T00:00:00.000000Z handler_name : SoundHandler vendor_id : [0][0][0][0]Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy)Press [q] to stop, [?] for helpframe= 342 fps= 25 q=-1.0 size= 2089kB time=00:00:13.69 bitrate=1249.5kbits/s speed= 1x
2023/03/25 17:22:17.394118 INFO accept a rtmp connection. remoteAddr=127.0.0.1:56148 - server.go:952023/03/25 17:22:17.394486 DEBUG [NAZACONN1] lifecycle new connection. net.Conn=0x140002c0008, naza.Connection=0x140002ce000 - connection.go:1922023/03/25 17:22:17.395248 INFO [RTMPPUBSUB1] lifecycle new rtmp ServerSession. session=0x1400029cd00, remote addr=127.0.0.1:56148 - server_session.go:1122023/03/25 17:22:17.395315 DEBUG handshake complex mode. - handshake.go:2482023/03/25 17:22:17.395684 INFO [RTMPPUBSUB1] < R Handshake C0+C1. - server_session.go:1962023/03/25 17:22:17.395699 INFO [RTMPPUBSUB1] > W Handshake S0+S1+S2. - server_session.go:1982023/03/25 17:22:17.395927 INFO [RTMPPUBSUB1] < R Handshake C2. - server_session.go:2062023/03/25 17:22:17.396586 INFO [RTMPPUBSUB1] < R connect('live'). tcUrl=rtmp://127.0.0.1:1935/live - server_session.go:4032023/03/25 17:22:17.397251 INFO [RTMPPUBSUB1] > W Window Acknowledgement Size 5000000. - server_session.go:4072023/03/25 17:22:17.397376 INFO [RTMPPUBSUB1] > W Set Peer Bandwidth. - server_session.go:4122023/03/25 17:22:17.397421 INFO [RTMPPUBSUB1] > W SetChunkSize 4096. - server_session.go:4172023/03/25 17:22:17.397465 INFO [RTMPPUBSUB1] > W _result('NetConnection.Connect.Success'). - server_session.go:4222023/03/25 17:22:17.397618 DEBUG [RTMPPUBSUB1] read command message, ignore it. cmd=releaseStream, header={Csid:3 MsgLen:36 MsgTypeId:20 MsgStreamId:0 TimestampAbs:0}, b=len(core)=128, rpos=25, wpos=36, hex=00000000 05 02 00 07 74 65 73 74 31 31 30 |....test110| - server_session.go:3562023/03/25 17:22:17.397654 DEBUG [RTMPPUBSUB1] read command message, ignore it. cmd=FCPublish, header={Csid:3 MsgLen:32 MsgTypeId:20 MsgStreamId:0 TimestampAbs:0}, b=len(core)=128, rpos=21, wpos=32, hex=00000000 05 02 00 07 74 65 73 74 31 31 30 |....test110| - server_session.go:356
rtmp://127.0.0.1:1935/live/test110
http://127.0.0.1:8080/live/test110.flvhttp://127.0.0.1:8080/hls/test110.m3u8rtsp://localhost:5544/live/test110http://127.0.0.1:8080/live/test110.ts
学习路上,你不孤单,欣宸原创一路相伴...