[Ffmpeg-devel] Using avcodec.dll and avformat.dll means that output_example.c would not work?

Lars Blumberg Lars.Blumberg
Sat Nov 26 20:08:33 CET 2005

Hello newsgroup!

I am using ffmpeg functionality via the libraries "avcodec.dll" and 
"avformat.dll", which  i have built before. To examine how to use both DLLs 
(in Delphi) I am translating the example code "output_example.c" given with 
the ffmpeg distribution.

The first code which is run is "av_register_all" to register all necessary 
things. When I have a look into the implementation of this method, I see 
that "avcodec_register_all" is called there at first.

But as you know, both methods are in different DLLs. That means, that 
"av_register_all" cannot call "avcodec_register_all". When I only call the 
first function I cannot use any codec. That's why I have to call 
"avcodec_register_all" by myself after calling "av_register_all".


int main(int argc, char **argv)
    const char *filename;
    AVOutputFormat *fmt;
    AVFormatContext *oc;
    AVStream *audio_st, *video_st;
    double audio_pts, video_pts;
    int i;

    /* initialize libavcodec, and register all codecs and formats */

    if (argc != 2) {
        printf("usage: %s output_file\n"
               "API example program to output a media file with 
               "The output format is automatically guessed according to the 
file extension.\n"
               "Raw images can also be output by using '%%d' in the 
               "\n", argv[0]);

My Delphi variant:
(Don't worry about the data type names, I introduces them to have likely c++ 

function main(filename: PChar): T_int;
  fmt: PAVOutputFormat;
  oc: PAVFormatContext;
  audio_st, video_st: PAVStream;
  audio_pts, video_pts: T_double;
  i: T_int;
// initialize libavcodec, and register all codecs and formats

I now have the fears, that are any problems, too, when using both DLLs. 
Because any code assumes, that other code can be called which isn't located 
in the same library.

Is that right or is that the only thing where I have to be careful. Thanks 
for everyone who gives help!

Best regards


More information about the ffmpeg-devel mailing list