On 09/07/2010 10:51, Emyr James wrote:
Hi,
I couldn't find any basic tutorials or documentation about using this
library. If anyone has any links feel free to share.
I had a look at the api_example.c in the avcodec src dir and I also
ran doxygen against the headers in the include directories created
with a make install. Using this information I came up with the
following...
#include <iostream>
extern "C" {
#include <libavformat/avformat.h>
}
using namespace std;
int main(int argc, char **argv)
{
if (argc <= 1) {
cout << "usage audio_convert <fielname>\n" << endl;
}
// data structures
AVFormatContext *pFormatContext=new AVFormatContext;
AVInputFormat *pInputFormat=new AVInputFormat;
// open input file
av_open_input_file(&pFormatContext, argv[1], pInputFormat,0,0);
// dump the format
dump_format(pFormatContext,0,0,0);
return 0;
}
and compile it with
g++ -o audio_convert audio_convert.c -lavcodec -lavdevice -lavformat
-lavutil -lz
Here's what happens when I run it...
$ ./audio_convert music.mp3
Segmentation fault
What I need is a program that loads a media file (just audio file at
mo), detects it's format and codec, then saves the output as a low
quality ogg format. I will then want to be able to load in video files
and strip out any audio they contain and save that out as low quality
too.
Can anyone give suggestions on getting started here ?
Cheers,
Emyr
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
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;
// open input file
av_open_input_file(&pFormatContext, argv[1], NULL, 0, NULL);
// dump the format
dump_format(pFormatContext, 0, argv[1], false);
return 0;
}
with following compile line
g++ -o audio_convert audio_convert.c -lavcodec -lavdevice -lavformat
-lavutil -lz -lbz2
now on to the transcoding....
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user