mirror of
https://github.com/saily/vnc-recorder.git
synced 2025-04-28 02:30:15 +00:00
Make quality configurable
Signed-off-by: Daniel Widerin <daniel@widerin.net>
This commit is contained in:
parent
7b64627baa
commit
0ad37313d2
@ -32,6 +32,7 @@ library which made this wrapper possible.
|
|||||||
--port value VNC port (default: 5900) [$VR_VNC_PORT]
|
--port value VNC port (default: 5900) [$VR_VNC_PORT]
|
||||||
--password value Password to connect to the VNC host (default: "secret") [$VR_VNC_PASSWORD]
|
--password value Password to connect to the VNC host (default: "secret") [$VR_VNC_PASSWORD]
|
||||||
--framerate value Framerate to record (default: 30) [$VR_FRAMERATE]
|
--framerate value Framerate to record (default: 30) [$VR_FRAMERATE]
|
||||||
|
--crf value Constant Rate Factor (CRF) to record with (default: 35) [$VR_CRF]
|
||||||
--outfile value Output file to record to. (default: "output.mp4") [$VR_OUTFILE]
|
--outfile value Output file to record to. (default: "output.mp4") [$VR_OUTFILE]
|
||||||
--help, -h show help
|
--help, -h show help
|
||||||
--version, -v print the version
|
--version, -v print the version
|
||||||
|
@ -112,6 +112,7 @@ type X264ImageCustomEncoder struct {
|
|||||||
input io.WriteCloser
|
input io.WriteCloser
|
||||||
closed bool
|
closed bool
|
||||||
Framerate int
|
Framerate int
|
||||||
|
ConstantRateFactor int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (enc *X264ImageCustomEncoder) Init(videoFileName string) {
|
func (enc *X264ImageCustomEncoder) Init(videoFileName string) {
|
||||||
@ -126,10 +127,9 @@ func (enc *X264ImageCustomEncoder) Init(videoFileName string) {
|
|||||||
"-y",
|
"-y",
|
||||||
"-i", "-",
|
"-i", "-",
|
||||||
"-vcodec", "libx264",
|
"-vcodec", "libx264",
|
||||||
"-threads", "8",
|
|
||||||
"-preset", "veryfast",
|
"-preset", "veryfast",
|
||||||
"-g", "250",
|
"-g", "250",
|
||||||
"-crf", "37",
|
"-crf", strconv.Itoa(enc.ConstantRateFactor),
|
||||||
videoFileName,
|
videoFileName,
|
||||||
)
|
)
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
|
7
main.go
7
main.go
@ -64,6 +64,12 @@ func main() {
|
|||||||
Usage: "Framerate to record",
|
Usage: "Framerate to record",
|
||||||
EnvVars: []string{"VR_FRAMERATE"},
|
EnvVars: []string{"VR_FRAMERATE"},
|
||||||
},
|
},
|
||||||
|
&cli.IntFlag{
|
||||||
|
Name: "crf",
|
||||||
|
Value: 35,
|
||||||
|
Usage: "Constant Rate Factor (CRF) to record with",
|
||||||
|
EnvVars: []string{"VR_CRF"},
|
||||||
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "outfile",
|
Name: "outfile",
|
||||||
Value: "output.mp4",
|
Value: "output.mp4",
|
||||||
@ -143,6 +149,7 @@ func recorder(c *cli.Context) error {
|
|||||||
vcodec := &X264ImageCustomEncoder{
|
vcodec := &X264ImageCustomEncoder{
|
||||||
FFMpegBinPath: ffmpeg_path,
|
FFMpegBinPath: ffmpeg_path,
|
||||||
Framerate: c.Int("framerate"),
|
Framerate: c.Int("framerate"),
|
||||||
|
ConstantRateFactor: c.Int("crf"),
|
||||||
}
|
}
|
||||||
|
|
||||||
//goland:noinspection GoUnhandledErrorResult
|
//goland:noinspection GoUnhandledErrorResult
|
||||||
|
Loading…
Reference in New Issue
Block a user