Rename param source to video for ffmpeg virtual source

This commit is contained in:
Alex X
2024-05-12 15:58:17 +03:00
parent 778245dd1c
commit 5ccbd7c1c2
2 changed files with 14 additions and 8 deletions
+6
View File
@@ -280,6 +280,12 @@ func parseArgs(s string) *ffmpeg.Args {
}
}
if query["bitrate"] != nil {
// https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate
b := query["bitrate"][0]
args.AddCodec("-b:v " + b + " -maxrate " + b + " -bufsize " + b)
}
// 4. Process audio codecs
if args.Audio > 0 {
for _, audio := range query["audio"] {
+8 -8
View File
@@ -11,13 +11,13 @@ func GetInput(src string) (string, error) {
}
// set defaults (using Add instead of Set)
query.Add("source", "testsrc")
query.Add("video", "testsrc")
query.Add("size", "1920x1080")
query.Add("decimals", "2")
// https://ffmpeg.org/ffmpeg-filters.html
source := query.Get("source")
input := "-re -f lavfi -i " + source
video := query.Get("video")
input := "-re -f lavfi -i " + video
sep := "=" // first separator
for key, values := range query {
@@ -29,18 +29,18 @@ func GetInput(src string) (string, error) {
case "size":
switch value {
case "720":
value = "1280x720"
value = "1280x720" // crf=1 -> 12 Mbps
case "1080":
value = "1920x1080"
value = "1920x1080" // crf=1 -> 25 Mbps
case "2K":
value = "2560x1440"
value = "2560x1440" // crf=1 -> 43 Mbps
case "4K":
value = "3840x2160"
value = "3840x2160" // crf=1 -> 103 Mbps
case "8K":
value = "7680x4230" // https://reolink.com/blog/8k-resolution/
}
case "decimals":
if source != "testsrc" {
if video != "testsrc" {
continue
}
default: