libavcodec / libavformat sample code

Coding, Linux — ryanfb @ 6:00 pm

Due to some changes in libavformat, the sample code at http://www.inb.uni-luebeck.de/~boehme/libavcodec_update.html no longer compiles correctly.

avcodec_sample.0.4.9.cpp: In function ‘int main(int, char**)’:
avcodec_sample.0.4.9.cpp:83: error: request for member ‘codec_type’ in 
    ‘pFormatCtx->AVFormatContext::streams[i]->AVStream::codec’, 
    which is of non-class type ‘AVCodecContext*’
avcodec_sample.0.4.9.cpp:92: error: cannot convert ‘AVCodecContext**’ 
    to ‘AVCodecContext*’ in assignment
avcodec_sample.0.4.9.cpp:105: error: ‘struct AVCodecContext’ has 
    no member named ‘frame_rate’
avcodec_sample.0.4.9.cpp:105: error: ‘struct AVCodecContext’ has 
    no member named ‘frame_rate_base’
avcodec_sample.0.4.9.cpp:106: error: ‘struct AVCodecContext’ has 
    no member named ‘frame_rate_base’

I’ve created a patch as well as a fixed example for the code. I’m not entirely sure about commenting out the frame rate correction hack, but those frame rate variables are no longer members of the AVCodecContext struct.

Also, for compiling under Debian, the recommended usage is not to change the include directives, but to use:

g++ `ffmpeg-config --cflags` -o filename filename.cpp 
    `ffmpeg-config --libs avformat --libs avcodec`

4 Comments »

  1. Thank you!

    After a lot of frustration not even getting the example code to work, i almost gave up on video-coding…. until i found you ;)

    Comment by Henrik — May 4, 2006 @ 10:55 am
  2. yes … your willingness to post this is the difference between me giving up my project in frustration and having the psych to continue … thanks very much, may you enjoy good karma

    Comment by Carty — June 28, 2006 @ 8:57 am
  3. hi..
    i am trying to compile fixed program avcodec sample program,
    i am using macosx, i changed the header files

    include “/usr/local/include/ffmpeg/avcodec.h”

    include “/usr/local/include/ffmpeg/avformat.h”

    i am getting the followin error

    /usr/local/include/ffmpeg/avformat.h:251: warning: ‘AVFrac’ is deprecated (declared at /usr/local/include/ffmpeg/avformat.h:102)
    /usr/bin/ld: Undefined symbols:
    _av_close_input_file
    _av_find_stream_info
    _av_free
    _av_open_input_file
    _av_read_frame
    _av_register_all
    _avcodec_alloc_frame
    _avcodec_close
    _avcodec_decode_video
    _avcodec_find_decoder
    _avcodec_open
    _avpicture_fill
    _avpicture_get_size
    _dump_format
    _img_convert
    collect2: ld returned 1 exit status

    what could be the error..
    thanks

    Comment by harsha — November 23, 2006 @ 3:18 pm
  4. it worked in debian machine,, thanks for the code. :)

    Comment by harsha — November 23, 2006 @ 11:16 pm

RSS feed for comments on this post. TrackBack URI

Leave a comment

(c) 2008 cryptosystem.org | powered by WordPress with Barecity