[FFmpeg-devel] Deterministic Noise Generation option for audio codecs that involve noise generation (RNG)
Jonathan Campbell
jonathan at castus.tv
Sat Sep 7 10:21:16 CEST 2013
I'm writing a program to provide "random access" decoding for various
file formats including those involving MP3 or AC-3 and I want to bring
up something that might help improve the FFMPEG ABI.
I found that I can provide sample-level random access for MP3 if, when
non-sequential access is needed, I just step back about 8-16 MP3 frames
(compensating for the bit reservoir and MDCT window) and decode up to
the one I need. The problem is AC-3 and it's noise coding. If I try the
same trick with AC-3, stepping back 2-3 frames so that the MDCT window
can build up, no matter how precisely I do it there are discontinuities
between the previous decode and the decode I started again from the same
bitstream.
I had written a hack for FFMPEG 1.0.1 where by setting a flag, if noise
bands are present, the codec seeds the RNG with a checksum of the AC-3
or AAC frame and then proceeds to decode as normal. Then, decoding the
same AC-3 frames always results in the same PCM output, and the same
trick I used with MP3 then works correctly. It can be set for programs
that want this behavior while existing code can leave it unset and
maintain existing decode behavior.
Open source video editing projects could benefit from that feature when
allowing the user to edit from formats and containers involving these
codecs.
If I rewrite that patch for FFMPEG 1.2.2 and FFMPEG 2.0, would any of
you be interested in incorporating it upstream?
On a related note, can anyone tell me if a similar hack can be made for
video codecs that use noise coding (are there any)?
-- Jonathan C.
More information about the ffmpeg-devel
mailing list