Skip to content

Commit 6e5994f

Browse files
committed
allow passing in combined extra args to the video encoder
1 parent 9aba896 commit 6e5994f

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,15 @@ vod:
9494
width: 640 # px
9595
height: 360 # px
9696
bitrate: 800 # kbps
97-
# Optional ffmpeg overrides
97+
# Optional ffmpeg video overrides
9898
codec: h264_nvenc # default "libx264"
9999
preset: p1 # default "faster"
100100
profile: high # default "high"
101101
level: auto # default "4.0"
102-
extra-args:
103-
- "-tune:v"
104-
- "ull"
105-
- "-rc:v"
106-
- "cbr"
102+
extra-args: # optionally, additional ffmpeg video encoder arguments
103+
- "-tune:v=ull" # can be passed either as combined args, and will be split
104+
- "-rc:v" # or parameter ...
105+
- "cbr" # ... and value on separate lines
107106
540p:
108107
width: 960
109108
height: 540

hlsvod/transcode.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,16 @@ func TranscodeSegments(ctx context.Context, ffmpegBinary string, config Transcod
125125

126126
// extra args
127127
if len(profile.ExtraArgs) > 0 {
128-
args = append(args, profile.ExtraArgs...)
128+
extraArgs := make([]string, 0, len(profile.ExtraArgs))
129+
for _, arg := range profile.ExtraArgs {
130+
// Split combined args like "-tune:v=ull" into "-tune:v", "ull"
131+
if strings.Contains(arg, "=") {
132+
extraArgs = append(extraArgs, strings.SplitN(arg, "=", 2)...)
133+
} else {
134+
extraArgs = append(extraArgs, arg)
135+
}
136+
}
137+
args = append(args, extraArgs...)
129138
}
130139
}
131140

0 commit comments

Comments
 (0)