[FFmpeg-devel] Patch to libavc/opus to create extradata if missing

James Almer jamrial at gmail.com
Mon Dec 28 15:34:01 EET 2020


On 12/28/2020 6:53 AM, Andreas Rheinhardt wrote:
> Jonathan Baudanza:
>> This patch to libavcodec/opus.c will create the opus extradata if it is missing. This is required when muxing opus data from an RTP demuxer. Without this patch, the opux muxer will fail with a "No extradata present" error.

As Andreas said, decoders don't allocate extradata. The libavcodec user 
does.
Also, sounds like your patch would do nothing for builds with decoders 
disabled.

>>
>> This issue was first reported by Juan Navarro here: http://www.ffmpeg-archive.org/Unable-to-record-VP8-Opus-from-RTP-SDP-td4689046.html
>>
>> This patch was first created by Carl Eugen Hoyos, but didn't land because resulting opus files wouldn't play in VLC. The reason is because the opus headers in the original patch were too large. This patch update's Carl's original patch to limit the size of the extradata to 19 bytes.
>>         
> extradata is documented to be set/allocated by the user for decoders;
> yet you intend to allocate it for a decoder. This might leak if the user
> uses avcodec_close() (namely if the caller doesn't have any code to free
> the extradata, believing there would be none, because this field is
> documented not to be set by libavcodec when decoding). Maybe add Opus
> support to extract_extradata instead?

An extract_extradata implementation requires the extradata to be 
in-band, and that doesn't seem to be the case with Opus. No demuxer 
exports a packet with the OpusHeader. It's in CodecPrivate in 
Matroska/Webm, and in a header OggPacket in Ogg that's directly exported 
as extradata.

The RTP demuxer should start exporting extradata instead, if possible. 
Either generated from available stream information, or taken verbatim if 
present. Not sure how the RTP encapsulation for Opus is defined in this 
regard.

> 
> - Andreas
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> 



More information about the ffmpeg-devel mailing list