Page 1 of 2

FFmpeg library error

Posted: Mon Feb 18, 2013 12:34 am
by xxjack12xx
I am using
[email protected]:/home/jack # uname -a
FreeBSD upstairs.jack.com 9.1-STABLE FreeBSD 9.1-STABLE #0 r246217: Fri Feb 1 12:20:42 PST 2013 [email protected]:/usr/obj/usr/src/sys/UPSTAIRS amd64

and audacity will not load the ffmpeg libraries. When it tries to load, it gives me this error in the log:

16:27:53: Audacity 2.0.3
16:27:54: Trying to load FFmpeg libraries...
16:27:54: mLibAVFormatPath ('/usr/local/lib/libavformat.so.52.111.0') is not empty. Loading from it.
16:27:54: Checking for monolithic avformat from '/usr/local/lib/libavformat.so.52.111.0'.
16:27:54: avformat not monolithic
16:27:54: Loading avutil from '/usr/local/lib/libavutil.so.50'.
16:27:54: Error: Cannot open "/usr/local/lib/libavutil.so.50"
16:27:54: Loading avcodec from '/usr/local/lib/libavcodec.so.52'.
16:27:54: Error: Cannot open "/usr/local/lib/libavcodec.so.52"
16:27:54: Loading avformat from '/usr/local/lib/libavformat.so.52.111.0'.
16:27:54: Error: Unknown dynamic library error
16:27:54: Actual avutil path
16:27:54: Error: No shared object contains address
16:27:54: Actual avcodec path
16:27:54: Actual avformat path /usr/local/lib/libavformat.so.52.111.0
16:27:54: Importing symbols...
16:27:54: Error: Failed to load symbol av_init_packet
16:27:54: Trying to load FFmpeg libraries from system paths. File name is 'libavformat.so.52'.
16:27:54: Checking for monolithic avformat from 'libavformat.so.52'.
16:27:54: Error: Shared object "libavformat.so.52" not found, required by "audacity"
16:27:54: Loading avutil from 'libavutil.so.50'.
16:27:54: Error: Shared object "libavutil.so.50" not found, required by "audacity"
16:27:54: Loading avcodec from 'libavcodec.so.52'.
16:27:54: Error: Shared object "libavcodec.so.52" not found, required by "audacity"
16:27:54: Loading avformat from 'libavformat.so.52'.
16:27:54: Error: Shared object "libavformat.so.52" not found, required by "audacity"
16:27:54: Error: Failed to load FFmpeg libraries.
16:27:54: Error: Failed to find compatible FFmpeg libraries.

ffmpeg
ffmpeg version 0.7.13, Copyright (c) 2000-2011 the FFmpeg developers
built on Jan 30 2013 16:55:22 with gcc 4.2.1 20070831 patched [FreeBSD]
configuration: --enable-x11grab --prefix=/usr/local --mandir=/usr/local/man --enable-shared --enable-gpl --enable-postproc --enable-avfilter --enable-pthreads --enable-memalign-hack --enable-runtime-cpudetect --cc=cc --extra-cflags='-I/usr/local/include/vorbis -I/usr/local/include' --extra-ldflags='-L/usr/local/lib ' --extra-libs=-pthread --disable-debug --enable-libaacplus --disable-indev=alsa --disable-outdev=alsa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libcelt --enable-libdirac --enable-libfaac --enable-libfreetype --enable-frei0r --enable-libgsm --enable-libmp3lame --enable-libopencv --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-nonfree --enable-version3
libavutil 50. 43. 0 / 50. 43. 0
libavcodec 52.123. 0 / 52.123. 0
libavformat 52.111. 0 / 52.111. 0
libavdevice 52. 5. 0 / 52. 5. 0
libavfilter 1. 80. 0 / 1. 80. 0
libswscale 0. 14. 1 / 0. 14. 1
libpostproc 51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder

Any ideas on how/what causes this so I can get ffmpeg libraries to work on audacity for FreeBSD?

Re: FFmpeg library error

