Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,7 @@ API examples:
- You can use `width`/`w` and/or `height`/`h` params
- You can use `rotate` param with `90`, `180`, `270` or `-90` values
- You can use `hardware`/`hw` param [read more](https://github.com/AlexxIT/go2rtc/wiki/Hardware-acceleration)
- You can use `quality` param to change jpeg quality (for example `1`)

**PS.** This module also supports streaming to the server console (terminal) in the **animated ASCII art** format ([read more](https://github.com/AlexxIT/go2rtc/blob/master/internal/mjpeg/README.md)):

Expand Down
8 changes: 7 additions & 1 deletion internal/ffmpeg/jpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func parseQuery(query url.Values) *ffmpeg.Args {

var width = -1
var height = -1
var r, hw string
var r, hw, quality string

for k, v := range query {
switch k {
Expand All @@ -57,6 +57,8 @@ func parseQuery(query url.Values) *ffmpeg.Args {
r = v[0]
case "hardware", "hw":
hw = v[0]
case "quality":
quality = v[0]
}
}

Expand All @@ -79,5 +81,9 @@ func parseQuery(query url.Values) *ffmpeg.Args {
hardware.MakeHardware(args, hw, defaults)
}

if quality != "" {
args.Codecs = append(args.Codecs, fmt.Sprintf("-q:v %s", quality))
}

return args
}