1. Zakhar Zibarov
  2. FFVideo
  3. Issues
Issue #1 resolved

No longer able to install

Stephen Tanner
created an issue

I was working on my project this afternoon and tried to run my unittest file and ended up getting some failed import methods.

Verified from the python interpreter that I was unable to import the file (complaining about libavcodec.so.52 could not be found but I verified it was installed)

So I removed the package and attempted to build from both your tar ball and hg tree. Neither will build/install on my system.

setup.py fails with this message: {{{ gcc -pthread -DNDEBUG -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/ffmpeg -I/usr/include/python2.7 -c ffvideo/ffvideo.c -o build/temp.linux-x86_64-2.7/ffvideo/ffvideo.o ffvideo/ffvideo.c: In function ‘pyx_pf_7ffvideo_11VideoStream_init’: ffvideo/ffvideo.c:1530:3: warning: ‘av_open_input_file’ is deprecated (declared at /usr/include/libavformat/avformat.h:1253) [-Wdeprecated-declarations] ffvideo/ffvideo.c:1576:3: warning: ‘av_find_stream_info’ is deprecated (declared at /usr/include/libavformat/avformat.h:1335) [-Wdeprecated-declarations] ffvideo/ffvideo.c:1635:130: error: ‘CODEC_TYPE_VIDEO’ undeclared (first use in this function) ffvideo/ffvideo.c:1635:130: note: each undeclared identifier is reported only once for each function it appears in ffvideo/ffvideo.c:1878:3: warning: ‘avcodec_open’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3915) [-Wdeprecated-declarations] ffvideo/ffvideo.c: In function ‘pyx_pf_7ffvideo_11VideoStream_dump’: ffvideo/ffvideo.c:2235:3: warning: ‘dump_format’ is deprecated (declared at /usr/include/libavformat/avformat.h:1754) [-Wdeprecated-declarations] ffvideo/ffvideo.c: In function ‘__pyx_pf_7ffvideo_11VideoStream_current’: ffvideo/ffvideo.c:2824:3: warning: passing argument 2 of ‘PyObject_AsCharBuffer’ from incompatible pointer type [enabled by default] /usr/include/python2.7/abstract.h:476:22: note: expected ‘const char ’ but argument is of type ‘char ’ ffvideo/ffvideo.c:2862:198: warning: passing argument 2 of ‘sws_scale’ from incompatible pointer type [enabled by default] /usr/include/libswscale/swscale.h:238:5: note: expected ‘const uint8_t * const’ but argument is of type ‘uint8_t *’ error: command 'gcc' failed with exit status 1 }}}

My system setup is as follows: Archlinux (x64) Python 2.7 (and 3) gcc is 4.6.2 ffmpeg is:

{{{ ffmpeg version N-34586-g33feba3, Copyright (c) 2000-2011 the FFmpeg developers built on Nov 8 2011 14:45:52 with gcc 4.6.2 configuration: --prefix=/usr --enable-libmp3lame --enable-libvorbis --enable-libxvid --enable-libx264 --enable-libvpx --enable-libtheora --enable-libgsm --enable-libspeex --enable-postproc --enable-shared --enable-x11grab --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libschroedinger --enable-libopenjpeg --enable-librtmp --enable-gpl --enable-version3 --enable-runtime-cpudetect --disable-debug --disable-static libavutil 51. 24. 0 / 51. 24. 0 libavcodec 53. 29. 0 / 53. 29. 0 libavformat 53. 20. 0 / 53. 20. 0 libavdevice 53. 4. 0 / 53. 4. 0 libavfilter 2. 47. 0 / 2. 47. 0 libswscale 2. 1. 0 / 2. 1. 0 libpostproc 51. 2. 0 / 51. 2. 0 ffmpeg N-34586-g33feba3 libavutil 51. 24. 0 / 51. 24. 0 libavcodec 53. 29. 0 / 53. 29. 0 libavformat 53. 20. 0 / 53. 20. 0 libavdevice 53. 4. 0 / 53. 4. 0 libavfilter 2. 47. 0 / 2. 47. 0 libswscale 2. 1. 0 / 2. 1. 0 libpostproc 51. 2. 0 / 51. 2. 0 }}}

Also, thank you for this project.