Posted: Mon Feb 18, 2013 1:41 am
by Gale Andrews
Are you compiling Audacity and FFmpeg yourself or using a package of Audacity supplied by someone else?

If you are using a package, try installing FFmpeg with the package management system which should I assume put it in usr/lib. If FFmpeg is already there in usr/lib, press "Locate" in the Libraries Preferences and point Audacity to that version.

If you only want to export files supported by FFmpeg (not import them), choose (external program) when you export and point Audacity to any version of FFmpeg that you like.


Gale

Re: FFmpeg library error

Posted: Mon Feb 18, 2013 4:18 pm
by xxjack12xx
I maintain the port on FreeBSD. I compiled ffmpeg from the port and it gives that error. It finds the libraries but can't load them because of

Error: Failed to load symbol av_init_packet

Re: FFmpeg library error

Posted: Tue Feb 19, 2013 5:34 am
by Gale Andrews
xxjack12xx wrote:I maintain the port on FreeBSD.
The port of FFmpeg, Audacity or both?
xxjack12xx wrote:I compiled ffmpeg from the port and it gives that error. It finds the libraries but can't load them because of

Error: Failed to load symbol av_init_packet
Did you compile Audacity or are you using the Audacity package?

"Failed to load symbol av_init_packet" is an error we used to get in FFmpeg versions greater than 0.5 when Audacity only supported up to 0.5. The "av_init_packet" function is now in the Audacity code so I don't know why you see that error if you have built Audacity correctly.

Note that in any case, FFmpeg dynamic library loading only has nominal support up to FFmpeg 0.8, and this has not been tested on FreeBSD because no-one here uses that OS.

For more on this, please see here http://forum.audacityteam.org/viewtopic ... 50&t=70986 .


Gale

Re: FFmpeg library error

Posted: Thu Feb 21, 2013 1:22 pm
by xxjack12xx
I port audacity on FreeBSD.

I compiled ffmpeg from ports and then tried to load the libs and got that error. Is there a way to build ffmpeg statically? It sounds like maybe the ffmpeg port in FreeBSD might not be compatible?

What causes the "av_init_packet" or how was it fixed? Maybe it just needs a patch for FreeBSD?

Re: FFmpeg library error

Posted: Thu Feb 21, 2013 11:31 pm
by Gale Andrews
xxjack12xx wrote:I port audacity on FreeBSD.
What does that mean exactly? Where do you get Audacity 2.0.3 from? What changes are you making to it?

If you are not compiling our source tarball then running unmodified ./configure, what happens if you do that?
xxjack12xx wrote:I compiled ffmpeg from ports and then tried to load the libs and got that error. Is there a way to build ffmpeg statically? It sounds like maybe the ffmpeg port in FreeBSD might not be compatible?
One would expect that error if you were compiling a pre-Audacity 2.x build of Audacity that did not support the "av_init_packet" function. Maybe there are other more complex reasons it could happen.

Yes you can build FFmpeg itself statically (--disable-shared) but it is not the recommended solution for loading FFmpeg from the Libraries preferences.
xxjack12xx wrote:how was it fixed?
Adding that function to the Audacity code.
xxjack12xx wrote:Maybe it just needs a patch for FreeBSD?
Maybe, but unless you are compiling the 2.0.3 tarball or HEAD without modification, we have no idea exactly what Audacity code you are compiling or how you are configuring it.

Are you specifying the local FFmpeg library when you configure Audacity? Cannot FFmpeg be installed on FreeBSD so that it is in usr/lib?



Gale

Re: FFmpeg library error

Posted: Fri Feb 22, 2013 12:49 am
by xxjack12xx
I maintain the port for audacity on FreeBSD. I grabbed the source from http://audacity.googlecode.com/files/au ... 0.3.tar.xz

I'm configuring with
./configure --with-lib-preference=local system --with-portaudio --enable-unicode --with-ffmpeg --with-libflac --with-libid3tag --with-jack --enable-ladspa --with-libmad --enable-nyquist --with-portmixer --with-libsamplerate --with-sbsms --with-sse --with-libtwolame --with-taglib --with-libvamp --with-libvorbis --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/ --build=amd64-portbld-freebsd9.1

