Skip to content

Commit c5e67eb

Browse files
committed
allow configuration of VOD audio codec
1 parent 6e5994f commit c5e67eb

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ vod:
126126
video-keyframes: false
127127
# Single audio profile used
128128
audio-profile:
129-
bitrate: 192 # kbps
129+
codec: aac # default "aac", but "copy" is an alternative
130+
bitrate: 192 # kbps
130131
# If cache is enabled
131132
cache: true
132133
# If dir is empty, cache will be stored in the same directory as media source

hlsvod/transcode.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ type VideoProfile struct {
3636
}
3737

3838
type AudioProfile struct {
39-
Bitrate int // in kilobytes
39+
Codec string // audio codec (e.g., "aac", "copy", "libopus")
40+
Bitrate int // in kilobytes (0 means use codec default)
4041
}
4142

4243
// returns a channel, that delivers name of the segments as they are encoded
@@ -141,11 +142,12 @@ func TranscodeSegments(ctx context.Context, ffmpegBinary string, config Transcod
141142
// Audio specs
142143
if config.AudioProfile != nil {
143144
profile := config.AudioProfile
144-
145-
args = append(args, []string{
146-
"-c:a", "aac",
147-
"-b:a", fmt.Sprintf("%dk", profile.Bitrate),
148-
}...)
145+
if profile.Codec != "" {
146+
args = append(args, "-c:a", profile.Codec)
147+
if profile.Bitrate > 0 {
148+
args = append(args, "-b:a", fmt.Sprintf("%dk", profile.Bitrate))
149+
}
150+
}
149151
}
150152

151153
// Segmenting specs

0 commit comments

Comments
 (0)