Skip to content

Return to opus. It just works better #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: base-sha/f331bc6f04aa29181c0af4416ff4c0c8aaee7a5e
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions ttt.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def audio_notification(audiofile, apobj, body, title):
Examples:
audio_notification(audiofile, apobj, body, title)
"""
flacfile = Path(audiofile).with_suffix(".flac")
opusfile = Path(audiofile).with_suffix(".opus")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (testing): Missing test for the new audio file format change.

The change from FLAC to OPUS format should be accompanied by a test to ensure the new format is handled correctly and that the audio quality meets the expected standards.

ffmpeg_cmd = [
"ffmpeg",
"-y",
Expand All @@ -233,21 +233,25 @@ def audio_notification(audiofile, apobj, body, title):
"-filter:a",
"loudnorm=i=-14",
"-c:a",
"flac",
flacfile,
"-compression_level",
"12",
"libopus",
"-application",
"voip",
"-cutoff",
"8000",
Comment on lines +239 to +240

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (performance): Review the '8000' Hz cutoff frequency for appropriateness in the VOIP context.

The cutoff frequency of 8000 Hz might not be suitable for all VOIP applications, especially if high-quality audio is required. Consider if a higher cutoff might be necessary.

Suggested change
"-cutoff",
"8000",
"-cutoff",
"12000",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment correct?

"-vbr",
"on",
opusfile,
Comment on lines +236 to +243

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (testing): Consider adding tests for new ffmpeg command options.

The addition of new options like 'libopus', 'voip', 'cutoff', '8000', and 'vbr' in the ffmpeg command suggests a need for tests to verify that these settings are correctly applied and function as intended.

]
subprocess.run(ffmpeg_cmd, check=True, capture_output=True)

flacfile = str(flacfile)
opusfile = str(opusfile)
apobj.notify(
body=body,
title=title,
attach=flacfile,
attach=opusfile,
)
# Remove flacfile; audiofile and json unlinked later
Path.unlink(flacfile)
# Remove opusfile; audiofile and json unlinked later
Path.unlink(opusfile)


def import_notification_destinations():
Expand Down