Opened 5 years ago

Closed 5 years ago

#6596 closed enhancement (fixed)

Add a little-endian G726 encoder

Reported by: alban.meffre Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords: G726
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no


the G726 codec ffmpeg implementation seems not to comply with ITU standard
below are the files and commands needed to perform verification

* test vectors *

original test vectors from the ITU in ASCII format (

NRM.M : the test input vector encoded in mu law (sample rate 8kHz, mono)
RN24FM.I : the expected result , unpacked to right justified codes

input_mulaw.bin : binary version of the above NRM.M input file
input_mulaw.wav : playable version

$ ffmpeg -f mulaw -ar 8000 -i input_mulaw.bin -acodec copy input_mulaw.wav

* encoding with ITU compliant G726 encoder *

g726encode.exe : g726 encoder from the ITU-T user's group on software tools

output_g726.bin : output result

$ g726encode.exe -3 -u -i input_mulaw.bin -o output_g726.bin

* binary comparison between output and ITU test vector *

RN24FM.bin : bit packed binary version of the above RN24FM.I file

!!!!!! these two file's contents are identical -> g726encode.exe IS ITU compliant !!!!!!

* decode and listen to the result *

output_g726_decoded_pcm_s16le.bin : decoded result of g726encode.exe

$ g726decode.exe -3 -l -i output_g726.bin -o output_g726_decoded_pcm_s16le.bin

this file can be played correctely -> g726decode.exe IS ITU compliant too

$ ffplay -f s16le -ar 8000 output_g726_decoded_pcm_s16le.bin

* encoding with ffmpeg and listen to the result *

output_g726_ffmpeg.bin : ffmpeg g726 encode output result
output_g726_ffmpeg.wav : ffmpeg g726 encode output result (playable)

$ ffmpeg -f mulaw -ar 8000 -i input_mulaw.bin -acodec g726 -code_size 3 output_g726_ffmpeg.wav
$ ffmpeg -f mulaw -ar 8000 -i input_mulaw.bin -acodec g726 -code_size 3 -f u8 output_g726_ffmpeg.bin

output_g726_ffmpeg_decoded_pcm_s16le.bin : decoded result of output_g726_ffmpeg.bin

$ g726decode.exe -3 -l -i output_g726_ffmpeg.bin -o output_g726_ffmpeg_decoded_pcm_s16le.bin

!!!!!! this file cannot be played correctely -> ffmpeg's implementation of the g726 codec is not compliant with ITU !!!!!!

$ ffplay -f s16le -ar 8000 output_g726_ffmpeg_decoded_pcm_s16le.bin

Attachments (1)

bug (121.8 KB ) - added by alban.meffre 5 years ago.
archive containing all the test files

Download all attachments as: .zip

Change History (4)

by alban.meffre, 5 years ago

Attachment: bug added

archive containing all the test files

comment:1 by Carl Eugen Hoyos, 5 years ago

Keywords: ITU standard compliance removed
Priority: criticalnormal

comment:2 by Carl Eugen Hoyos, 5 years ago

Component: avformatavcodec
Priority: normalwish
Reproduced by developer: set
Status: newopen
Summary: G726 codec suspected to not comply with ITU standardAdd a little-endian G726 encoder
Type: defectenhancement

comment:3 by Carl Eugen Hoyos, 5 years ago

Resolution: fixed
Status: openclosed

FFmpeg has a little-endian ("right-justified") G.726 encoder since 898ea658c8a46a105bcf831691a9aad3bb0f606d, FFmpeg's G.726 implementation is not bit-exact though, see ticket #5482 for a sample with audible artefacts.

Note: See TracTickets for help on using tickets.