mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
screencast quality and framerate.
This commit is contained in:
parent
3161870906
commit
75393905e8
@ -59,12 +59,12 @@ func CreateRTMPPipeline(pipelineDevice string, pipelineDisplay string, pipelineS
|
||||
}
|
||||
|
||||
// CreateJPEGPipeline creates a GStreamer Pipeline
|
||||
func CreateJPEGPipeline(pipelineDisplay string, pipelineSrc string) (*Pipeline, error) {
|
||||
func CreateJPEGPipeline(pipelineDisplay string, pipelineSrc string, rate string, quality string) (*Pipeline, error) {
|
||||
var pipelineStr string
|
||||
if pipelineSrc != "" {
|
||||
pipelineStr = fmt.Sprintf(pipelineSrc, pipelineDisplay)
|
||||
} else {
|
||||
pipelineStr = fmt.Sprintf("ximagesrc display-name=%s show-pointer=true use-damage=false ! videoconvert ! videoscale ! videorate ! video/x-raw,framerate=10/1 ! jpegenc quality=60" + appSink, pipelineDisplay)
|
||||
pipelineStr = fmt.Sprintf("ximagesrc display-name=%s show-pointer=true use-damage=false ! videoconvert ! videoscale ! videorate ! video/x-raw,framerate=%s ! jpegenc quality=%s" + appSink, pipelineDisplay, rate, quality)
|
||||
}
|
||||
|
||||
return CreatePipeline(pipelineStr, 0)
|
||||
|
@ -81,6 +81,8 @@ func (manager *ScreencastManagerCtx) createPipeline() error {
|
||||
manager.pipeline, err = gst.CreateJPEGPipeline(
|
||||
manager.config.Display,
|
||||
manager.config.ScreencastPipeline,
|
||||
manager.config.ScreencastRate,
|
||||
manager.config.ScreencastQuality,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
@ -16,6 +16,8 @@ type Capture struct {
|
||||
|
||||
BroadcastPipeline string
|
||||
Screencast bool
|
||||
ScreencastRate string
|
||||
ScreencastQuality string
|
||||
ScreencastPipeline string
|
||||
}
|
||||
|
||||
@ -89,6 +91,16 @@ func (Capture) Init(cmd *cobra.Command) error {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().String("screencast_rate", "10/1", "set screencast frame rate")
|
||||
if err := viper.BindPFlag("screencast_rate", cmd.PersistentFlags().Lookup("screencast_rate")); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().String("screencast_quality", "60", "set screencast JPEG quality")
|
||||
if err := viper.BindPFlag("screencast_quality", cmd.PersistentFlags().Lookup("screencast_quality")); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().String("screencast_pipeline", "", "custom screencast pipeline")
|
||||
if err := viper.BindPFlag("screencast_pipeline", cmd.PersistentFlags().Lookup("screencast_pipeline")); err != nil {
|
||||
return err
|
||||
@ -127,5 +139,7 @@ func (s *Capture) Set() {
|
||||
|
||||
s.BroadcastPipeline = viper.GetString("broadcast_pipeline")
|
||||
s.Screencast = viper.GetBool("screencast")
|
||||
s.ScreencastRate = viper.GetString("screencast_rate")
|
||||
s.ScreencastQuality = viper.GetString("screencast_quality")
|
||||
s.ScreencastPipeline = viper.GetString("screencast_pipeline")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user