Comments (4)

  1. Anonymous
    --- a/ffvideo/ffmpeg.pxd        Sat Sep 10 03:33:21 2011 +0400
    +++ b/ffvideo/ffmpeg.pxd        Thu Apr 12 00:26:20 2012 +0200
    @@ -101,12 +101,14 @@
             int skip_frame
             AVRational time_base
             
    -    enum CodecType:
    -        CODEC_TYPE_UNKNOWN = -1
    -        CODEC_TYPE_VIDEO = 0
    -        CODEC_TYPE_AUDIO = 1
    -        CODEC_TYPE_DATA = 2
    -        CODEC_TYPE_SUBTITLE = 3
    +    enum AVMediaType:
    +        AVMEDIA_TYPE_UNKNOWN = -1
    +        AVMEDIA_TYPE_VIDEO = 0
    +        AVMEDIA_TYPE_AUDIO = 1
    +        AVMEDIA_TYPE_DATA = 2
    +        AVMEDIA_TYPE_SUBTITLE = 3
    +        AVMEDIA_TYPE_ATTACHMENT = 4
    +        AVMEDIA_TYPE_NB = 5
     
         struct AVCodec:
             char *name
    @@ -145,8 +147,8 @@
     
         AVCodec *avcodec_find_decoder(int id)
         int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
    -    int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
    -                         int *got_picture_ptr, char *buf, int buf_size) nogil
    +    int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
    +                         int *got_picture_ptr, AVPacket *avpkt) nogil
         int avpicture_fill(AVPicture *picture, void *ptr, int pix_fmt, int width, int height) nogil
         AVFrame *avcodec_alloc_frame()
         int avpicture_get_size(int pix_fmt, int width, int height)
    @@ -246,16 +248,15 @@
             int flags
     
     
    -    struct AVFormatParameters:
    +    struct AVDictionary:
             pass
     
    -    int av_open_input_file(AVFormatContext **ic_ptr, char *filename,
    +    int avformat_open_input(AVFormatContext **ic_ptr, char *filename,
                            AVInputFormat *fmt,
    -                       int buf_size,
    -                       AVFormatParameters *ap)
    +                       AVDictionary **options)
         int av_find_stream_info(AVFormatContext *ic)
    
    -    void dump_format(AVFormatContext *ic,
    +    void av_dump_format(AVFormatContext *ic,
                      int index,
                      char *url,
                      int is_output)
    
    --- a/ffvideo/ffvideo.pyx       Sat Sep 10 03:33:21 2011 +0400
    +++ b/ffvideo/ffvideo.pyx       Thu Apr 12 00:26:20 2012 +0200
    @@ -135,7 +135,7 @@
             self.frame_mode = frame_mode
             self.scale_mode = scale_mode
     
    -        ret = av_open_input_file(&self.format_ctx, filename, NULL, 0, NULL)
    +        ret = avformat_open_input(&self.format_ctx, filename, NULL, NULL)
             if ret != 0:
                 raise DecoderError("Unable to open file %s" % filename)
     
    @@ -144,7 +144,7 @@
                 raise DecoderError("Unable to find stream info: %d" % ret)
     
             for i in xrange(self.format_ctx.nb_streams):
    -            if self.format_ctx.streams[i].codec.codec_type == CODEC_TYPE_VIDEO:
    +            if self.format_ctx.streams[i].codec.codec_type == AVMEDIA_TYPE_VIDEO:
                     self.streamno = i
                     break
             else:
    @@ -209,7 +209,7 @@
         def dump(self):
             print "max_b_frames=%s" % self.codec_ctx.max_b_frames
             av_log_set_level(AV_LOG_VERBOSE);
    -        dump_format(self.format_ctx, 0, self.filename, 0);
    +        av_dump_format(self.format_ctx, 0, self.filename, 0);
             av_log_set_level(AV_LOG_ERROR);
     
         def __decode_next_frame(self):
    @@ -224,9 +224,8 @@
     
                 if self.packet.stream_index == self.streamno:
                     with nogil:
    -                    ret = avcodec_decode_video(self.codec_ctx, self.frame,
    -                                               &frame_finished,
    -                                               self.packet.data, self.packet.size)
    +                    ret = avcodec_decode_video2(self.codec_ctx, self.frame,
    +                                               &frame_finished, &self.packet)
                     if ret < 0:
                         av_free_packet(&self.packet)
                         raise IOError("Unable to decode video picture: %d" % ret)
    
  2. Anonymous

    Slightly improved patch - removed deprecated stuff

    diff -r 3a317984a512 ffvideo/ffmpeg.pxd
    --- a/ffvideo/ffmpeg.pxd        Sat Sep 10 03:33:21 2011 +0400
    +++ b/ffvideo/ffmpeg.pxd        Thu Apr 12 14:43:47 2012 +0200
    @@ -19,8 +19,6 @@
         int64_t av_rescale(int64_t a, int64_t b, int64_t c)
         int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
     
    -
    -
     cdef extern from "libavutil/avutil.h":
         cdef enum PixelFormat:
             PIX_FMT_NONE= -1,
    @@ -48,7 +46,14 @@
             PIX_FMT_UYVY411,   #< Packed pixel, Cb Y0 Y1 Cr Y2 Y3
             PIX_FMT_NB,
     
    -cdef extern from "libavutil/avutil.h":
    +    struct AVDictionaryEntry:
    +        char *key
    +        char *value
    +
    +    struct AVDictionary:
    +        int count
    +        AVDictionaryEntry *elems
    +
         void av_free(void *) nogil
         void av_freep(void *) nogil
     
    @@ -86,6 +91,14 @@
             AVDISCARD_NONKEY =  32 # discard all frames except keyframes
             AVDISCARD_ALL    =  48 # discard all
     
    +    enum AVMediaType:
    +        AVMEDIA_TYPE_UNKNOWN = -1
    +        AVMEDIA_TYPE_VIDEO = 0
    +        AVMEDIA_TYPE_AUDIO = 1
    +        AVMEDIA_TYPE_DATA = 2
    +        AVMEDIA_TYPE_SUBTITLE = 3
    +        AVMEDIA_TYPE_ATTACHMENT = 4
    +        AVMEDIA_TYPE_NB = 5
     
         struct AVCodecContext:
             int max_b_frames
    @@ -100,13 +113,6 @@
             int skip_idct
             int skip_frame
             AVRational time_base
    -        
    -    enum CodecType:
    -        CODEC_TYPE_UNKNOWN = -1
    -        CODEC_TYPE_VIDEO = 0
    -        CODEC_TYPE_AUDIO = 1
    -        CODEC_TYPE_DATA = 2
    -        CODEC_TYPE_SUBTITLE = 3
     
         struct AVCodec:
             char *name
    @@ -144,9 +150,9 @@
             int linesize[4]
     
         AVCodec *avcodec_find_decoder(int id)
    -    int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
    -    int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
    -                         int *got_picture_ptr, char *buf, int buf_size) nogil
    +    int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)
    +    int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
    +                         int *got_picture_ptr, AVPacket *avpkt) nogil
         int avpicture_fill(AVPicture *picture, void *ptr, int pix_fmt, int width, int height) nogil
         AVFrame *avcodec_alloc_frame()
         int avpicture_get_size(int pix_fmt, int width, int height)
    @@ -159,8 +165,6 @@
         void avcodec_flush_buffers(AVCodecContext *avctx)
         int avcodec_close (AVCodecContext *avctx)
     
    -
    -
     cdef extern from "libavformat/avformat.h":
         struct AVFrac:
             int64_t val, num, den
    @@ -182,7 +186,7 @@
             # approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1
             AVRational r_frame_rate
             void *priv_data
    -        # internal data used in av_find_stream_info()
    +        # internal data used in avformat_find_stream_info()
             int64_t codec_info_duration
             int codec_info_nb_frames
             # encoding: PTS generation when outputing stream
    @@ -245,17 +249,12 @@
             int index_built
             int flags
     
    +    int avformat_open_input(AVFormatContext **ic_ptr, char *filename,
    +                       AVInputFormat *fmt,
    +                       AVDictionary **options)
    +    int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
     
    -    struct AVFormatParameters:
    -        pass
    -
    -    int av_open_input_file(AVFormatContext **ic_ptr, char *filename,
    -                       AVInputFormat *fmt,
    -                       int buf_size,
    -                       AVFormatParameters *ap)
    -    int av_find_stream_info(AVFormatContext *ic)
    -
    -    void dump_format(AVFormatContext *ic,
    +    void av_dump_format(AVFormatContext *ic,
                      int index,
                      char *url,
                      int is_output)
    @@ -268,14 +267,12 @@
         void av_parser_close(AVCodecParserContext *s)
     
         int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
    -    void av_close_input_file(AVFormatContext *s)
    -
    +    void avformat_close_input(AVFormatContext **s)
     
     cdef extern from "libavformat/avio.h":
         int url_ferror(ByteIOContext *s)
         int url_feof(ByteIOContext *s)
     
    -
     cdef extern from "libswscale/swscale.h":
         int SWS_FAST_BILINEAR
         int SWS_BILINEAR
    @@ -284,11 +281,13 @@
         struct SwsVector:
             double *coeff
             int length
    +
         struct SwsFilter:
             SwsVector *lumH
             SwsVector *lumV
             SwsVector *chrH
             SwsVector *chrV
    +
         struct SwsContext:
             pass
     
    @@ -299,5 +298,3 @@
     
         int sws_scale(SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
                         int srcSliceH, uint8_t* dst[], int dstStride[]) nogil
    -
    -
    diff -r 3a317984a512 ffvideo/ffvideo.pyx
    --- a/ffvideo/ffvideo.pyx       Sat Sep 10 03:33:21 2011 +0400
    +++ b/ffvideo/ffvideo.pyx       Thu Apr 12 14:43:47 2012 +0200
    @@ -135,16 +135,16 @@
             self.frame_mode = frame_mode
             self.scale_mode = scale_mode
     
    -        ret = av_open_input_file(&self.format_ctx, filename, NULL, 0, NULL)
    +        ret = avformat_open_input(&self.format_ctx, filename, NULL, NULL)
             if ret != 0:
                 raise DecoderError("Unable to open file %s" % filename)
     
    -        ret = av_find_stream_info(self.format_ctx)
    +        ret = avformat_find_stream_info(self.format_ctx, NULL)
             if ret < 0:
                 raise DecoderError("Unable to find stream info: %d" % ret)
     
             for i in xrange(self.format_ctx.nb_streams):
    -            if self.format_ctx.streams[i].codec.codec_type == CODEC_TYPE_VIDEO:
    +            if self.format_ctx.streams[i].codec.codec_type == AVMEDIA_TYPE_VIDEO:
                     self.streamno = i
                     break
             else:
    @@ -171,11 +171,11 @@
             self.height = self.codec_ctx.height
     
             # Open codec
    -        ret = avcodec_open(self.codec_ctx, self.codec)
    +        ret = avcodec_open2(self.codec_ctx, self.codec, NULL)
             if ret < 0:
                 raise DecoderError("Unable to open codec")
     
    -        # for some videos, avcodec_open will set these to 0,
    +        # for some videos, avcodec_open2 will set these to 0,
             # so we'll only be using it if it is not 0, otherwise,
             # we rely on the resolution provided by the header;
             if self.codec_ctx.width != 0 and self.codec_ctx.height !=0:
    @@ -203,13 +203,12 @@
                 avcodec_close(self.codec_ctx)
                 self.codec_ctx = NULL
             if self.format_ctx:
    -            av_close_input_file(self.format_ctx)
    -            self.format_ctx = NULL
    +            avformat_close_input(&self.format_ctx)
     
         def dump(self):
             print "max_b_frames=%s" % self.codec_ctx.max_b_frames
             av_log_set_level(AV_LOG_VERBOSE);
    -        dump_format(self.format_ctx, 0, self.filename, 0);
    +        av_dump_format(self.format_ctx, 0, self.filename, 0);
             av_log_set_level(AV_LOG_ERROR);
     
         def __decode_next_frame(self):
    @@ -224,9 +223,8 @@
     
                 if self.packet.stream_index == self.streamno:
                     with nogil:
    -                    ret = avcodec_decode_video(self.codec_ctx, self.frame,
    -                                               &frame_finished,
    -                                               self.packet.data, self.packet.size)
    +                    ret = avcodec_decode_video2(self.codec_ctx, self.frame,
    +                                               &frame_finished, &self.packet)
                     if ret < 0:
                         av_free_packet(&self.packet)
                         raise IOError("Unable to decode video picture: %d" % ret)
    
  3. Log in to comment