rbash88 / pyffmpeg

Automatically exported from code.google.com/p/pyffmpeg
0 stars 0 forks source link

cannot import #16

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. install pyffmpeg
2. run script with 'import pyffmpeg'

What is the expected output? 
that it runs

What do you see instead?
ImportError: /usr/local/lib/python2.6/dist-packages/pyffmpeg.so: undefined
symbol: av_reduce

What version of the product are you using? 
latest svn

On what operating system?
Ubuntu 9.04
Python 2.6

Please provide any additional information below.

Original issue reported on code.google.com by in.incog...@gmail.com on 10 Jan 2010 at 1:07

GoogleCodeExporter commented 8 years ago
A) 
Which version are you using (b) ? ("stable" or "newversion_beta")

B)
I tried on one of my laptop running ubuntu 9.04, 
I did not have any problem compiling nor importing.

The source code does not contain any reference to the "av_reduce" function.
Thus, it seems more like your problem is due to a linking of incompatible 
versions of different libraries.

Please verify your are using latest FFMPEG, with latest SWSCALE.
Reinstall and retry.

If you still have problems 
For confirmation, that there is no hidden reference in macros or anything 
similar,
can you do so :

I am assuming you are using default ake "stable" :

cd stable
python setup.py build_ext 
nm build/*/pyffmpeg.o
ldd build/*/pyffmpeg.so

and please send me the output for reference 

Original comment by bertrand...@gmail.com on 10 Jan 2010 at 4:47

GoogleCodeExporter commented 8 years ago

Original comment by bertrand...@gmail.com on 10 Jan 2010 at 4:47

GoogleCodeExporter commented 8 years ago
I'm using newversion_beta.

It seemed to compile and install fine, but I'm not using the apt packages for my
ubuntu distro. Ffmpeg and the libraries were manually compiled from the latest 
svn.

Original comment by in.incog...@gmail.com on 10 Jan 2010 at 5:28

GoogleCodeExporter commented 8 years ago
Please send me the outputs of "nm" and "ldd" on your system.

cd newversion_beta
python setup.py build_ext 
echo "NM OUTPUT:"
nm build/*/*.o | grep av_reduce
echo "LDD OUTPUT :"
ldd build/*/pyffmpeg.so

It should help a lot to understand what's going on.
But again it seems like linking of incompatible 
versions of libraries.

I know some part of the fraction related API has been deprecated in FFMPEG,
av_reduce is probably such function, and thus is not in your latest svn release.
The question is which file is actually asking for "av_reduce".

It may be caused by : (1) another library (then ldd will help us to know), (2) 
by
some inline function, in an include file, then nm will help us to know.

Original comment by bertrand...@gmail.com on 10 Jan 2010 at 6:58

GoogleCodeExporter commented 8 years ago
for: ldd build/*/pyffmpeg.so

linux-gate.so.1 =>  (0xffffe000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7524000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb73c1000)
/lib/ld-linux.so.2 (0xb7fc0000)

for:  nm build/*/*.o | grep av_reduce

there is no output. Doesn't matter if i run build or build_ext

Original comment by in.incog...@gmail.com on 10 Jan 2010 at 6:47

GoogleCodeExporter commented 8 years ago
right now my ffmpeg is compiled with shared libraries off, should they be on?

Original comment by in.incog...@gmail.com on 10 Jan 2010 at 6:48

GoogleCodeExporter commented 8 years ago
The shared libraries are not required as long as your pyffmpeg managed to be 
build
correctly.
However, the resulting pyffmpeg may be a bit large, and I believe I would prefer
shared libraries,
but this kind of choices depends mainly on your needs.

The fact you don't have any reference in the ".o" files to "av_reduce" proves 
that is
not the 
compiled code of pyffmpeg that is requesting for "av_reduce", it is an external
library that
is bundled to "pyffmpeg.so" during its linking

The most likely hypothesis is that you have multiple versions of FFMPEG, on 
your system
and that we are using half of the library of one version and half libraries of 
the
other version :

Check where are the possible files by using locate :

locate libavformat. libavcodec. libswscale. libavutil.

If you have only one library for each of them, try applying nm on the static 
library
file 

nm libavcodec.a | grep av_reduce                                     #< for 
instance
nm libavutil.a | grep av_reduce                                      #< for 
instance
nm libavformat.a | grep av_reduce                                      #< for 
instance
nm libswscale.a | grep av_reduce                                     #< for 
instance

However, in order to see them in the LDD, it is required.
For info, here is the LDD output on my home computer :
        linux-gate.so.1 =>  (0xb7f8f000)
        libavformat.so.1d => /usr/lib/libavformat.so.1d (0xb7e9b000)
        libavcodec.so.1d => /usr/lib/libavcodec.so.1d (0xb79c0000)
        libswscale.so.1d => /usr/lib/libswscale.so.1d (0xb797f000)
        libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7967000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7818000)
        libavutil.so.1d => /usr/lib/libavutil.so.1d (0xb780e000)
        libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb77e9000)
        libz.so.1 => /usr/lib/libz.so.1 (0xb77d4000)
        libogg.so.0 => /usr/lib/libogg.so.0 (0xb77ce000)
        libdc1394_control.so.13 => /usr/lib/libdc1394_control.so.13 (0xb77bf000)
        liba52-0.7.4.so => /usr/lib/liba52-0.7.4.so (0xb77b4000)
        libgsm.so.1 => /usr/lib/libgsm.so.1 (0xb77a7000)
        libmp3lame.so.0 => /usr/lib/libmp3lame.so.0 (0xb7712000)
        libtheora.so.0 => /usr/lib/libtheora.so.0 (0xb76ca000)
        libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0xb76a2000)
        libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0xb75a9000)
        libxvidcore.so.4 => /usr/lib/libxvidcore.so.4 (0xb7491000)
        libx264.so.57 => /usr/lib/libx264.so.57 (0xb7406000)
        libfaac.so.0 => /usr/lib/libfaac.so.0 (0xb73f5000)
        /lib/ld-linux.so.2 (0xb7f90000)
        libraw1394.so.8 => /usr/lib/libraw1394.so.8 (0xb73ee000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0xb7307000)
        libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0xb7305000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb72ed000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb72e9000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0xb72e5000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb72e0000)

