Skip to content

A fix release for the GStreamer and mpv transcoders

Latest

Choose a tag to compare

@yartat yartat released this 26 Sep 20:41

MediaToolkit.NET 0.3.1

A fix release for the GStreamer and mpv transcoders. Both could accept an audio
request, report success, and write something other than what was asked: a
different channel count, rate or duration. Everything a request says now either
reaches the file or is reported, as an error before anything is written or as a
warning in TranscodeResult.Warnings.

The defects were found by generating the MP-MediaInfo test corpus — 220 Matroska
audio files over eleven formats — through each backend in turn and reading every
file back with the FFmpeg prober. The FFmpeg transcoder made all 220 as asked
before and after. The others:

Backend 0.3.0 0.3.1 What is still not made
GStreamer 121 193 19 TrueHD, refused; 8 AAC VBR, warned
mpv 86 175 19 TrueHD, refused; 26 PCM, warned

No public API changed.

Fixed

GStreamer

  • Channel layouts past 5.1 were refused or wrong. ChannelMask holds
    FFmpeg's speaker bits and was passed to GStreamer's channel-mask unchanged,
    but the two number the speakers differently from the side pair on (FFmpeg's
    side left is bit 9, GStreamer's is 10). 7.1 and the side layouts DTS needs
    failed to link. The mask is now translated, and a speaker GStreamer has no
    position for is an error.
  • DTS and RealAudio had no encoder. They now use avenc_dca (with
    strict=experimental, as libavcodec requires) and avenc_real_144.
  • 24-bit PCM had no path. PcmS24 is now written raw as S24LE.
  • 24-bit FLAC was refused. SampleFormat.S32 is how libavcodec carries
    24-bit FLAC; for flacenc it now becomes S24_32LE, the format that element
    takes.
  • A planar sample format was refused by every encoder. libav's elements and
    matroskamux take interleaved audio only, so a planar request now pins the
    sample width alone.
  • MP3 came out at half the rate asked for. At low bit rates lamemp3enc
    resamples unless the rate downstream is fixed (48 kHz at 64 kbit/s became
    24 kHz); the rate is now pinned after the encoder.
  • MP2 failed at valid bit rates. twolamemp2enc refuses combinations such
    as 320 kbit/s mono that libavcodec accepts; avenc_mp2 is now preferred.
  • TrueHD is refused with the reason. avenc_truehd exists, but no GStreamer
    muxer takes its output; Validate now says so instead of the pipeline
    failing to link.

mpv

  • Channels, rate and sample format were ignored. mpv's encoder follows its
    audio output, which keeps the input's layout and rate; asked for six channels
    it wrote the input's two and reported success. The request now reaches
    --audio-channels (as a speaker list), --audio-samplerate and
    --audio-format.
  • TrueHD and MLP in Matroska are refused. mpv stamps their frames a
    millisecond apart where each lasts 1/1200 s, so the file ran 20% long.
  • PCM output carries a warning. mpv writes uncompressed audio in blocks of
    16384 samples and pads the last one with silence, so the file runs up to that
    much past the end of the input or the trim.
  • The output check could not read RealAudio. mpv's Matroska demuxer does not
    know A_REAL/14_4; the check now uses the FFmpeg prober when FFmpeg is
    available.

Known limitations added

  • GStreamer: AAC at a variable quality is not mapped. gst-libav does not expose
    libavcodec's qscale flag, so the setting is ignored with a warning; use a
    bit rate or the FFmpeg backend.
  • GStreamer cannot write TrueHD; mpv cannot write it in Matroska. Use FFmpeg.