[FFmpeg-trac] #5727(avfilter:new): HDCD should not apply gain unless the values match in both channels
FFmpeg
trac at avcodec.org
Wed Jul 20 18:38:27 EEST 2016
#5727: HDCD should not apply gain unless the values match in both channels
----------------------------------+--------------------------------------
Reporter: bp0 | Type: defect
Status: new | Priority: normal
Component: avfilter | Version: git-master
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
----------------------------------+--------------------------------------
The HDCD filter should not apply gain to a channel unless both channels
have a matching target gain decoded from a valid packet.
Using the attached sample with ffmpeg 3.1+
{{{
% ffmpeg -i ava16.flac -af hdcd ava24.flac
}}}
The sample is from The Avalanches - [2000] Since I Left You, about 17m40s
from the beginning of the CD. This is not an HDCD encoded sample, but by
coincidence has a sequence that is a valid HDCD packet in one channel.
That channel will drop 6dB for 10 seconds after passing through the
filter, when it should not.
From [http://www.goodwinshighend.com/music/hdcd/aes_paper.pdf a paper by
Kieth Johnson], the designer of the original HDCD encoder chip:
The arrival of a valid packet for a channel resets a code detect timer
for that channel. If both channels have active timers, then code is deemed
to be present and the filter select data is considered valid immediately.
However, any command data which would effect the level of the signal must
match between the two channels in order to take effect. The primary reason
for this is to handle the case where an error on one channel destroys the
code. In such a case, the decoder will mistrack for a short time until the
next command comes along, which is much less audible than a change in gain
on only one channel, causing a shift in balance and lateral image
movement. If either of the code detect timers times out, then code is
deemed not to be present, and all commands are canceled, returning the
decode system to its default state. If the conditions on the encoder side
are not changing, then command packets are inserted on a regular basis to
keep the code detect timers in the decoder active and to update the
decoder if one starts playing a selection in the middle of a continuous
recording.
The HDCD filter in ffmpeg, and the fb2k plugin that it is based on, decode
HDCD in each channel separately. The code detect timer is implemented,
which is why the error only lasts for 10 seconds. Decoding the channels
separately, however, prevents it from knowing the gain value for the other
channel, and this would have to be changed to fix this bug.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/5727>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list