[FFmpeg-devel] [PATCH] avformat/matroskadec: force 48kHz sample rate when rescaling Opus inital padding
Michael Niedermayer
michael at niedermayer.cc
Mon Jun 6 22:24:21 CEST 2016
On Mon, Jun 06, 2016 at 04:13:51PM -0300, James Almer wrote:
> Mkvtoolnix stores the sample rate of the original stream as reported by the
> "OpusHead" stream header instead of 48kHz, the actual sample rate of the Opus
> stream.
> Ignoring the stored sample rate and forcing 48kHz preserves the correct initial
> padding when remuxing.
>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> OggOpus files created by opus-tools then remuxed into Matroska with mkvtoolnix
> results in files like the one mentioned above. See https://0x0.st/caG.mka or just
> use mkvtoolnix to remux fate-samples/ogg/intro-partial.opus
>
> Before this patch:
>
> $ mkvinfo caG.mka | grep delay
> | + Codec delay: 7.417ms (7416667ns)
>
> $ mkvinfo caG.mka | grep Sampling
> | + Sampling frequency: 44100
>
> $ ffmpeg -v 0 -i caG.mka -c:a copy before.webm
>
> $ mkvinfo before.webm | grep delay
> | + Codec delay: 6.812ms (6812500ns)
>
> $ mkvinfo before.webm | grep Sampling
> | + Sampling frequency: 48000
>
> Firefox can't play before.webm, but Opera (Chromium based) can.
>
> After this patch:
>
> $ ffmpeg -v 0 -i caG.mka -c:a copy after.webm
>
> $ mkvinfo after.webm | grep delay
> | + Codec delay: 7.417ms (7416667ns)
>
> $ mkvinfo after.webm | grep Sampling
> | + Sampling frequency: 48000
>
> Both Firefox and Opera play after.webm
>
>
> I'm adding a check for Opus since I don't know when or if some other codec will
> use the codec_delay element in the future. At least for now it seems to be Opus
> exclusive.
>
> libavformat/matroskadec.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
should be ok
maybe wait a day or so, so others can comment too
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160606/e1f34630/attachment.sig>
More information about the ffmpeg-devel
mailing list