From 4ec67f337fac6e0827bb1b1ae85691ad43462d55 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Mon, 21 Jun 2021 19:20:58 +0200 Subject: [PATCH] Unlock WavPack codec for recorder --- CHANGES.rst | 1 + README.rst | 4 ++-- saraswati/recorder.py | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 92b306f..72d6174 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,6 +7,7 @@ in progress =========== - Add guidelines for running Saraswati on Docker +- Unlock WavPack codec for recorder 2021-06-21 0.3.0 diff --git a/README.rst b/README.rst index 817d754..65faa64 100644 --- a/README.rst +++ b/README.rst @@ -83,7 +83,7 @@ Debian-based systems sudo apt-get update sudo apt-get install --yes libgstreamer1.0 gstreamer1.0-tools gstreamer1.0-alsa gstreamer1.0-plugins-base gstreamer1.0-plugins-good sudo apt-get install --yes python3 python3-pip python3-gst-1.0 python3-gi python3-tz - sudo apt-get install --yes alsa-utils mkvtoolnix flac + sudo apt-get install --yes alsa-utils mkvtoolnix flac wavpack sudo pip3 install saraswati --upgrade macOS systems @@ -91,7 +91,7 @@ macOS systems :: brew install gstreamer gst-python gst-libav gst-plugins-base gst-plugins-good - brew install mkvtoolnix flac + brew install mkvtoolnix flac wavpack Configure system diff --git a/saraswati/recorder.py b/saraswati/recorder.py index a97dc8c..b2b81a0 100644 --- a/saraswati/recorder.py +++ b/saraswati/recorder.py @@ -155,7 +155,9 @@ def add_channel(self, name: str, source: str): # TODO: Add WavPack (wavpackenc) # https://gstreamer.freedesktop.org/documentation/wavpack/wavpackenc.html pipeline_expression = ( - f"{source} ! audioconvert ! queue ! flacenc ! flactag ! flacparse ! " + # TODO: Make "codec" configurable. + #f"{source} ! audioconvert ! queue ! flacenc ! flactag ! flacparse ! " + f"{source} ! audioconvert ! queue ! wavpackenc ! " # ! wavpackparse f"muxer.audio_0 splitmuxsink name=muxer muxer=matroskamux " f"max-size-time={chunk_duration_ns:.0f} max-files={self.settings.chunk_max_files}" ) @@ -217,6 +219,10 @@ def on_message(self, pipeline: Pipeline, bus, message): logger.info("End of stream: {}".format(message)) pipeline.gst.set_state(Gst.State.NULL) + elif message.type == Gst.MessageType.WARNING: + err, debug = message.parse_warning() + logger.warning("Pipeline warning: {} ({})".format(err, debug)) + elif message.type == Gst.MessageType.ERROR: err, debug = message.parse_error() logger.error("Pipeline error: {} ({})".format(err, debug))