Howto:Convert wave files in to G722 coder files

From innovaphone wiki
Jump to navigation Jump to search


Applies To

This information applies to

  • All innovaphone gateways (IP302, IP305, IP800, IP30x0, IP60x0) Version 9 and later.

This method is deprecated - rather use the innovaphone audio converter located at http://www.innovaphone.com/en/support/convert.html

More Information

Problem Details

As mentioned in the related article, softcod is used for conversion of WAV files to G711/G723/G729 formatted files.

When aiming for the new G722 and G722.2 (AMR-N/AMR-WB) codecs, softcod does not fit.

Therefore, conversion using the commandline tool ffmpeg, as described in the rest of the article, is not needed any more to create G.722 announcement files. However ffmpeg might still be useful in some scenarios, e.g. when no internet access is available on customer site.

At the ffmpeg-builds site you will find different variants for your appropriate Windows OS version (tests have been done with "static" build).

Usage

After successful download and installation, the following commands can be used to convert any wav-files:

  • Step to the directory where you've installed ffmpeg, step down to the subdirectory bin.
  • The command line format is:
ffmpeg -i <inputfile>.wav -ar <sampling rate> -ab <bitrate> -acodec <codec> <outputfile>
  • Explanation:
    • <inputfile>  : location and filename of the standard wave file
    • <sampling rate>  : set the audio sampling frequency. For output streams it is set by default to the frequency of the corresponding input stream. Possible values would be 8000 / 16000
    • <codec>  : "g722" for G722, "libopencore_amrnb" for G722.2 AMR-NB, "libvo_amrwbenc" for G722.2 AMR-WB
    • <bitrate>  : set bitrate (in bits/s) depending on the used G722.2-codec
      • for G722.2 AMR-NB : 4.75k, 5.15k, 5.90k, 6.70k, 7.40k, 7.95k, 10.20k, 12.20k (default)
      • for G722.2 AMR-WB : 6.60k, 8.85k, 12.65k, 14.25k, 15.85k, 18.25k, 19.85k, 23.05k, 23.85k (default)
    • <outputfile>  : name and optional location of the resultfile

Examples

Conversion of a wav-sample into a g722-coded audio file (this is the only supported by innovaphone devices G722 codec at the moment)

ffmpeg -i /tmp/sample.wav -ar 16000 -acodec g722 /tmp/sample.g722

Conversion of a wav-sample into a g722.2 AMR-NB-coded audio file

ffmpeg -i /tmp/sample.wav -ar 8000 -ab 5.90k -acodec libopencore_amrnb /tmp/samplenb.amr

Conversion of a wav-sample into a g722.2 AMR-WB-coded audio file

ffmpeg -i /tmp/sample.wav -ar 16000 -ab 19.85k -acodec libvo_amrwbenc /tmp/samplewb.amr

Known Problems

When playing multiple G722 prompts in a row (e.g. in a VoiceMail script) an annoying ploping sound may appear at the beginning of each prompt. This is caused by the nature of the G722 codec - it can not reinitialize immediately, after the one prompts is ended and the next is started.

A workaround for this problem is to add 100 ms silence at the beginning of each WAV file, before encoding to G722.

You can do it using SoX on the command line with a following command:

sox input.wav output.wav pad 0.1 0


The filter pad 0.1 0 adds 0,1 seconds of silence to the beginning of the WAV file.

Related Information

ffmpeg supported audio codecs

Howto:Installing the voicemail/music on hold on a compact flash card

Howto:General information for compact flash cards

Howto:Convert wave files to G7xxx with softcode

File format