The only changes made are

[email protected]:/usr/ports/audio/audacity/files # cat *
--- ./Makefile.in.orig 2013-01-18 19:50:47.000000000 +0400
+++ ./Makefile.in 2013-01-27 22:38:11.000000000 +0400
@@ -31,11 +31,6 @@
$(INSTALL) -d $(DESTDIR)$(BINDIR)
$(INSTALL) -m 755 audacity $(DESTDIR)$(BINDIR)/$(AUDACITY_NAME)

- # install docs
- $(INSTALL) -d $(DESTDIR)$(DOCDIR)/
- $(INSTALL) -m 644 README.txt $(DESTDIR)$(DOCDIR)/README.txt
- $(INSTALL) -m 644 LICENSE.txt $(DESTDIR)$(DOCDIR)/LICENSE.txt
-
# install manpage
$(INSTALL) -d $(DESTDIR)$(MANDIR)/man1
-test -f help/audacity.1.gz &&
--- lib-src/libnyquist/nyquist/cmt/cext.h 2009-07-15 20:27:36.000000000 -0700
+++ lib-src/libnyquist/nyquist/cmt/cext.h 2009-07-19 00:37:45.000000000 -0700

@@ -58,7 +58,7 @@
#include <malloc.h>
#endif

-#if NEED_ULONG
+#if NEED_ULONG || __FreeBSD__
typedef unsigned long ulong;
#endif

--- ./lib-src/libnyquist/nyquist/nyqstk/include/FileRead.h.orig 2011-05-04 17:18:48.000000000 +0200
+++ ./lib-src/libnyquist/nyquist/nyqstk/include/FileRead.h 2011-05-04 17:19:13.000000000 +0200
@@ -33,6 +33,7 @@
#define STK_FILEREAD_H

#include "Stk.h"
+#include <stdio.h>

namespace Nyq
{
--- lib-src/libnyquist/nyquist/xlisp/xlisp.h 2009-07-15 20:27:36.000000000 -0700
+++ lib-src/libnyquist/nyquist/xlisp/xlisp.h 2009-07-19 00:24:11.000000000 -0700
@@ -152,6 +152,15 @@
#endif
#endif

+/* FreeBSD */
+#ifdef __FreeBSD__
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define XL_LITTLE_ENDIAN
+#else
+#define XL_BIG_ENDIAN
+#endif
+#endif
+
/* Apple CC */
#ifdef __APPLE__
#define NNODES 2000

We can't install the libs to /usr/lib, everything installs to /usr/local/lib using ports.

Re: FFmpeg library error

Posted: Fri Feb 22, 2013 2:57 am
by Gale Andrews
What do these commands output?

Code: Select all

pkg-config --libs libavcodec

Code: Select all

ldd audacity | grep av
Have you had this trouble before with Audacity recognising FFmpeg?


Gale

Re: FFmpeg library error

Posted: Fri Feb 22, 2013 3:13 am
by xxjack12xx
[email protected]:/usr/ports # pkg-config --libs libavcodec
-L/usr/local/lib -lavcodec

[email protected]:/usr/local/bin # ldd audacity | grep av
[email protected]:/usr/local/bin #

This is the first time trying to get ffmpeg to work in audacity

Re: FFmpeg library error

Posted: Sat Feb 23, 2013 3:08 am
by Gale Andrews
So since the grep output is empty, Audacity isn't actually linking to FFmpeg when you compile it.

Perhaps you want to set AVCODEC_CFLAGS, AVCODEC_LIBS, AVFORMAT_CFLAGS, AVFORMAT_LIBS, AVUTIL_CFLAGS, and AVUTIL_LIBS via configure. Of course you may still come up against the same problem (whatever it is) when loading the libs, but at least if you get the linking right you would not have to browse for the libs in the Libraries Preferences.

This is probably the extent of my knowledge about this.



Gale