LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-27-2005, 07:03 AM   #1
_UnPrEdictAbLe_
Member
 
Registered: Aug 2004
Location: Hyderabad, India
Distribution: Fedora Core 4
Posts: 183

Rep: Reputation: 30
Using ffmpeg (libavcodec and libavformat) libraries...


Hi,
I am working on some code which uses ffmpeg sourcecode. To compile it I use
Code:
g++ -g -O3 -Wall -g -I. -I./ -I./libavcodec -I./libavformat -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -o output_example.o output_example.cpp

g++ -Wl,--warn-common -rdynamic -g  -o output_example output_example.o -L./libavformat -lavformat -L./libavcodec -lavcodec -lm -lz -ldl robovision.o -ljpeg
I seriously do not know what it all means, but I am compiling my code(robovision.cpp,robovision.h and output_example.cpp) by putting it in the directory containing the sourcecode of ffmpeg-0.4.8. This means that inspite of my code being only 3 files, I have to mess up with a thousand more files...

The only place where ffmpeg is used is in output_example.cpp
Code:
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <math.h>
#include <string.h>
#include <time.h>
#ifndef M_PI
#define M_PI 3.1415926535897931
#endif

#include "libavformat/avformat.h"
#include "robovision.h"

/* 10 FPS */
#define STREAM_FRAME_RATE 10  
/*..... and so on.......*/
When I checked my system for ffmpeg.. it had ffmpeg-0.4.9-0.2.20050427.2.fc4 installed already. Can I do something to use the library installed in the system and thus reduce the mess in which I am. Please reply asap.

Regards,
Unpredictable.
 
Old 07-27-2005, 07:13 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
installing in the same directory as the FFMPEG source?? erm.. why?

you need to have the matching -devel rpm for any package against which you need to compile software. you won't need the source code. just install it, compile your software in a dedicated directory somewhere, and as long as you've installed the necessary packages and your include parameters for gcc are correct it will find the ffmpeg headers just fine.
 
Old 07-27-2005, 07:49 AM   #3
_UnPrEdictAbLe_
Member
 
Registered: Aug 2004
Location: Hyderabad, India
Distribution: Fedora Core 4
Posts: 183

Original Poster
Rep: Reputation: 30
Thumbs up

Thanks for the reply acid. I figured out that myself just now. I installed ffmpeg-devel.

And now I use these commands to compile...
g++ -g -O3 -Wall -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -o robovision.o robovision.cpp
g++ -g -O3 -Wall -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -o output_example.o output_example.cpp

g++ -Wl,--warn-common -rdynamic -g -o output_example output_example.o -lavformat -lavcodec -lavcodec -lm -lz -ldl robovision.o -ljpeg

and #include <ffmpeg/avformat.h> in the output_example.cpp file and it works just fine. I really don't know how to make a makefile. If you could make a makefile out of these random commands so that it compiles only when required and only the components which are changed, then please do it for me.

Regards,
Anurag.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
libavcodec and libavformat shared libraries ivorytower27 Linux - Newbie 3 10-16-2005 05:48 AM
How to instal the ffmpeg libraries jayhel Linux - Software 4 09-11-2005 11:54 PM
decoder and encoder with ffmpeg (libavcodec) sangijuela Programming 1 08-20-2005 07:53 AM
ffmpeg - libavcodec & libavformat james_vasant Programming 1 08-16-2005 12:43 PM
Libavformat.so? DeathPrawn Linux - Software 2 07-03-2005 03:13 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration