Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed loudness normalization - impossible to work with pipes by usi…
…ng FFmpeg and M4A audio
- Loading branch information
1 parent
dd6d174
commit d970ad3
Showing
12 changed files
with
31 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import mutagen | ||
import subprocess | ||
|
||
from pydub import effects, AudioSegment | ||
from io import BytesIO | ||
from tempfile import TemporaryFile | ||
|
||
ctr = BytesIO() | ||
# command = "ffmpeg -i Inm-N5rLUSI.m4a -filter:a loudnorm -vn -b:a 128k -c:a aac -f ipod {}".format(tf.name).split(" ") | ||
# print(tf.name) | ||
# proc = subprocess.Popen(command, stderr=subprocess.PIPE) | ||
# out, err = proc.communicate() | ||
# print(err.decode("utf-8")) | ||
with open("Inm-N5rLUSI.m4a", "rb") as audio: | ||
sound = audio.read() | ||
bf = BytesIO(sound) | ||
s = AudioSegment(bf, format="m4a") | ||
s2 = effects.normalize(s) | ||
s2.export(bf, format="m4a") | ||
c = input("Continue? [yes/no] - ") | ||
if c == "yes": | ||
print(tf.closed) | ||
tf.seek(0) | ||
data = BytesIO(tf.read()) | ||
data.seek(0) | ||
print(mutagen.File(data).pprint()) | ||
with open("out.m4a", "wb") as file: | ||
data.seek(0) | ||
file.write(data.read()) | ||
|