Archived
2
0

broadcast pipeline -> optional arguments.

This commit is contained in:
m1k1o 2021-04-03 15:17:26 +02:00
parent 5805cbdda5
commit ce52331d68
3 changed files with 12 additions and 2 deletions

View File

@ -63,6 +63,10 @@ For n.eko room management software visit https://github.com/m1k1o/neko-rooms.
- Added `m1k1o/neko:vncviewer` tag, use `NEKO_VNC_URL` to specify VNC target and use n.eko as a bridge. - Added `m1k1o/neko:vncviewer` tag, use `NEKO_VNC_URL` to specify VNC target and use n.eko as a bridge.
- Abiltiy to include neko as a component in another Vue.Js project (by @gbrian). - Abiltiy to include neko as a component in another Vue.Js project (by @gbrian).
- Added HEALTHCHECK to Dockerfile. - Added HEALTHCHECK to Dockerfile.
- Arguments in broadcast pipeline are optional, not positional and can be repeated `{url} {device} {display}`.
### Roadmap & TODOs
- Catch errors from gst pipeline, tell user if broadcast failed.
# Getting started & FAQ # Getting started & FAQ

View File

@ -9,6 +9,7 @@ package gst
import "C" import "C"
import ( import (
"fmt" "fmt"
"strings"
"sync" "sync"
"time" "time"
"unsafe" "unsafe"
@ -66,7 +67,12 @@ func CreateRTMPPipeline(pipelineDevice string, pipelineDisplay string, pipelineS
var pipelineStr string var pipelineStr string
if pipelineSrc != "" { if pipelineSrc != "" {
pipelineStr = fmt.Sprintf(pipelineSrc, pipelineRTMP, pipelineDevice, pipelineDisplay) // replace RTMP url
pipelineStr = strings.Replace(pipelineSrc, "{url}", pipelineRTMP, -1)
// replace audio device
pipelineStr = strings.Replace(pipelineStr, "{device}", pipelineDevice, -1)
// replace display
pipelineStr = strings.Replace(pipelineStr, "{display}", pipelineDisplay, -1)
} else { } else {
pipelineStr = fmt.Sprintf("flvmux name=mux ! rtmpsink location='%s live=1' %s audio/x-raw,channels=2 ! audioconvert ! voaacenc ! mux. %s x264enc bframes=0 key-int-max=60 byte-stream=true tune=zerolatency speed-preset=veryfast ! mux.", pipelineRTMP, audio, video) pipelineStr = fmt.Sprintf("flvmux name=mux ! rtmpsink location='%s live=1' %s audio/x-raw,channels=2 ! audioconvert ! voaacenc ! mux. %s x264enc bframes=0 key-int-max=60 byte-stream=true tune=zerolatency speed-preset=veryfast ! mux.", pipelineRTMP, audio, video)
} }

View File

@ -10,7 +10,7 @@ type Broadcast struct {
} }
func (Broadcast) Init(cmd *cobra.Command) error { func (Broadcast) Init(cmd *cobra.Command) error {
cmd.PersistentFlags().String("broadcast_pipeline", "", "audio codec parameters to use for broadcasting") cmd.PersistentFlags().String("broadcast_pipeline", "", "custom gst pipeline used for broadcasting, strings {url} {device} {display} will be replaced")
if err := viper.BindPFlag("broadcast_pipeline", cmd.PersistentFlags().Lookup("broadcast_pipeline")); err != nil { if err := viper.BindPFlag("broadcast_pipeline", cmd.PersistentFlags().Lookup("broadcast_pipeline")); err != nil {
return err return err
} }