Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup.py problem #3

Open
omria123 opened this issue May 31, 2016 · 7 comments
Open

setup.py problem #3

omria123 opened this issue May 31, 2016 · 7 comments

Comments

@omria123
Copy link

the setup.py doesnt work, in the python file there is a type error, the script is trying to add list and string, how can i fix it? and what path do i need to change to in ffmpegpath?
and by the way the 2.1 version doesnt work either i transfered the files to the folder Lib\site-packages
and i still cant import pyffmpeg

@serapissobek
Copy link

Change this line
incdir = incdir + list(nd.get_numpy_include_dirs())

To:

templist = list(nd.get_numpy_include_dirs())
templist .append(incdir)
incdir = templist

@omria123
Copy link
Author

i still get an error (a different one):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: no commands supplied

@serapissobek
Copy link

you have to do a build with the below line:
python setup.py build

@omria123
Copy link
Author

omria123 commented Jun 1, 2016

i still get an error when i try to use build (a very long one)
""" ## cdef AVFormatContext *FormatCtx
cdef AVCodecContext *CodecCtx
cdef AVCodec *Codec
cdef AVOptions *codec_options

^

pyffmpeg.pyx:3118:9: 'AVOptions' is not a type identifier

Error compiling Cython file:

...
self.CodecCtx.skip_loop_filter = AVDISCARD_NONKEY
self.CodecCtx.skip_frame = AVDISCARD_NONKEY
self.CodecCtx.skip_idct = AVDISCARD_NONKEY
# deprecated
# 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header
self.CodecCtx.hurry_up=2

^

pyffmpeg.pyx:3210:25: Object of type 'AVCodecContext' has no attribute 'hurry_up'

Error compiling Cython file:

...
self.Codec = avcodec_find_decoder(self.CodecCtx.codec_id)
if self.Codec == NULL:
raise IOError("Unable to get decoder")
if (self.Codec.capabilities & CODEC_CAP_TRUNCATED) and (self.support_truncated!=0):
self.CodecCtx.flags = self.CodecCtx.flags | CODEC_FLAG_TRUNCATED
ret = avcodec_open(self.CodecCtx, self.Codec)

^

pyffmpeg.pyx:3303:31: Cannot convert 'AVCodecContext *' to Python object

Error compiling Cython file:

...
self.Codec = avcodec_find_decoder(self.CodecCtx.codec_id)
if self.Codec == NULL:
raise IOError("Unable to get decoder")
if (self.Codec.capabilities & CODEC_CAP_TRUNCATED) and (self.support_truncated!=0):
self.CodecCtx.flags = self.CodecCtx.flags | CODEC_FLAG_TRUNCATED
ret = avcodec_open(self.CodecCtx, self.Codec)

^

pyffmpeg.pyx:3303:46: Cannot convert 'AVCodec *' to Python object

Error compiling Cython file:

...
def set_hurry(self, b=1):
#if we hurry it we can get bad frames later in the GOP
if (b) :
self.CodecCtx.skip_idct = AVDISCARD_BIDIR
self.CodecCtx.skip_frame = AVDISCARD_BIDIR
self.CodecCtx.hurry_up = 1

^

pyffmpeg.pyx:4034:25: Object of type 'AVCodecContext' has no attribute 'hurry_up'

Error compiling Cython file:

...
self.CodecCtx.hurry_up = 1
self.hurried_frames = 0
else:
self.CodecCtx.skip_idct = AVDISCARD_DEFAULT
self.CodecCtx.skip_frame = AVDISCARD_DEFAULT
self.CodecCtx.hurry_up = 0

^

pyffmpeg.pyx:4039:25: Object of type 'AVCodecContext' has no attribute 'hurry_up'

Error compiling Cython file:

...
# time related functions
# #########################################################

def get_fps(self):
    """ return the number of frame per second of the video """
    return (<float>self.stream.r_frame_rate.num / <float>self.stream.r_frame_rate.den)
                             ^

pyffmpeg.pyx:4104:34: Object of type 'AVStream' has no attribute 'r_frame_rate'

Error compiling Cython file:

...
# time related functions
# #########################################################

def get_fps(self):
    """ return the number of frame per second of the video """
    return (<float>self.stream.r_frame_rate.num / <float>self.stream.r_frame_rate.den)
                                                                   ^

pyffmpeg.pyx:4104:72: Object of type 'AVStream' has no attribute 'r_frame_rate'

Error compiling Cython file:

...
av_free_packet(self.packet)
self.packet=NULL
if (self.prepacket):
av_free_packet(self.prepacket)
self.prepacket=NULL
av_close_input_file(self.FormatCtx)

^

pyffmpeg.pyx:4252:36: Cannot convert 'AVFormatContext *' to Python object

Error compiling Cython file:

...
if (fmt==NULL) or (not (fmt.flags & AVFMT_NOFILE)):
ret = avio_open(&self.FormatCtx.pb, filename, 0)
if ret < 0:
raise IOError("Unable to open file %s (avio_open)" % filename)
if (buf_size>0):
url_setbufsize(self.FormatCtx.pb,buf_size)

^

pyffmpeg.pyx:4307:45: Cannot convert 'AVIOContext *' to Python object

Error compiling Cython file:

...

    assert(fmt!=NULL)
    self.FormatCtx.iformat=fmt

    if (mode=="r"):
        ret = av_open_input_stream(&self.FormatCtx,self.FormatCtx.pb,filename,self.FormatCtx.iformat,NULL)
                                  ^

pyffmpeg.pyx:4328:39: Cannot convert 'AVFormatContext **' to Python object

Error compiling Cython file:

...

    assert(fmt!=NULL)
    self.FormatCtx.iformat=fmt

    if (mode=="r"):
        ret = av_open_input_stream(&self.FormatCtx,self.FormatCtx.pb,filename,self.FormatCtx.iformat,NULL)
                                                                ^

pyffmpeg.pyx:4328:69: Cannot convert 'AVIOContext *' to Python object

Error compiling Cython file:

...

    assert(fmt!=NULL)
    self.FormatCtx.iformat=fmt

    if (mode=="r"):
        ret = av_open_input_stream(&self.FormatCtx,self.FormatCtx.pb,filename,self.FormatCtx.iformat,NULL)
                                                                                           ^

pyffmpeg.pyx:4328:96: Cannot convert 'AVInputFormat *' to Python object

Error compiling Cython file:

...

    assert(fmt!=NULL)
    self.FormatCtx.iformat=fmt

    if (mode=="r"):
        ret = av_open_input_stream(&self.FormatCtx,self.FormatCtx.pb,filename,self.FormatCtx.iformat,NULL)
                                                                                                    ^

pyffmpeg.pyx:4328:105: Cannot convert 'void *' to Python object
warning: pyffmpeg.pyx:4348:52: Obtaining 'char *' from externally modifiable global Python value

Error compiling Cython file:

...
# Guess file format with file extention
oc.oformat = av_guess_format(NULL, filename_, NULL)
if (oc.oformat==NULL):
raise Exception, "Unable to find output format for %s\n"
# Alloc priv_data for format
oc.priv_data = av_mallocz(oc.oformat.priv_data_size)

^

pyffmpeg.pyx:4352:44: Object of type 'AVOutputFormat' has no attribute 'priv_data_size'
warning: pyffmpeg.pyx:4369:35: Obtaining 'char *' from externally modifiable global Python value

Error compiling Cython file:

...
cdef int ret
cdef int i

    if (track_selector==None):
        track_selector=TS_VIDEO
    ret = av_find_stream_info(self.FormatCtx)
                                 ^

pyffmpeg.pyx:4385:38: Cannot convert 'AVFormatContext *' to Python object

Error compiling Cython file:

...
self.packet=NULL
if (self.prepacket):
av_free_packet(self.prepacket)
self.prepacket=NULL
self.tracks=[] # break cross references
av_close_input_file(self.FormatCtx)

^

pyffmpeg.pyx:4478:36: Cannot convert 'AVFormatContext *' to Python object

Error compiling Cython file:

...
if (ct.no==self.packet.stream_index):
#ct.process_packet(self.packet)
## I don't know why it seems that Windows Cython have problem calling the correct virtual function
##
##
if ct.CodecCtx.codec_type==CODEC_TYPE_VIDEO:

^

pyffmpeg.pyx:4560:41: Invalid types for '==' (AVMediaType, CodecType)

Error compiling Cython file:

...
##
if ct.CodecCtx.codec_type==CODEC_TYPE_VIDEO:
processed=True
vt=ct
vt.process_packet(self.packet)
elif ct.CodecCtx.codec_type==CODEC_TYPE_AUDIO:

^

pyffmpeg.pyx:4564:43: Invalid types for '==' (AVMediaType, CodecType)

Error compiling Cython file:

...
ret = av_seek_frame(self.FormatCtx,-1,byte, AVSEEK_FLAG_BACKWARD|AVSEEK_FLAG_BYTE)#|AVSEEK_FLAG_ANY)
if ret < 0:
raise IOError("Unable to seek: %d" % (ret,))
if (self.io_context!=NULL):
# used to have & here
avio_seek(self.FormatCtx.pb, self.FormatCtx.data_offset, SEEK_SET)

^

pyffmpeg.pyx:4738:55: Object of type 'AVFormatContext' has no attribute 'data_offset'
building 'pyffmpeg' extension
error: Unable to find vcvarsall.bat"""

@omria123
Copy link
Author

omria123 commented Jun 1, 2016

there is more but i cant see it in cmd

@serapissobek
Copy link

Yeah, I got stuck in this one as well and I issued it before, check the list of issues. but no one has replied me yet

@BlitzKraft
Copy link

I just forked this today, and I am working resolving a few issues. I think many of the above log messages are due to changes in ffmpeg api. You can follow the progress here https://github.com/blitzkraft/pyffmpeg/tree/update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants