[GRASS5] Re: GRASS and configure

Bob,
(cc grass5)

since I am not super expert of configure, I take liberty
to post it here. Hopefully someone will help.

Markus

On Fri, Nov 18, 2005 at 12:44:52PM -0400, Bob Covill wrote:

Hi Markus,

I have mostly got the FFMPEG configure stuff working. The problem is
that ffmpeg consists of 3 libraries (avcodec, avutil and avformat). The
avcodec library is the one that I need and have set up for in configure.
Unfortunately, depending on the system avcodec requires avutil.

My question is; is it possible to spcify two libraries in the
LOC_CHECK_LIBS() so that the output (FFMPEGLIB in my case) is defined as
two libraries (i.e -lavcodec and -lavutil)? Or do I have to create
seperate variables for each library?

Thanks for your help.

--
Bob

I have mostly got the FFMPEG configure stuff working. The problem is
that ffmpeg consists of 3 libraries (avcodec, avutil and avformat). The
avcodec library is the one that I need and have set up for in configure.
Unfortunately, depending on the system avcodec requires avutil.

Let me guess; you're making the NVIZ animation feature generate video
files directly?

If so: while I can understand that it might be more convenient, there
are two problems.

1. It creates yet more reasons why NVIZ may fail to compile. NVIZ is
already the hardest part of GRASS to build due to Tcl/Tk and OpenGL
issues, and video encoding libraries are several orders of magnitude
more complex than either Tcl/Tk or OpenGL (and usually in a permanent
"beta" state).

2. The number of parameters which can control exactly how a sequence
of images is turned into an AVI (or similar) file is immense, and
varies from one build of ffmpeg to another. These kinds of issues are
arguably best left to a stand-alone encoder.

If you are planning on adding ffmpeg support to NVIZ, please make it
optional. Being able to compile ffmpeg shouldn't be a mandatory
prerequisite for compiling NVIZ.

My question is; is it possible to spcify two libraries in the
LOC_CHECK_LIBS() so that the output (FFMPEGLIB in my case) is defined as
two libraries (i.e -lavcodec and -lavutil)? Or do I have to create
seperate variables for each library?

You can specify that certain additional switches may be required by
passing them as the 9th and subsequent arguments, e.g.

LOC_CHECK_LIBS(avcodec,avcodec_init,AVcodec,$AVLIBPATH,AVCODECLIB,-lavutil)

This will try to find avcodec_init first with just:

  ... $AVLIBPATH -lavcodec

then with

  ... $AVLIBPATH -lavcodec -lavutil

If the first test passes, AVCODECLIB will be set to "-lavcodec"; if
the first fails but the second passes, it will be set to
"-lavcodec -lavutil".

--
Glynn Clements <glynn@gclements.plus.com>

Glynn,

Thanks for your help that did the trick.

Glynn Clements wrote:

I have mostly got the FFMPEG configure stuff working. The problem is that ffmpeg consists of 3 libraries (avcodec, avutil and avformat). The avcodec library is the one that I need and have set up for in configure. Unfortunately, depending on the system avcodec requires avutil.

Let me guess; you're making the NVIZ animation feature generate video
files directly?

Yes ... you guessed it. I have been sitting on the code for a while but have not properly incorporated it. I have added it as a space and time saving option. When creating animations with > 1000 frames you need a fair bit of disk space for the images. You only need a fraction of the space for the encoded video, and in the tests I have run it is much faster than rendering individual images.

If so: while I can understand that it might be more convenient, there
are two problems.

1. It creates yet more reasons why NVIZ may fail to compile. NVIZ is
already the hardest part of GRASS to build due to Tcl/Tk and OpenGL
issues, and video encoding libraries are several orders of magnitude
more complex than either Tcl/Tk or OpenGL (and usually in a permanent
"beta" state).

2. The number of parameters which can control exactly how a sequence
of images is turned into an AVI (or similar) file is immense, and
varies from one build of ffmpeg to another. These kinds of issues are
arguably best left to a stand-alone encoder.

Right now I have it set up to with the parameters hard coded to encode a simple MPEG1VIDEO. This does not have quite as many restrictions (such as aspect ratio, etc) as other video formats. Hopefully, if this takes off, user set encoding options and formats can be added.

If you are planning on adding ffmpeg support to NVIZ, please make it
optional. Being able to compile ffmpeg shouldn't be a mandatory
prerequisite for compiling NVIZ.

I definitely agree with this. I hate getting software that will not compile unless I get a bunch of other required packages. The default will be for FFMPEG support to be off. If the user wants to encode video directly they will have to get and install FFMPEG and set the GRASS configure option. NVIZ will function normally without ffmpeg (just no direct video encoding).

Thanks again for your help.

--
Bob

My question is; is it possible to spcify two libraries in the LOC_CHECK_LIBS() so that the output (FFMPEGLIB in my case) is defined as two libraries (i.e -lavcodec and -lavutil)? Or do I have to create seperate variables for each library?

You can specify that certain additional switches may be required by
passing them as the 9th and subsequent arguments, e.g.

LOC_CHECK_LIBS(avcodec,avcodec_init,AVcodec,$AVLIBPATH,AVCODECLIB,-lavutil)

This will try to find avcodec_init first with just:

  ... $AVLIBPATH -lavcodec

then with

  ... $AVLIBPATH -lavcodec -lavutil

If the first test passes, AVCODECLIB will be set to "-lavcodec"; if
the first fails but the second passes, it will be set to
"-lavcodec -lavutil".