Skip to content

Commit b93ad37

Browse files
Merge pull request #9119 from nextcloud/add-configuration-options-for-ffmpeg
Add configuration options for FFmpeg
2 parents 6d887a8 + e702db9 commit b93ad37

3 files changed

Lines changed: 51 additions & 4 deletions

File tree

recording/server.conf.in

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,18 @@
9494
# This must be the same value as configured in the signaling server
9595
# configuration file.
9696
#internalsecret = the-shared-secret-for-internal-clients
97+
98+
[ffmpeg]
99+
# The options given to FFmpeg to encode the audio output. The options given here
100+
# fully override the default options for the audio output.
101+
#outputaudio = -c:a libopus
102+
103+
# The options given to FFmpeg to encode the video output. The options given here
104+
# fully override the default options for the video output.
105+
#outputvideo = -c:v libvpx -deadline:v realtime -crf 10 -b:v 1M
106+
107+
# The extension of the file for audio only recordings.
108+
#extensionaudio = .ogg
109+
110+
# The extension of the file for audio and video recordings.
111+
#extensionvideo = .webm

recording/src/nextcloud/talk/recording/Config.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,36 @@ def getSignalingSecret(self, signalingUrl):
204204

205205
return self._configParser.get('signaling', 'internalsecret', fallback=None)
206206

207+
def getFfmpegOutputAudio(self):
208+
"""
209+
Returns the options given to FFmpeg to encode the audio output.
210+
211+
Defaults to ['-c:a', 'libopus'].
212+
"""
213+
return self._configParser.get('ffmpeg', 'outputaudio', fallback='-c:a libopus').split()
214+
215+
def getFfmpegOutputVideo(self):
216+
"""
217+
Returns the options given to FFmpeg to encode the video output.
218+
219+
Defaults to ['-c:v', 'libvpx', '-deadline:v', 'realtime', '-crf', '10', '-b:v', '1M'].
220+
"""
221+
return self._configParser.get('ffmpeg', 'outputvideo', fallback='-c:v libvpx -deadline:v realtime -crf 10 -b:v 1M').split()
222+
223+
def getFfmpegExtensionAudio(self):
224+
"""
225+
Returns the extension of the output file for audio recordings.
226+
227+
Defaults to ".ogg".
228+
"""
229+
return self._configParser.get('ffmpeg', 'extensionaudio', fallback='.ogg')
230+
231+
def getFfmpegExtensionVideo(self):
232+
"""
233+
Returns the extension of the output file for video recordings.
234+
235+
Defaults to ".webm".
236+
"""
237+
return self._configParser.get('ffmpeg', 'extensionvideo', fallback='.webm')
238+
207239
config = Config()

recording/src/nextcloud/talk/recording/Service.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ def getRecorderArgs(status, displayId, audioSinkIndex, width, height, extensionl
5454
ffmpegCommon = ['ffmpeg', '-loglevel', 'level+warning', '-n']
5555
ffmpegInputAudio = ['-f', 'pulse', '-i', audioSinkIndex]
5656
ffmpegInputVideo = ['-f', 'x11grab', '-draw_mouse', '0', '-video_size', f'{width}x{height}', '-i', displayId]
57-
ffmpegOutputAudio = ['-c:a', 'libopus']
58-
ffmpegOutputVideo = ['-c:v', 'libvpx', '-quality:v', 'realtime']
57+
ffmpegOutputAudio = config.getFfmpegOutputAudio()
58+
ffmpegOutputVideo = config.getFfmpegOutputVideo()
5959

60-
extension = '.ogg'
60+
extension = config.getFfmpegExtensionAudio()
6161
if status == RECORDING_STATUS_AUDIO_AND_VIDEO:
62-
extension = '.webm'
62+
extension = config.getFfmpegExtensionVideo()
6363

6464
outputFileName = extensionlessOutputFileName + extension
6565

0 commit comments

Comments
 (0)