mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
move broadcast constants to config.
This commit is contained in:
parent
552223d031
commit
9c6c107ee0
@ -34,14 +34,14 @@ func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCt
|
|||||||
"! audio/x-raw,channels=2 "+
|
"! audio/x-raw,channels=2 "+
|
||||||
"! audioconvert "+
|
"! audioconvert "+
|
||||||
"! queue "+
|
"! queue "+
|
||||||
"! voaacenc bitrate=128000 "+
|
"! voaacenc bitrate=%d "+
|
||||||
"! mux. "+
|
"! mux. "+
|
||||||
"ximagesrc display-name=%s show-pointer=true use-damage=false "+
|
"ximagesrc display-name=%s show-pointer=true use-damage=false "+
|
||||||
"! video/x-raw "+
|
"! video/x-raw "+
|
||||||
"! videoconvert "+
|
"! videoconvert "+
|
||||||
"! queue "+
|
"! queue "+
|
||||||
"! x264enc threads=4 bitrate=4096 key-int-max=15 byte-stream=true tune=zerolatency speed-preset=veryfast "+
|
"! x264enc threads=4 bitrate=%d key-int-max=15 byte-stream=true tune=zerolatency speed-preset=%s "+
|
||||||
"! mux.", config.AudioDevice, config.Display,
|
"! mux.", config.AudioDevice, config.BroadcastAudioBitrate*1000, config.Display, config.BroadcastVideoBitrate, config.BroadcastPreset,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,9 @@ type Capture struct {
|
|||||||
AudioCodec codec.RTPCodec
|
AudioCodec codec.RTPCodec
|
||||||
AudioPipeline string
|
AudioPipeline string
|
||||||
|
|
||||||
|
BroadcastAudioBitrate int
|
||||||
|
BroadcastVideoBitrate int
|
||||||
|
BroadcastPreset string
|
||||||
BroadcastPipeline string
|
BroadcastPipeline string
|
||||||
|
|
||||||
ScreencastEnabled bool
|
ScreencastEnabled bool
|
||||||
@ -43,6 +46,21 @@ func (Capture) Init(cmd *cobra.Command) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// broadcast
|
// broadcast
|
||||||
|
cmd.PersistentFlags().Int("capture.screencast.audio_bitrate", 128, "broadcast audio bitrate in KB/s")
|
||||||
|
if err := viper.BindPFlag("capture.screencast.audio_bitrate", cmd.PersistentFlags().Lookup("capture.screencast.audio_bitrate")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.PersistentFlags().Int("capture.screencast.video_bitrate", 4096, "broadcast video bitrate in KB/s")
|
||||||
|
if err := viper.BindPFlag("capture.screencast.video_bitrate", cmd.PersistentFlags().Lookup("capture.screencast.video_bitrate")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.PersistentFlags().String("capture.screencast.preset", "veryfast", "broadcast speed preset for h264 encoding")
|
||||||
|
if err := viper.BindPFlag("capture.screencast.preset", cmd.PersistentFlags().Lookup("capture.screencast.preset")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
cmd.PersistentFlags().String("capture.broadcast.pipeline", "", "gstreamer pipeline used for broadcasting")
|
cmd.PersistentFlags().String("capture.broadcast.pipeline", "", "gstreamer pipeline used for broadcasting")
|
||||||
if err := viper.BindPFlag("capture.broadcast.pipeline", cmd.PersistentFlags().Lookup("capture.broadcast.pipeline")); err != nil {
|
if err := viper.BindPFlag("capture.broadcast.pipeline", cmd.PersistentFlags().Lookup("capture.broadcast.pipeline")); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -94,6 +112,9 @@ func (s *Capture) Set() {
|
|||||||
s.AudioCodec = codec.Opus()
|
s.AudioCodec = codec.Opus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.BroadcastAudioBitrate = viper.GetInt("capture.broadcast.audio_bitrate")
|
||||||
|
s.BroadcastVideoBitrate = viper.GetInt("capture.broadcast.video_bitrate")
|
||||||
|
s.BroadcastPreset = viper.GetString("capture.broadcast.preset")
|
||||||
s.BroadcastPipeline = viper.GetString("capture.broadcast.pipeline")
|
s.BroadcastPipeline = viper.GetString("capture.broadcast.pipeline")
|
||||||
|
|
||||||
s.ScreencastEnabled = viper.GetBool("capture.screencast.enabled")
|
s.ScreencastEnabled = viper.GetBool("capture.screencast.enabled")
|
||||||
|
Loading…
Reference in New Issue
Block a user