summaryrefslogtreecommitdiffstats
path: root/recording
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2023-03-18 03:11:00 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2023-03-21 12:43:49 +0100
commitc70f062a484fd2d93e9c873e7f1352b10fe80f14 (patch)
tree78371f2a70c8b6521daf68d3d7ad8f2594f54cdc /recording
parent6bd3a5e73ee14bfe4759dcbb8d3628cd75887db6 (diff)
Add configuration options for ffmpeg
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'recording')
-rw-r--r--recording/server.conf.in15
-rw-r--r--recording/src/nextcloud/talk/recording/Config.py32
-rw-r--r--recording/src/nextcloud/talk/recording/Service.py8
3 files changed, 51 insertions, 4 deletions
diff --git a/recording/server.conf.in b/recording/server.conf.in
index 0e27413fe..6f7ad526b 100644
--- a/recording/server.conf.in
+++ b/recording/server.conf.in
@@ -94,3 +94,18 @@
# This must be the same value as configured in the signaling server
# configuration file.
#internalsecret = the-shared-secret-for-internal-clients
+
+[ffmpeg]
+# The options given to FFmpeg to encode the audio output. The options given here
+# fully override the default options for the audio output.
+#outputaudio = -c:a libopus
+
+# The options given to FFmpeg to encode the video output. The options given here
+# fully override the default options for the video output.
+#outputvideo = -c:v libvpx -quality:v realtime
+
+# The extension of the file for audio only recordings.
+#extensionaudio = .ogg
+
+# The extension of the file for audio and video recordings.
+#extensionvideo = .webm
diff --git a/recording/src/nextcloud/talk/recording/Config.py b/recording/src/nextcloud/talk/recording/Config.py
index 6ce01bd50..616d62426 100644
--- a/recording/src/nextcloud/talk/recording/Config.py
+++ b/recording/src/nextcloud/talk/recording/Config.py
@@ -204,4 +204,36 @@ class Config:
return self._configParser.get('signaling', 'internalsecret', fallback=None)
+ def getFfmpegOutputAudio(self):
+ """
+ Returns the options given to FFmpeg to encode the audio output.
+
+ Defaults to ['-c:a', 'libopus'].
+ """
+ return self._configParser.get('ffmpeg', 'outputaudio', fallback='-c:a libopus').split()
+
+ def getFfmpegOutputVideo(self):
+ """
+ Returns the options given to FFmpeg to encode the video output.
+
+ Defaults to ['-c:v', 'libvpx', '-quality:v', 'realtime'].
+ """
+ return self._configParser.get('ffmpeg', 'outputvideo', fallback='-c:v libvpx -quality:v realtime').split()
+
+ def getFfmpegExtensionAudio(self):
+ """
+ Returns the extension of the output file for audio recordings.
+
+ Defaults to ".ogg".
+ """
+ return self._configParser.get('ffmpeg', 'extensionaudio', fallback='.ogg')
+
+ def getFfmpegExtensionVideo(self):
+ """
+ Returns the extension of the output file for video recordings.
+
+ Defaults to ".webm".
+ """
+ return self._configParser.get('ffmpeg', 'extensionvideo', fallback='.webm')
+
config = Config()
diff --git a/recording/src/nextcloud/talk/recording/Service.py b/recording/src/nextcloud/talk/recording/Service.py
index 706afb682..a3b72b334 100644
--- a/recording/src/nextcloud/talk/recording/Service.py
+++ b/recording/src/nextcloud/talk/recording/Service.py
@@ -54,12 +54,12 @@ def getRecorderArgs(status, displayId, audioSinkIndex, width, height, extensionl
ffmpegCommon = ['ffmpeg', '-loglevel', 'level+warning', '-n']
ffmpegInputAudio = ['-f', 'pulse', '-i', audioSinkIndex]
ffmpegInputVideo = ['-f', 'x11grab', '-draw_mouse', '0', '-video_size', f'{width}x{height}', '-i', displayId]
- ffmpegOutputAudio = ['-c:a', 'libopus']
- ffmpegOutputVideo = ['-c:v', 'libvpx', '-quality:v', 'realtime']
+ ffmpegOutputAudio = config.getFfmpegOutputAudio()
+ ffmpegOutputVideo = config.getFfmpegOutputVideo()
- extension = '.ogg'
+ extension = config.getFfmpegExtensionAudio()
if status == RECORDING_STATUS_AUDIO_AND_VIDEO:
- extension = '.webm'
+ extension = config.getFfmpegExtensionVideo()
outputFileName = extensionlessOutputFileName + extension