Open GoogleCodeExporter opened 8 years ago
I've also posted it on stack overflow, if anyone is interested
http://stackoverflow.com/questions/7823082/problems-installing-pyffmpeg-on-mac-o
s-x
Original comment by alexsuse...@gmail.com
on 19 Oct 2011 at 3:08
It is probably related to the fact that the modern version of cython, you are
using...
I have to update the code. There are many recent posts related to this issue
__new__ should be replaced by __cinit__ everywhere in the code. I hope we'll
find time to provide a new version to everyone soon. I am working on it, but
unfortunately at very slow pace.
Original comment by bertrand...@gmail.com
on 19 Oct 2011 at 10:23
So, I've substituted __new__ for __cinit__ and change the signatures from cdef
to def, as this was giving me another error, and now I still get errors, but
I've looked at the included files in the c compiling and I couldn't find it, so
that might be the error, I've got ffmpegx installed and ffmpeg in macports, I'm
installing ffmpeg-devel to see if it helps. By the way, it would be great to
have a dependency listing somewhere, have I overlooked it?
thanks for the help!
Original comment by alexsuse...@gmail.com
on 20 Oct 2011 at 7:57
Ok, so I've narrowed it down to a problem with the __registered variable,
apparently the function py_av_register_all() is confusing what should be the
global variable __registered with a local variable which hasn't been assigned.
I've pasted the resulting code below. Is it maybe a problem with how you define
local and global variables in cython?
thanks again!
---
sampa:pyffmpeg-2.1beta alex$ sudo python setup.py install
running install
running build
running build_ext
cythoning pyffmpeg.pyx to pyffmpeg.c
warning: pyffmpeg.pyx:1904:49: Unreachable code
Error compiling Cython file:
------------------------------------------------------------
...
##################################################################
def py_av_register_all():
if __registered:
^
------------------------------------------------------------
pyffmpeg.pyx:705:19: local variable '__registered' referenced before assignment
building 'pyffmpeg' extension
C compiler: llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe
-fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE
-DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g
-fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64
-pipe
compile options: '-I/opt/ffmpeg/include -I/usr/include/ffmpeg -I./include
-I/Library/Python/2.7/site-packages/numpy-2.0.0.dev_e2af7b7_20110721-py2.7-macos
x-10.7-x86_64.egg/numpy/core/include
-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c'
llvm-gcc-4.2: pyffmpeg.c
pyffmpeg.c:1:2: error: #error Do not use this file, it is the result of a
failed Cython compilation.
pyffmpeg.c:1:2: error: #error Do not use this file, it is the result of a
failed Cython compilation.
lipo: can't open input file: /var/tmp//ccXZr5zV.out (No such file or directory)
pyffmpeg.c:1:2: error: #error Do not use this file, it is the result of a
failed Cython compilation.
pyffmpeg.c:1:2: error: #error Do not use this file, it is the result of a
failed Cython compilation.
lipo: can't open input file: /var/tmp//ccXZr5zV.out (No such file or directory)
error: Command "llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os
-pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE
-DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g
-fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64
-pipe -I/opt/ffmpeg/include -I/usr/include/ffmpeg -I./include
-I/Library/Python/2.7/site-packages/numpy-2.0.0.dev_e2af7b7_20110721-py2.7-macos
x-10.7-x86_64.egg/numpy/core/include
-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c
pyffmpeg.c -o build/temp.macosx-10.7-intel-2.7/pyffmpeg.o" failed with exit
status 1
Original comment by alexsuse...@gmail.com
on 20 Oct 2011 at 8:42
Well the fix should be just declare the variable before :
Well sorry to make you work
The fix should simply be, write before the def :
__registered=False
Thanks for your efforts.
BTW, you are right for the dependency list for each platform.
Most programmers now C-dependencies for compiling involve to have the
"devel"-package. But it would be nice to have clean instructions and automated
build on all platforms... A project... we have never been able to make concrete
so far.
Original comment by bertrand...@gmail.com
on 20 Oct 2011 at 9:11
Ok, so the problem is the __registered is defined beforehand in the code, which
just makes the whole thing spooky! I've moved the definition to before the
function definition so it actually shows in the error message:
--
...
cdef __registered
__registered = False
def py_av_register_all():
if __registered:
^
------------------------------------------------------------
pyffmpeg.pyx:703:19: local variable '__registered' referenced before assignment
I don't know why he's looking for a local variable...
I'm fine working on it a bit, as long as I don't take months to do it.
Original comment by alexsuse...@gmail.com
on 20 Oct 2011 at 9:26
Has anyone managed to fix this? I've ran into exactly the same thing on
FreeBSD. If no one fixed this I can have a look at it I just don't want to
reinvent the wheel
Original comment by c...@yornet.net
on 14 Nov 2011 at 4:31
Hi, I've managed to get around it, basically I did a find-replace of "cdef
__new__:" for "def __cinit:" and changed the line above to
def py_av_register_all():
global __registered
if __registered:
...
It did compile, but I still couldn't manage to get all the libraries linked, so
I'm not sure if it's 100% functional.
I'm not sure if I should upload the changes, any dev want to venture a comment?
Alex.
Original comment by alexsuse...@gmail.com
on 14 Nov 2011 at 4:36
I got it to compile on 10.7 for Python 2.7 (macports) with ffmpeg-devel
@20111104_0+nonfree (also macports).
Changes needed to pyffmpeg.pyx:
1) replace "cdef __new__" with "def __cinit__" as mentioned above
2) add global __registered as mentioned above
3) search/replace "CODEC_TYPE" with "AVMEDIA_TYPE" (I guess ffmpeg devs changed
this)
4) remove all references to "hurry_up" (ffmpeg devs say it's deprecated and
removed from ffmpeg)
5) search/replace "guess_format" with "av_guess_format" (otherwise import fails
with "no such symbol: _guess_format")
Also some path tweaking in setup.py was needed so it would recognize macports
includes.
With these changes the module can be imported into python without errors and
the interpreter recognizes module members... but it crashes after calling
FFMpegReader.open() on a file.
Not sure if #5 is legal... but Python complained it couldn't find guess_format
symbol and indeed there is no such symbol in libavcodec or libavformat but I
found the av_guess_format which sounds similar. Maybe these two are not
interchangeable and pyffmpeg needs a thorough refactoring.
Also not sure if #4 has other ramifications. Maybe it needs to be replaced with
something else.
Obviously pyffmpeg needs to be updated to use the latest ffmpeg source before
it can be compiled.
This is my first experience with cython and ffmpeg so maybe these changes don't
make any sense... but at least I got it to compile and import into python.
I'll post a patch if I get it all to work properly.
Original comment by vvrb...@gmail.com
on 17 Nov 2011 at 1:55
I got as far as you did. Thanks for the work! It doesn't crash for me though. I
was obviously missing the ffmpeg-devel library and was linking with the wrong
path in the setup.py. I'll fiddle around a bit more, let you know if I stumble
onte something.
Best.
Alex.
Original comment by alexsuse...@gmail.com
on 17 Nov 2011 at 8:16
Hey,
I tried the above fix and managed to complete the python setup.py install. But
when I import i get:
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/pyffmpeg.so, 2):
Symbol not found: _av_close_input_file
Referenced from: /usr/local/lib/python2.7/site-packages/pyffmpeg.so
Expected in: dynamic lookup
Any ideas?
For reference I'm on Os 10.6 and python 2.7.2
Regards,
Graham
Original comment by gr.ed.bo...@gmail.com
on 29 Nov 2011 at 7:17
Just ran into this issue myself, Mac OS X 10.7.2 (Lion), Xcode 4.2, using
pyffmpeg-2.1beta,
$ python setup.py build
...
pyffmpeg.pyx:808:4: __new__ method of extension type will change semantics in a
future version of Pyrex and Cython. Use __cinit__ instead.
...
Have the changes described above been applied to the repository yet? I've had a
look at the SVN, but can't see any recent changes on
http://code.google.com/p/pyffmpeg/source/browse/ - but then I found the
"unofficial" github repository instead, https://github.com/mhaller/pyffmpeg/ -
but here too both the master and v2.2alpha branches are using __new__ still.
Original comment by p.j.a.c...@googlemail.com
on 13 Jan 2012 at 4:19
See also these patches from Robert Kern (NumPy developer), see:
http://mail.scipy.org/pipermail/numpy-discussion/2012-January/059865.html
>> Thanks for the suggestion.
>>
>> Sadly right now pyffmpeg won't install on Mac OS X,
>> at least not with the version of Cython I have installed:
>> http://code.google.com/p/pyffmpeg/issues/detail?id=44
>>
>> There doesn't seem to have been any activity on the
>> official repository for some time either.
>
> Oh, right, I had to fix those, too. I've attached the patches that I
> used. I used MacPorts to install the ffmpeg libraries, so I modified
> the paths in the setup.py appropriately.
Original comment by p.j.a.c...@googlemail.com
on 18 Jan 2012 at 10:55
Attachments:
Why aren't these patches merged into the downloadable version yet?
Original comment by nickreta...@gmail.com
on 2 Feb 2012 at 9:39
Good news, everyone!
For your convenience, I have applied the patches mentioned above + some new
needed fixes and put them up at https://github.com/vvrbanc/pyffmpeg
My repo is a fork of https://github.com/mhaller/pyffmpeg, which is the latest
available unofficial version from one of the project maintainers.
It compiles against current macport of ffmpeg-devel, which is @20111104 as of
Feb 20. 2012.
If you have issues with my fork, please post your comments at github, not here.
An alternative approach to compiling pyffmpeg is to get latest mhaller's
version from git://github.com/mhaller/pyffmpeg.git and compile it against the
FFmpeg version he used... it's listed in the README file on github.
Basically, just go to https://github.com/mhaller/pyffmpeg and
https://github.com/FFmpeg/FFmpeg/tree/35d7d6f7489c75aaa2fcb39820fb25b0fd44524b
, download repos as zipballs, compile, install.
If you're installing FFmpeg to an alternative location, remember to edit
setup.py for pyffmpeg at line 34 and include your new path.
Cheers,
Vedran
Original comment by vvrb...@gmail.com
on 20 Feb 2012 at 9:24
@16: Building fails with the following error message and setup from your Git
repository:
$ python2 setup.py build
pyffmpeg.c: In function '__pyx_import_star_set':
pyffmpeg.c:22675:38: error: incompatible types when assigning to type 'struct
AVRational' from type 'int'
cython 0.16
ffmpeg 1:0.11.1
python2 2.7.3
pyffmpeg.c: http://pastebin.com/atatvCzS (relevant function)
Original comment by mschu.dev@gmail.com
on 23 Jul 2012 at 3:59
my build fails with the same error message too; I have filed a new issue on
google code.lets see.
Original comment by mani.bak...@gmail.com
on 17 Sep 2012 at 9:26
[deleted comment]
I've installed ffmpeg with brew
I have the latest version of the fixed pyffmpeg supplied by Vedran Vrbanc
(thank you)
https://github.com/vvrbanc/pyffmpeg.git
I've posted an gist here with the compile error:
https://gist.github.com/pjakobsen/6390588
Any hints would be much appreciated? I suspect this may be happening because
brew installs the latest version of ffmpeg, which is either not a development
version or is incompatible with the dependencies required by this particular
version of pyffmpeg. Am I on the right track? I'm reluctant to start
installing ffmpeg with port because I hear running both port and brew can mess
up OS X
Original comment by pjakob...@gmail.com
on 30 Aug 2013 at 2:52
Original issue reported on code.google.com by
alexsuse...@gmail.com
on 19 Oct 2011 at 2:56