[FFmpeg-devel] bitstream filter? Looks like the wrong choice.

John Lange john
Thu Mar 26 02:40:08 CET 2009


Ok, I guess i'm just following up on my previous post where I asked if a
bitstream filter was really the right place to manipulate the "level"
setting embedded in the header of an h264 video...

I suspected it wasn't since it only appears in the header and the
filters apply to the raw-video _after_ the header.

To confirm this I implemented the following test (I wrote everything
passed to the filter in buf to a file as follows):


static int h264_level(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
                     uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe){

    if (avctx->codec_id != CODEC_ID_H264) {
        av_log(avctx, AV_LOG_ERROR, "h264level bitstream filter only applies to h264 codec\n");
        return 0;
    }

    *poutbuf_size = buf_size;
    *poutbuf = av_malloc(*poutbuf_size + FF_INPUT_BUFFER_PADDING_SIZE);
    memcpy(*poutbuf, buf, buf_size);

    FILE *fp;
    fp=fopen("/home/johnlange/tmp/test.bin", "ab");
    fwrite(buf, sizeof(buf[0]), buf_size, fp);
    fclose(fp);

    return 1;
}

and just to be clear, I invoked it thus:

./ffmpeg -i test.video -i test.audio -vcodec copy -vbsf h264_level -acodec libfaac -y test.mp4

As I suspected, the resulting test.bin file is missing the first 160
bytes (the header including "level" information) of the source
test.video file.

So having confirmed that a bitstream filter is not what I need, can
someone suggest where I should look next?

Thanks.
-- 
John Lange
http://www.johnlange.ca





More information about the ffmpeg-devel mailing list