diff options
Diffstat (limited to 'gst/gst.go')
-rw-r--r-- | gst/gst.go | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -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)) |