[FFmpeg-devel] question for ff_extract_extradata_bsf

James Almer jamrial at gmail.com
Wed Mar 6 21:10:57 EET 2019


On 3/6/2019 4:04 PM, Yufei He wrote:
> Hi
> 
> I want to use   ff_extract_extradata_bsf to get extradata from a h.264 frame.
> 
> Here is the code.
> 
> AVPacket *avpkt; // there is valid data.
> AVBSFContext *ctx = NULL;
> ret = av_bsf_alloc(&ff_extract_extradata_bsf, &ctx);
> ret = ff_extract_extradata_bsf.init(ctx);
> ret = ff_extract_extradata_bsf.filter(ctx, avpkt);
> 
> ff_extract_extradata_bsf.filter failed on calling ff_bsf_get_packet_ref because  ctx->internal->buffer+pkt->data is NULL.
> 
> int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
> {
> AVBSFInternal *in = ctx->internal;
> if (in->eof)
> return AVERROR_EOF;
> if (!ctx->internal->buffer_pkt->data &&
> !ctx->internal->buffer_pkt->side_data_elems)
> return AVERROR(EAGAIN);
> 
> How should ctx->internal->buffer+pkt->data be set?
> 
> Thanks.
> 
> Yufei.

You're not using the bsf API correctly. You're accessing internal
callbacks like init() and filter() directly. Use the public functions
defined in avcodec.h, and look at usage examples like in ffmpeg.c if needed.

Also, any further questions or emails about this should go to the
libav-user list at https://lists.ffmpeg.org/mailman/listinfo/libav-user/
This list is for actual ffmpeg development, not for usage questions.


More information about the ffmpeg-devel mailing list