On Fri, 2010-07-09 at 12:20 +0100, Emyr James wrote:
> Kindof solving my own problem here....
>
> This works ok...
>
> #include <iostream>
>
> extern "C" {
> #include <libavformat/avformat.h>
> #include <libavcodec/avcodec.h>
> }
>
> using namespace std;
>
> int main(int argc, char **argv)
> {
>
>
> if (argc <= 1) {
> cout << "usage audio_convert <fielname>\n" << endl;
> }
>
> // initialise libavformat /libavcodec
> av_register_all();
>
> // data structures
> AVFormatContext *pFormatContext=new AVFormatContext;Don't "new" C structs. You're leaking memory in this case, and deleting the pointer will cause a segfault. Just leave pFormatContext uninitialized - av_open_input_file() will set it for you (that's why you have to give it a pointer to a pointer). > > // open input file > av_open_input_file(&pFormatContext, argv[1], NULL, 0, NULL); > > // dump the format > dump_format(pFormatContext, 0, argv[1], false); > Don't forget to call av_close_input_file(). > return 0; > } > > with following compile line > > g++ -o audio_convert audio_convert.c -lavcodec -lavdevice -lavformat > -lavutil -lz -lbz2 > > now on to the transcoding.... Good luck :) Other good places to look are ffplay.c and ffmpeg.c. Especially ffmpeg.c will take a while to understand though.. /Tomas
signature.asc
Description: This is a digitally signed message part
_______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
