[FFmpeg-devel] [PATCH] 5 of 5 Add Speex Encoding
Tue Jul 7 02:52:43 CEST 2009
On Mon, Jul 6, 2009 at 4:34 PM, Justin Ruggles <justin.ruggles at gmail.com>wrote:
> The samples I've seen don't use 11025, they use 0
> (FLV_SAMPLERATE_SPECIAL). Either way it is supposed to be ignored by
> Flash Player, so it might not matter.
I haven't seen those (the samples I have had the setting for 11025 in the
sample rate). Regardless, I agree FLV players should ignore whatever is set
here (per Adobe's spec).
> I also submitted a patch for this on 6/21.
> [PATCH] muxing speex in flv
> But I think it needs to be modified to enforce 2 frames-per-packet.
> That could be parsed from the extradata, which is currently not used
> because FLV doesn't write a speex header.
I suggest you don't enforce it. Decoders (like libspeexdec) should parse as
many frames as possible from the packet, without requiring a header, so they
don't need the header once they've been demuxed. FLV demuxers like FFmpeg's
don't attempt to parse the packet data because FLV is so brain dead and
hardcoded they don't need to. So enforcing the frames per packet seems only
necessary to warn folks trying to encode about bugs in programs that will
ultimately decode the output.
Speaking of those "programs that will ultimately decode the output", I just
ran through a series of tests with clean ffmpeg builds and the very latest
Flash 10 player from Adobe on Linux. I re-encoded a common test file Xuggler
uses into libspeex audio with varying frames per packet.
Here's what I found. Set the speex frames per packet all the way from 1 up
to 8, and it appears they all now work with Flash Player (I erroneously
reported that 1 would not work before, but at least with the latest version
that is not the case). Setting 9 frames per packet causes flash player to
start stuttering. Set 10 or more frames per packet causes flash player to
crash, bringing down the browser with it.
So my suggestion is:
1) set the default frames per packet in libspeexenc.c to 2, as Adobe does
(and my patch did).
2) in flvenc.c, either don't enforce the frames-per-packet (assume the user
knows what they are doing) or just warn people if is not between 1 and 8.
Hope that helps,
xu?ggle (z?' gl) v. To freely encode, decode, and experience audio and
Use Xuggle to get the power of FFmpeg in Java.
More information about the ffmpeg-devel