Menu

#430 Fix 3/1 playback, add WAVEFORMATEXTENSIBLE channel mask tag support to the format specification

1.3.0
open
nobody
None
5
2016-02-27
2015-07-05
MBK
No

Please add WAVEFORMATEXTENSIBLE channel mask tag support to the format specification.

This is supported since FLAC 1.1.3 (27-Nov-2006) changelog, but missing from the format specification.

The result is that most players (all commercial players, all ffmpeg based players, VLC,...) won't play back FLAC with channels like 3/1 properly. They play them back as 2/2 when the FLAC contains the correct WAVE_FORMAT_EXTENSIBLE tag for 3/1.

Tested with DTS-HDMA 3/1 converted to FLAC. eac3to writes the correct tag. FFMPEG (tested 2.7) writes the correct tag, but outputs an error "Channel layout not supported by Flac, output stream will have incorrect channel layout".

LAV filters and MPC-HC seem to be the only players playing this back correctly.

This should be added to the spec (this way everyone knows about it), so that other players won't have this bug in the future. Especially since it is supported by FLAC since FLAC 1.1.3 (27-Nov-2006).

Most payers haven't supported this supported feature for the past 9 years, because they don't know about it as it is missing from the format spec. I think it's really time to add this to the format spec.

Layouts other than 3/1 may be affected as well.

(you could also add the 3.1 channel layout as you did with the 6.1 channel layout in FLAC 1.3 to fix the problem with 3/1 channels, as you did with 6/1).

Thanks.

Discussion

  • lvqcl

    lvqcl - 2015-07-05

    you could also add the 3.1 channel layout as you did with the 6.1 channel layout in FLAC 1.3 to fix the problem with 3/1 channels, as you did with 6/1

    Not possible. Without WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag there's only one 4-ch layout, and it is "front left, front right, back left, back right". See http://xiph.org/flac/format.html#frame_header

    (well, in theory it's possible to use reserved values for channel assignment, but it's a very bad idea IMO)

     

    Last edit: lvqcl 2015-07-05
    • MBK

      MBK - 2015-07-06

      Ok, then please add the WAVEFORMATEXTENSIBLE channel mask tag support to the format specification.

      It's been a FLAC feature since FLAC 1.1.3 in 2006 but currently 9 years later the 3/1 FLAC files created by ffmpeg and eac3to (which support this tag) don't play back properly with most players because they don't know it exists (they play it as 2/2 which is the only 4 ch layout in the spec).

      More info : my use case is conversion of DTS-HDMA 3/1 bluray source to FLAC 3/1 (for bluray backups). eac3to and ffmpeg create a correct 3/1 FLAC with the tags, correctly detected as Channel positions : Front: L C R, Back: C in mediainfo and played correctly with LAV and MPC-HC which the dev said he went out of his way to support this tag, but other players only play it as 2/2.

      Thanks.

       
  • MBK

    MBK - 2015-07-06

    For those who don't know what this is about:

    The tag is WAVEFORMATEXTENSIBLE_CHANNEL_MASK, which contains a hexadecimal value which corresponds to the speaker positions listed here:

    ​https://msdn.microsoft.com/en-us/library/windows/desktop/dd757714(v=vs.85).aspx

    It's contained within the FLAC headers as a vorbis comment, but Matroska just shoves all the FLAC headers into Codec Private Data so you'll find it there too.

    MakeMKV adds the tag to every FLAC encode it produces, but EAC3To and FFMPEG only add it if the layout doesn't match the defaults. The official FLAC encoders/decoders support the tag as well, as does LAV.

    FLAC 1.1.3 (27-Nov-2006) changelog:

    Encoder can now take WAVEFORMATEXTENSIBLE WAVE files as input; decoder will output WAVEFORMATEXTENSIBLE WAVE files when necessary to conform to the latest Microsoft specifications. Now properly supports AIFF and WAVEFORMATEXTENSIBLE multichannel input, performing necessary channel reordering both for encoding and decoding.

    WAVEFORMATEXTENSIBLE channel mask is also saved to a tag on encoding and restored on decoding for situations when there is no natural mapping to FLAC channel assignments.

     

    Last edit: MBK 2015-07-06
  • MBK

    MBK - 2015-07-06

    If this is added to the format spec all the players will support it in the future and FLAC can finally 100% replace codecs like DTS-HDMA.

    Thanks.

     
  • ndjamena

    ndjamena - 2015-07-08

    https://trac.videolan.org/vlc/ticket/15005

    [quote: jb, president of videolan]

    This is a very bad idea, tbh. This is not defined in the specification of FLAC.

    Anyway...

    [I believe the point of this ticket is, maybe it should be.]

     
  • lvqcl

    lvqcl - 2015-07-09

    I believe that files that need WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag are non-streamable (non-Subset) because a decoder cannot obtain channel mapping just from frame headers.

    It definitely should be mentioned too.

     
  • ndjamena

    ndjamena - 2015-07-09

    All tags are ineffective when streamed. It's up to the device/process with direct access to the file to determine how to communicate the associated metadata to clients when sending the Vorbis Comment headers directly isn't an option.

    The WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag isn't official at this point and there's no other way to even hint that the channel layout may differ from the limited set defined in the specs (ie the defaults). It makes things difficult, being "lossless" FLAC should be able to imitate the original source files as closely as possible and this is the best method available at the moment.

     
  • Andrew

    Andrew - 2016-02-27

    So, what is official response? Support for WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag is not going to be added to specification?

     

Log in to post a comment.