mirror of
https://github.com/amitbet/vnc2video.git
synced 2025-08-26 15:58:37 +00:00
cleaning and preparing for more encoding implementations
This commit is contained in:
parent
1468ef65b5
commit
41cec2a1e8
@ -25,11 +25,11 @@ func (enc *DV8ImageEncoder) Init(videoFileName string) {
|
|||||||
"-f", "image2pipe",
|
"-f", "image2pipe",
|
||||||
"-vcodec", "ppm",
|
"-vcodec", "ppm",
|
||||||
//"-r", strconv.Itoa(framerate),
|
//"-r", strconv.Itoa(framerate),
|
||||||
"-r", "3",
|
"-r", "5",
|
||||||
//"-i", "pipe:0",
|
//"-i", "pipe:0",
|
||||||
"-i", "-",
|
"-i", "-",
|
||||||
"-vcodec", "libvpx", //"libvpx",//"libvpx-vp9"//"libx264"
|
"-vcodec", "libvpx", //"libvpx",//"libvpx-vp9"//"libx264"
|
||||||
"-b:v", "2M",
|
"-b:v", "1M",
|
||||||
"-threads", "8",
|
"-threads", "8",
|
||||||
//"-speed", "0",
|
//"-speed", "0",
|
||||||
//"-lossless", "1", //for vpx
|
//"-lossless", "1", //for vpx
|
||||||
|
@ -25,18 +25,18 @@ func (enc *DV9ImageEncoder) Init(videoFileName string) {
|
|||||||
"-f", "image2pipe",
|
"-f", "image2pipe",
|
||||||
"-vcodec", "ppm",
|
"-vcodec", "ppm",
|
||||||
//"-r", strconv.Itoa(framerate),
|
//"-r", strconv.Itoa(framerate),
|
||||||
"-r", "3",
|
"-r", "5",
|
||||||
//"-i", "pipe:0",
|
//"-i", "pipe:0",
|
||||||
"-i", "-",
|
"-i", "-",
|
||||||
"-vcodec", "libvpx-vp9", //"libvpx",//"libvpx-vp9"//"libx264"
|
"-vcodec", "libvpx-vp9", //"libvpx",//"libvpx-vp9"//"libx264"
|
||||||
"-b:v", "2M",
|
"-b:v", "1M",
|
||||||
"-threads", "8",
|
"-threads", "8",
|
||||||
//"-speed", "0",
|
//"-speed", "0",
|
||||||
//"-lossless", "1", //for vpx
|
//"-lossless", "1", //for vpx
|
||||||
// "-tile-columns", "6",
|
// "-tile-columns", "6",
|
||||||
//"-frame-parallel", "1",
|
//"-frame-parallel", "1",
|
||||||
// "-an", "-f", "webm",
|
// "-an", "-f", "webm",
|
||||||
"-cpu-used", "-16",
|
"-cpu-used", "-8",
|
||||||
|
|
||||||
"-preset", "ultrafast",
|
"-preset", "ultrafast",
|
||||||
"-deadline", "realtime",
|
"-deadline", "realtime",
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package vnc2webm
|
package vnc2webm
|
||||||
|
|
||||||
import "encoding/binary"
|
import "encoding/binary"
|
||||||
|
import "image"
|
||||||
|
|
||||||
type CursorPseudoEncoding struct {
|
type CursorPseudoEncoding struct {
|
||||||
Colors []Color
|
Colors []Color
|
||||||
BitMask []byte
|
BitMask []byte
|
||||||
|
Image image.Image
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*CursorPseudoEncoding) Supported(Conn) bool {
|
func (*CursorPseudoEncoding) Supported(Conn) bool {
|
||||||
@ -24,6 +26,7 @@ func (enc *CursorPseudoEncoding) Read(c Conn, rect *Rectangle) error {
|
|||||||
if err := binary.Read(c, binary.BigEndian, &bitmask); err != nil {
|
if err := binary.Read(c, binary.BigEndian, &bitmask); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
rectStride := 4 * rect.Width
|
rectStride := 4 * rect.Width
|
||||||
for i := uint16(0); i < rect.Height; i++ {
|
for i := uint16(0); i < rect.Height; i++ {
|
||||||
|
@ -50,7 +50,10 @@ func main() {
|
|||||||
// }
|
// }
|
||||||
//vcodec := &encoders.MJPegImageEncoder{Quality: 60, Framerate: 6}
|
//vcodec := &encoders.MJPegImageEncoder{Quality: 60, Framerate: 6}
|
||||||
vcodec := &encoders.X264ImageEncoder{}
|
vcodec := &encoders.X264ImageEncoder{}
|
||||||
counter := 0
|
//vcodec := &encoders.DV8ImageEncoder{}
|
||||||
|
//vcodec := &encoders.DV9ImageEncoder{}
|
||||||
|
|
||||||
|
//counter := 0
|
||||||
//vcodec.Init("./output" + strconv.Itoa(counter))
|
//vcodec.Init("./output" + strconv.Itoa(counter))
|
||||||
go vcodec.Run("./ffmpeg", "./output.mp4")
|
go vcodec.Run("./ffmpeg", "./output.mp4")
|
||||||
|
|
||||||
@ -85,13 +88,14 @@ func main() {
|
|||||||
// fmt.Println(err)
|
// fmt.Println(err)
|
||||||
// os.Exit(1)
|
// os.Exit(1)
|
||||||
// }
|
// }
|
||||||
|
if msg.Type() == vnc.FramebufferUpdateMsgType {
|
||||||
counter++
|
//counter++
|
||||||
//jpeg.Encode(out, screenImage, nil)
|
//jpeg.Encode(out, screenImage, nil)
|
||||||
vcodec.Encode(screenImage)
|
vcodec.Encode(screenImage)
|
||||||
reqMsg := vnc.FramebufferUpdateRequest{Inc: 1, X: 0, Y: 0, Width: cc.Width(), Height: cc.Height()}
|
reqMsg := vnc.FramebufferUpdateRequest{Inc: 1, X: 0, Y: 0, Width: cc.Width(), Height: cc.Height()}
|
||||||
reqMsg.Write(cc)
|
reqMsg.Write(cc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
cc.Wait()
|
cc.Wait()
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,12 @@ func (c *ServerConn) Config() interface{} {
|
|||||||
return c.cfg
|
return c.cfg
|
||||||
}
|
}
|
||||||
func (c *ServerConn) GetEncInstance(typ EncodingType) Encoding {
|
func (c *ServerConn) GetEncInstance(typ EncodingType) Encoding {
|
||||||
return &TightEncoding{}
|
for _, enc := range c.encodings {
|
||||||
|
if enc.Type() == typ {
|
||||||
|
return enc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Conn returns underlining server net.Conn
|
// Conn returns underlining server net.Conn
|
||||||
|
Loading…
Reference in New Issue
Block a user