From: Guillaume Pellerin Date: Wed, 22 Jan 2014 14:39:46 +0000 (+0100) Subject: add gst resampling for mp3 and ogg X-Git-Tag: 0.5.3~14 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=a8a829b168588b6ce10c037792c9a80b93c8c199;p=timeside.git add gst resampling for mp3 and ogg --- diff --git a/tests/sandbox/test_mp3_3.py b/tests/sandbox/test_mp3_3.py index 2d74b37..13b7159 100644 --- a/tests/sandbox/test_mp3_3.py +++ b/tests/sandbox/test_mp3_3.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +import sys import time import timeside @@ -13,10 +14,9 @@ metadata = {'TIT2': 'title', #title2 # 'COMM': 'blabla', #comment } -decoder = timeside.decoder.FileDecoder('/home/momo/dev/telemeta/sandboxes/sandbox_lam/media/items/2012/09/26/LAM_ETUD_01_01_004.wav') +decoder = timeside.decoder.FileDecoder(sys.argv[-1]) -encoder = timeside.encoder.Mp3Encoder('/tmp/output.mp3') +encoder = timeside.encoder.Mp3Encoder('/tmp/output.mp3', overwrite=True) encoder.set_metadata(metadata) (decoder | encoder).run() - diff --git a/timeside/encoder/mp3.py b/timeside/encoder/mp3.py index a0c6d48..5de1bd0 100644 --- a/timeside/encoder/mp3.py +++ b/timeside/encoder/mp3.py @@ -40,7 +40,7 @@ class Mp3Encoder(GstEncoder): super(Mp3Encoder, self).setup(channels, samplerate, blocksize, totalframes) self.pipe = '''appsrc name=src - ! audioconvert + ! audioconvert ! audioresample ! lamemp3enc target=quality quality=2 encoding-engine-quality=standard ! xingmux ! id3v2mux diff --git a/timeside/encoder/ogg.py b/timeside/encoder/ogg.py index 511c711..32f309b 100644 --- a/timeside/encoder/ogg.py +++ b/timeside/encoder/ogg.py @@ -32,7 +32,7 @@ class VorbisEncoder(GstEncoder): def setup(self, channels=None, samplerate=None, blocksize=None, totalframes=None): super(VorbisEncoder, self).setup(channels, samplerate, blocksize, totalframes) self.pipe = ''' appsrc name=src - ! audioconvert + ! audioconvert ! audioresample ! vorbisenc quality=0.9 ! oggmux '''