jinleileiking / learning-notes

Notes for my learning.
GNU General Public License v3.0
1 stars 2 forks source link

Livekit ingress #1

Open jinleileiking opened 1 year ago

jinleileiking commented 1 year ago

ingress

graph LR;
  pub-->|rtmp|go-rtmp
  gstreamer-->|webrtc|livekit;
  subgraph ingress
  go-rtmp-->|io.copy|relay-->|flv localhost:9090|gstreamer
  end
graph TD;
  runService-->svc.Run-->Q[req := <-s.rtmpPublishRequests]-->handleNewRTMPPublisher-->launchHandler-->runHandler-->HandleIngress-->h.buildPipeline--> media.New-->NewInput-->NewHTTPRelaySource-->X["gst.NewElementWithName(appsrc, FlvAppSource)"]-->QQ["gst.NewElement(decodebin3)"]
  runService-->rtmp.NewRTMPServer-->Z["rtmpsrv.Start(conf, svc.HandleRTMPPublishRequest)"].->h.OnPublishCallback-->svc.HandleRTMPPublishRequest-->T[s.rtmpPublishRequests <- r]-->Q

本地编译

gst调试自己的编码器

retamia commented 1 year ago

看了下代码, 感觉需要把gst的x264enc Element编码部分替换成ffmpeg lib库就可以了。 不知道gst的x264enc 这1个element是否可被两个替换。

主要改动在pkg/media/output.go 这块

原流程:

graph LR;
  videoconvert-->videoscale-->x264enc-->capsfilter--> queue --> IngressAppsink;
graph LR;
  videoconvert-->videoscale-->FFmpegAppsink-->|ffmpeg|FFmpegAppsrc --> queue --> IngressAppsink;

,NewVideoOutput这块是创建了gst的x264enc Element。这块需要替换成自己的gst sink,然后用ffmpeg处理后的数据当作 appsrc给ingress 的 appsink