[alsa-devel] wrong channel mapping in a52 plugin

Tom Yan tom.ty89 at gmail.com
Fri Jan 8 19:59:42 CET 2016


I am using alsa-lib/alsa-utils/alsa-plugins 1.1.0 and ffmpeg 2.8.4 and
in Arch Linux.

So I ran `speaker-test -D wav -c 6 -l 1` with the following .asoundrc:

pcm.file {
    type file
    file st.ac3
}

pcm.a52 {
    type plug
    slave {
        pcm {
            type a52
            slavepcm file
        }
    }
}

pcm.wav {
    type file
    slave {
        pcm a52
    }
    file st.wav
    format wav
}

[tom at localhost ~]$ speaker-test -D wav -c 6 -l 1

speaker-test 1.1.0

Playback device is wav
Stream parameters are 48000Hz, S16_LE, 6 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 3072 to 206157312
Period size range from 1536 to 1536
Using max buffer size 206157312
Periods = 4
was set period_size = 1536
was set buffer_size = 206157312
 0 - Front Left
 2 - Front Center
 1 - Front Right
 5 - Rear Right
 4 - Rear Left
 3 - LFE
Time per period = 0.203625

Then, I encode "st.wav" manually with `ffmpeg -i st.wav ff.ac3`.

This shows a comparison between the wav file written directly from the
speaker-test directly (st.wav) and the ac3 file I encode with a manual
ffmpeg command (ff.ac3):
https://ptpb.pw/5XJR.png
As you can see, everything is preserved but the LFE is made LFE.

And this shows a comparision between the the ac3 file from ffmpeg and
the one written from the output of a52 plugin:
https://ptpb.pw/YaKg.png
If you compare carefully, you can see that Front Center and Rear Left
is swapped, LFE and Rear Right is also swapped.

Here is a pair of ac3 samples that shows the problem clearly (a lady
will be telling the channels one by one):
Original: https://ptpb.pw/9XdC.ac3
ALSA a52 plugin re-encoded from mpv output: https://ptpb.pw/SQ_7.ac3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5XJR.png
Type: image/png
Size: 95656 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20160109/852e2470/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: YaKg.png
Type: image/png
Size: 92346 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20160109/852e2470/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 9XdC.ac3
Type: audio/ac3
Size: 519680 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20160109/852e2470/attachment-0002.ac3>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SQ_7.ac3
Type: audio/ac3
Size: 1781760 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20160109/852e2470/attachment-0003.ac3>


More information about the Alsa-devel mailing list