Original comment by bertrand...@gmail.com on 10 Jan 2010 at 7:18

GoogleCodeExporter commented 8 years ago
Note also that an other hypothesis is that you may have an old version of 
pyffmpeg on
your system, 
that would imported before the new module.

locate pyffmpeg.so

You may check which file is imported by running python -v

Original comment by bertrand...@gmail.com on 10 Jan 2010 at 7:23

GoogleCodeExporter commented 8 years ago
I checked for multiple versions of pyffmpeg.so and ffmpeg and there's only one 
copy
of both. When I do a python -v, python is doing a dlopen on the only copy of
pyffmpeg.so. 

I also did nm on 
pyffmpeg.so(/usr/local/lib/python2.6/dist-packages/pyffmpeg.so) that
is being called by python and it gave me 1 reference to av_reduce. 

I did a nm on the 4 libraries:

nm libavcodec.a | grep av_reduce
 returned 4 references

nm libavutil.a | grep av_reduce
 returned 1 reference

nm libavformat.a | grep av_reduce
 returned 11 references

Original comment by in.incog...@gmail.com on 10 Jan 2010 at 7:37

GoogleCodeExporter commented 8 years ago
Ok this is very weird but the problem went away by itself. I have no idea how 
or why
but now it imports fine. I did a rebuild/reinstall which is the only thing i can
think off that I did today, but the thing is I installed pyffmpeg multiple times
yesterday.

Original comment by in.incog...@gmail.com on 10 Jan 2010 at 7:40

GoogleCodeExporter commented 8 years ago
Ok i found out something.

I have the svn copy in /tmp/pyffmpeg

If i run python, and "import pyffmpeg" from the current directory of 
"/tmp/pyffmpeg"
the av_reduce error shows up.

If i do it anywhere else like /, /tmp, ~ the av_reduce error goes away.

Original comment by in.incog...@gmail.com on 10 Jan 2010 at 7:55

GoogleCodeExporter commented 8 years ago
Well, happy to know, we have an explanation.

--- 

If you have a directory "pyffmpeg" containing an "__init__.py"
a file pyffmpeg.py or "pyffmpeg.so" in your current directories,
these one will become more prioritary than your file.

---

Regarding the reference to av_reduce in your ffmpeg files, 
this proves that the av_reduce functions seems to be actually still implemented 
and used.

Original comment by bertrand...@gmail.com on 11 Jan 2010 at 1:43

GoogleCodeExporter commented 8 years ago

Original comment by bertrand...@gmail.com on 11 Jan 2010 at 1:45

GoogleCodeExporter commented 8 years ago

Original comment by bertrand...@gmail.com on 11 Jan 2010 at 3:18

GoogleCodeExporter commented 8 years ago
I would like to have the output the details of your nm commands on your ffmpeg
libraries :
i.e. what where the "references" in :

# nm libavcodec.a | grep av_reduce
#   returned 4 references
#                                    
# nm libavutil.a | grep av_reduce
#   returned 1 reference
#
# nm libavformat.a | grep av_reduce
#   returned 11 references

Original comment by bertrand...@gmail.com on 11 Jan 2010 at 5:55

GoogleCodeExporter commented 8 years ago
Well those are the number of av_reduce references.

Do you want me to post the entire nm output?

Original comment by in.incog...@gmail.com on 11 Jan 2010 at 3:05

GoogleCodeExporter commented 8 years ago
Ok thanks :
I have checked your issue the "avutil" lib was missing in the setup.py

I wanted do check have something like this :
[tranx@xxxx lib]$ nm libavcodec.a | grep av_reduce
                 U av_reduce
                 U av_reduce
                 U av_reduce
                 U av_reduce
[tranx@xxxx lib]$ nm libavutil.a | grep av_reduce
00000000000000e0 T av_reduce
[tranx@xxxx lib]$  nm libavformat.a | grep av_reduce
                 U av_reduce
                 U av_reduce
                 U av_reduce
                 U av_reduce
                 U av_reduce
                 U av_reduce
                 U av_reduce
                 U av_reduce
                 U av_reduce
                 U av_reduce
                 U av_reduce

The only thing that was important to me was
[tranx@xxxx lib]$ nm libavutil.a | grep av_reduce
00000000000000e0 T av_reduce

Which proves that you have effectively a function "av_reduce" implemented 
somewhere
in your computer in the libavutil library.

I was thinking that the avutil library was inside of the setup.py 
while it was not. This explains why you had this problem. 
In the dynamic library version, the other library where including the necessary
libraries for us.

This error means that you may need to include other static libraries.
If so please let me know so that we can update the setup.py of the project 
accordingly.
"                 U av_reduce" lines
then it means you have no "av_reduce" implementation on your system and then
something is wrong with your FFMPEG compilation.

Original comment by bertrand...@gmail.com on 12 Jan 2010 at 7:44