aboutsummaryrefslogtreecommitdiff
path: root/gst/gst.go
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2020-07-25 11:31:23 +0000
committerdakkar <dakkar@thenautilus.net>2020-07-25 11:56:19 +0000
commitc6ab41dc8c9816a2a457f61b5d90d2436dfbb471 (patch)
treec34b53e7d2dd8f151ad2b638b194a816b427c24d /gst/gst.go
parentmaybe new deps? mah (diff)
downloadrtwatch-c6ab41dc8c9816a2a457f61b5d90d2436dfbb471.tar.gz
rtwatch-c6ab41dc8c9816a2a457f61b5d90d2436dfbb471.tar.bz2
rtwatch-c6ab41dc8c9816a2a457f61b5d90d2436dfbb471.zip
changes from another guy
https://github.com/ahamlinman/rtwatch/commit/eb91a43eeccc5959ea981dbc6eef10978d5179fb
Diffstat (limited to 'gst/gst.go')
-rw-r--r--gst/gst.go24
1 files changed, 23 insertions, 1 deletions
diff --git a/gst/gst.go b/gst/gst.go
index f8a5385..7282aab 100644
--- a/gst/gst.go
+++ b/gst/gst.go
@@ -31,9 +31,31 @@ type Pipeline struct {
var pipeline = &Pipeline{}
var pipelinesLock sync.Mutex
+var pipelineFmtStr = `
+filesrc location="%s"
+! decodebin name=demux
+
+demux.
+! queue
+! videoconvert
+! videoscale
+! video/x-raw,width=800,height=600
+! x264enc bframes=0 speed-preset=veryfast key-int-max=60
+! video/x-h264,stream-format=byte-stream
+! appsink name=video
+
+demux.
+! queue
+! audioconvert
+! audioresample
+! audio/x-raw,rate=48000
+! opusenc bitrate=128000
+! appsink name=audio
+`
+
// CreatePipeline creates a GStreamer Pipeline
func CreatePipeline(containerPath string, audioTrack, videoTrack *webrtc.Track) *Pipeline {
- pipelineStr := fmt.Sprintf("filesrc location=\"%s\" ! decodebin name=demux ! queue ! x264enc bframes=0 speed-preset=veryfast key-int-max=60 ! video/x-h264,stream-format=byte-stream ! appsink name=video demux. ! queue ! audioconvert ! audioresample ! opusenc ! appsink name=audio", containerPath)
+ pipelineStr := fmt.Sprintf(pipelineFmtStr, containerPath)
pipelineStrUnsafe := C.CString(pipelineStr)
defer C.free(unsafe.Pointer(pipelineStrUnsafe))