-
Notifications
You must be signed in to change notification settings - Fork 14
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
Allow replacement of GSM/WAV49 audio archives with other formats #492
Conversation
apps/app_rpt.c
Outdated
@@ -2962,7 +2962,7 @@ static inline void log_keyed(struct rpt *myrpt) | |||
time(&myt); | |||
strftime(mydate, sizeof(mydate) - 1, "%Y%m%d%H%M%S", localtime(&myt)); | |||
sprintf(myfname, "%s/%s/%s", myrpt->p.archivedir, myrpt->name, mydate); | |||
myrpt->monstream = ast_writefile(myfname, "wav49", "app_rpt Air Archive", O_CREAT | O_APPEND, 0, 0644); | |||
myrpt->monstream = ast_writefile(myfname, "wav", "app_rpt Air Archive", O_CREAT | O_APPEND, 0, 0644); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I support this change I will ask whether this going to [significantly] change the size of the archived audio files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I'm not sure there's a better format to choose if we want "native" tools to work with the archive data. Ideally you could do an MP3 or OGG file but that isn't supported. From looking at the code, we can pick from what's in core show file format
. Nothing else on that list would be generally readable by Windows and Mac commonly-installed software I don't believe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mp3 can be supported (I did some work to patch the mp3 support in Asterisk to allow this for a client), but the problem with any compressed formats is it increases the transcoding load, hence why raw formats like wav tend to get used.
Obviously the question there is whether to optimize for space or CPU, and I think the latter is more common on production systems but I could see the value in the other way as well. "Compatibility with consumer devices" is certainly another factor and not one I usually see come up. For that, I agree you can't go wrong with wav
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the size of WAV files become a real problem, we could create a systemd.timer that compresses any WAV files older than 5 minutes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jxmx asterisk -x 'module load format_mps'
😄
One suggestion made in the issue discussion was to add a configuration file setting that would specify the file format. By adding that we can keep the current .wav49 and, at the same time, allow other formats (.wav, .mp3, ...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a configuration option to change the filetype seems unnecessary given that archivedir
isn't a commonly-used command to begin with that I see. My understanding of why MP3 and OGG isn't loaded by default is there's problem with them, perhaps performance-related? If we're going to change this to mp3, then we'll also need to change modules.conf
and we'll have to add logic to asl3-asterisk.postinst
to edit customized modules.conf
to load mp3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allan brings up a good point. Now would be as easy a time as ever to just do away with a hardcoded format and turn it into a variable that can be set from the config. Defaulting to wav would make sense, but users could easily override it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My $0.02 :
- make the format choice a configuration variable
- have the new "archiveformat" default value continue to be "wav49"
This way, all remains the same for running configurations yet folks will have the ability to change the format to one that works better for them. And, if folks do change the format then they can deal with any increased size, CPU requirements, compression issues, etc.,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@InterLinked1 wrote:
mp3 can be supported (I did some work to patch the mp3 support in Asterisk to allow this for a client), but the problem with any compressed formats is it increases the transcoding load, hence why raw formats like wav tend to get used.
Q? Does Asterisk have/use "a" native raw format? If not, then wouldn't we need to perform some transcoding to whatever format is chosen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think slin is technically the "raw format" but the PCM formats (ulaw/alaw) are pretty close I believe.
core show translations
shows some of the appx. costs in converting between different formats
ulaw/alaw are raw telephony formats and wav isn't compressed so that's why these are usually good choices. gsm and mp3 are compressed and lossy, so they are more computationally intensive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code wise this seems fine, but how about a more useful commit message?
app_rpt: Use wav for recordings instead of wav49
Resolves #485
or something like that?
Slightly better but still not in the suggested format. The |
Maybe while tinkering right here we should fix the file name generation to Line 2964 in b5b110a
|
For those following this PR, I had my hopes up that we might be able to create "mp3" audio archives. Sadly :
|
The ability exists, but the MP3 write patch isn't merged upstream yet - see Asterisk PR 665 / 704 |
9bc2b8d
to
99ea26b
Compare
I have updated the PR to allow you to specify the audio recording format using the new ... and |
configs/rpt/rpt.conf
Outdated
; logging can be useful in debugging, policing, or other creative things. | ||
; | ||
; The "archiveformat" line can be used to specify the format of the audio | ||
; recordings. By default, the format will be "wav49" (GSM in a WAV|wav49 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just say WAV instead of WAV|wav49 (wav49 is gsm in a wav wrapper)
4ff798f
to
02eb25f
Compare
This change means that one will be now be able to specify an audio recording format other than "WAV". Resolves #485
Addresses #485