[FFmpeg-devel] [PATCH] speex in ogg muxer
Tue Jul 7 02:01:08 CEST 2009
Art Clarke wrote:
> On Sat, Jun 20, 2009 at 9:50 PM, Justin Ruggles <justin.ruggles at gmail.com>wrote:
>> This patch adds speex support to the ogg muxer. It basically does the
>> same thing as Ogg/FLAC, in that the 1st packet is a global header from
>> extradata and the 2nd packet is vorbiscomment metadata.
>> This seems to work just fine for speex-to-speex stream copy, but
>> probably would not work for flv-to-speex because flv doesn't to have any
>> speex extradata from what I can tell. I guess a header could be
>> constructed, but that would be a separate patch to the flv demuxer.
>> This patch is a precursor to libspeex encoding support, which I'll be
>> sending shortly.
> Hi Justin,
> A couple of comments:
> 1) Make sure you're setting the frames-per-packet field in the Speex header
> and your problems with speexdec and others should go away.
I don't think the problem is frames-per-packet. When ogg-to-ogg stream
copy is used, the speex header is copied exactly via the extradata. I
believe it is an ogg timestamp issue.
> 2) Let the encoder set extradata, and in your muxer if extradata is set for
> CODEC_ID_SPEEX, assume it's a speex packet.
That's what the patch does.
> 3) Although speex encoded frames don't end on a byte boundary, encoded
> packets should. See the bit-stream termination code I added in my speex
> encoding patch.
Right, and that means that a parser to separate speex frames would have
to break the rules of FFmpeg parsing by adding data (padding) to the
output packets. If bending the rule in this case is acceptable then
such a parser would be possible.
An alternative could be to parse the packet to set the correct duration
but not split it up into speex frames.
> 4) FLV (an undocumented requirement) needs 2 speex frames per packet, and
> needs the sample-rate flag in the FLV header to be set for 11025. See my
> patch for that.
I will change the FLV demuxer accordingly.
More information about the ffmpeg-devel