Well, I did finally get it working and will post my particular solution here with the hope it may help others. Oh, almost forgot. If you have a suggestion for change to this code, please do:
static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx, AVBitStreamFilterContext *bsfc){
int ret;
while(bsfc){
AVPacket new_pkt= *pkt;
int a= av_bitstream_filter_filter(bsfc, avctx, NULL,
&new_pkt.data, &new_pkt.size,
pkt->data, pkt->size,
pkt->flags & AV_PKT_FLAG_KEY);
if(a>0){
if (new_pkt.data != pkt->data)
{
av_free_packet(pkt);
pkt->data = new_pkt.data;
pkt->size = new_pkt.size;
pkt->destruct = av_destruct_packet;
}
new_pkt.destruct= av_destruct_packet;
} else if(a<0){
fprintf(stderr, "%s failed for stream %d, codec %s",
bsfc->filter->name, pkt->stream_index,
avctx->codec ? avctx->codec->name : "copy");
print_error("", a);
if (exit_on_error)
exit_program(1);
}
<b>
bsfc= bsfc->next;
}
ret= av_interleaved_write_frame(s, pkt);
av_free_packet(pkt);
av_bitstream_filter_close(bsfc);
if(ret < 0){
print_error("av_interleaved_write_frame()", ret);
exit_program(1);
}
}</pre>