Update vnc2video usage

This commit is contained in:
Davide Depau 2020-08-09 22:31:12 +02:00
parent 99d4669f0d
commit cf3d889ba7

36
main.go
View File

@ -94,12 +94,19 @@ func recorder(c *cli.Context) error {
cchClient := make(chan vnc.ClientMessage) cchClient := make(chan vnc.ClientMessage)
errorCh := make(chan error) errorCh := make(chan error)
ccfg := &vnc.ClientConfig{ var secHandlers []vnc.SecurityHandler
SecurityHandlers: []vnc.SecurityHandler{ if c.String("password") == "" {
// &vnc.ClientAuthATEN{Username: []byte(os.Args[2]), Password: []byte(os.Args[3])} secHandlers = []vnc.SecurityHandler{
&vnc.ClientAuthVNC{Password: []byte(c.String("password"))},
&vnc.ClientAuthNone{}, &vnc.ClientAuthNone{},
}, }
} else {
secHandlers = []vnc.SecurityHandler{
&vnc.ClientAuthVNC{Password: []byte(c.String("password"))},
}
}
ccfg := &vnc.ClientConfig{
SecurityHandlers: secHandlers,
DrawCursor: true, DrawCursor: true,
PixelFormat: vnc.PixelFormat32bit, PixelFormat: vnc.PixelFormat32bit,
ClientMessageCh: cchClient, ClientMessageCh: cchClient,
@ -133,24 +140,13 @@ func recorder(c *cli.Context) error {
panic(err) panic(err)
} }
log.Infof("Using %s for encoding", ffmpeg_path) log.Infof("Using %s for encoding", ffmpeg_path)
vcodec := &encoders.Encoder{ vcodec := &encoders.X264ImageEncoder{
BinPath: ffmpeg_path, FFMpegBinPath: ffmpeg_path,
Framerate: c.Int("framerate"), Framerate: c.Int("framerate"),
Cmd: exec.Command(ffmpeg_path,
"-f", "image2pipe",
"-vcodec", "ppm",
"-r", strconv.Itoa(c.Int("framerate")),
"-an", // no audio
"-y",
"-i", "-",
"-vcodec", "libx264", //"libvpx",//"libvpx-vp9"//"libx264"
"-preset", "fast",
"-crf", "24",
c.String("outfile"),
),
} }
go vcodec.Run() //goland:noinspection GoUnhandledErrorResult
go vcodec.Run(c.String("outfile"))
for _, enc := range ccfg.Encodings { for _, enc := range ccfg.Encodings {
myRenderer, ok := enc.(vnc.Renderer) myRenderer, ok := enc.(vnc.Renderer)