Python ffmpeg编译错误

Python ffmpeg编译错误,python,ffmpeg,raspberry-pi2,Python,Ffmpeg,Raspberry Pi2,我一直在尝试在我的raspberry pi上编译ffmpeg,但它给了我很多警告,比如(编解码器已被弃用),尤其是在运行sudo make时 pi@raspberrypi:/usr/src/ffmpeg $ sudo make && sudo make install ....... lots of successful execution here ...... CC libavfilter/avf_showfreqs.o libavfilter/lavfutils

我一直在尝试在我的raspberry pi上编译ffmpeg,但它给了我很多警告,比如(编解码器已被弃用),尤其是在运行sudo make时

 pi@raspberrypi:/usr/src/ffmpeg $ sudo make && sudo make install

....... lots of successful execution here ...... 


CC  libavfilter/avf_showfreqs.o
libavfilter/lavfutils.c: In function ‘ff_load_image’:
libavfilter/lavfutils.c:53:5: warning: ‘codec’ is deprecated (declared at    ./libavformat/avformat.h:880) [-Wdeprecated-declarations]
 codec_ctx = format_ctx->streams[0]->codec;
 ^
libavfilter/lavfutils.c:79:5: warning: ‘avcodec_decode_video2’ is deprecated   (declared at ./libavcodec/avcodec.h:4763) [-Wdeprecated-declarations]
 ret = avcodec_decode_video2(codec_ctx, frame, &frame_decoded, &pkt);
 ^
CC  libavfilter/lswsutils.o
CC  libavfilter/opencl_allkernels.o
CC  libavfilter/pthread.o
CC  libavfilter/setpts.o
CC  libavfilter/settb.o
CC  libavfilter/split.o
CC  libavfilter/src_movie.o
libavfilter/src_movie.c: In function ‘movie_push_frame’:
libavfilter/src_movie.c:524:9: warning: ‘avcodec_decode_video2’ is deprecated (declared at ./libavcodec/avcodec.h:4763) [-Wdeprecated-declarations]
     ret = avcodec_decode_video2(st->codec_ctx, frame, &got_frame, pkt);
     ^
libavfilter/src_movie.c:527:9: warning: ‘avcodec_decode_audio4’ is deprecated (declared at ./libavcodec/avcodec.h:4714) [-Wdeprecated-declarations]
     ret = avcodec_decode_audio4(st->codec_ctx, frame, &got_frame, pkt);
     ^
CC  libavfilter/transform.o
CC  libavfilter/trim.o
CC  libavfilter/vaf_spectrumsynth.o
libavfilter/vaf_spectrumsynth.c: In function ‘try_push_frame’:
libavfilter/vaf_spectrumsynth.c:370:19: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
 int ch, n, i, ret;                 ^
CC  libavfilter/vf_alphamerge.o
CC  libavfilter/vf_aspect.o
CC  libavfilter/vf_atadenoise.o
CC  libavfilter/vf_colorlevels.o
CC  libavfilter/vf_colorspace.o
libavfilter/vf_colorspace.c: In function ‘fill_rgb2xyz_table’:
libavfilter/vf_colorspace.c:360:22: warning: passing argument 1 of ‘invert_matrix3x3’ from incompatible pointer type
 invert_matrix3x3(rgb2xyz, i);
                  ^
libavfilter/vf_colorspace.c:277:13: note: expected ‘const double (*)[3]’ but argument is of type ‘double (*)[3]’
 static void invert_matrix3x3(const double in[3][3], double out[3][3])
         ^
libavfilter/vf_colorspace.c: In function ‘fill_whitepoint_conv_table’:
libavfilter/vf_colorspace.c:424:21: warning: passing argument 3 of ‘mul3x3’   from incompatible pointer type
 mul3x3(tmp, ma, fac);
libavfilter/vf_colorspace.c:376:13: note: expected ‘const double (*)[3]’ but argument is of type ‘double (*)[3]’
static void mul3x3(double dst[3][3], const double src1[3][3], const double src2[3][3])
         ^
libavfilter/vf_colorspace.c:425:17: warning: passing argument 2 of ‘mul3x3’ from incompatible pointer type
 mul3x3(out, tmp, mai);
             ^
libavfilter/vf_colorspace.c:376:13: note: expected ‘const double (*)[3]’ but argument is of type ‘double (*)[3]’
static void mul3x3(double dst[3][3], const double src1[3][3], const double src2[3][3])
         ^
libavfilter/vf_colorspace.c:425:22: warning: passing argument 3 of ‘mul3x3’ from incompatible pointer type
 mul3x3(out, tmp, mai);
                  ^
libavfilter/vf_colorspace.c:376:13: note: expected ‘const double (*)[3]’ but argument is of type ‘double (*)[3]’
static void mul3x3(double dst[3][3], const double src1[3][3], const double src2[3][3])
         ^
libavfilter/vf_colorspace.c: In function ‘convert’:
libavfilter/vf_colorspace.c:480:20: warning: passing argument 7 of ‘s->yuv2yuv’ from incompatible pointer type
                s->yuv2yuv_coeffs, s->yuv_offset);
                ^
libavfilter/vf_colorspace.c:480:20: note: expected ‘const int16_t (*)[3][8]’ but argument is of type ‘int16_t (*)[3][8]’
libavfilter/vf_colorspace.c:480:39: warning: passing argument 8 of ‘s->yuv2yuv’ from incompatible pointer type
                s->yuv2yuv_coeffs, s->yuv_offset);
                                   ^
libavfilter/vf_colorspace.c:480:39: note: expected ‘const int16_t (*)[8]’ but argument is of type ‘int16_t (*)[8]’
libavfilter/vf_colorspace.c:502:20: warning: passing argument 7 of ‘s->yuv2rgb’ from incompatible pointer type
                s->yuv2rgb_coeffs, s->yuv_offset[0]);
                ^
libavfilter/vf_colorspace.c:502:20: note: expected ‘const int16_t (*)[3][8]’ but argument is of type ‘int16_t (*)[3][8]’
libavfilter/vf_colorspace.c:506:62: warning: passing argument 5 of ‘s->dsp.multiply3x3’ from incompatible pointer type
             s->dsp.multiply3x3(rgb, s->rgb_stride, w, h, s->lrgb2lrgb_coeffs);
                                                          ^
libavfilter/vf_colorspace.c:506:62: note: expected ‘const int16_t (*)[3][8]’ but argument is of type ‘int16_t (*)[3][8]’
libavfilter/vf_colorspace.c:511:28: warning: passing argument 7 of ‘s->rgb2yuv_fsb’ from incompatible pointer type
                        s->rgb2yuv_coeffs, s->yuv_offset[1], s->dither_scratch);
                        ^
libavfilter/vf_colorspace.c:511:28: note: expected ‘const int16_t (*)[3][8]’ but argument is of type ‘int16_t (*)[3][8]’
libavfilter/vf_colorspace.c:514:24: warning: passing argument 7 of ‘s->rgb2yuv’ from incompatible pointer type
                    s->rgb2yuv_coeffs, s->yuv_offset[1]);
                    ^
libavfilter/vf_colorspace.c:514:24: note: expected ‘const int16_t (*)[3][8]’ but argument is of type ‘int16_t (*)[3][8]’
libavfilter/vf_colorspace.c: In function ‘create_filtergraph’:
libavfilter/vf_colorspace.c:614:30: warning: passing argument 1 of ‘invert_matrix3x3’ from incompatible pointer type

                 ^
它还在继续


如何解决?此警告可能有什么问题?

首先,不要以root身份编译

您应该像普通用户一样运行
make
,而不使用
sudo

只有在root用户拥有的位置(例如
/usr
/usr/local
)安装时,才运行
sudo make install


至于您的问题,这些警告似乎来自ffmpeg代码,而不是您通过编译它所做的事情

这可能是因为您使用的gcc比ffmpeg开发人员的gcc更新,并且您的更新版本会报告对过去认为正常的内容的警告。或者可能是您使用了一些gcc选项来打开一些警告,而ffmpeg开发人员已经关闭了这些警告。也可能是ffmpeg在编译时也看到了这些警告,并决定忽略它们

但这些只是警告,即编译器告诉您«这是可疑的,您可能想检查它,但它可能会没事»。因此,除非您确定了实际问题,否则您可以忽略它们,或者向上游发送一个补丁,以使警告消失(当然,代码仍然正确)的方式更改代码

例如,我看到
警告:变量'ret'设置但未使用[-Wunused但设置变量]
的一个实例。嗯,您可以向上游发送一个补丁,删除该变量的定义,就像那样,一个警告就会消失。:)

但是,您提供的输出中没有错误,因此我假设您的编译成功了,并且您现在正在愉快地使用新构建的ffmpeg


还是有一个实际的错误没有粘贴到这里?

你能提供你正在使用的版本吗?我正在使用ffmpeg 3.1.1尝试这一个:)是的,编译成功了,没有错误,但似乎只是一个警告。我需要担心这些警告吗?除非你能阅读并修复源代码,否则没有必要担心它们,不:)我非常担心这一点。非常感谢:)是的,你真的需要担心警告。现在可能不是在生产中使用ffmpeg的时候,例如::::::libavfilter/lavfutils.c:53:5:警告:“codec”已被弃用(声明于./libavformat/avformat.h:880)[-Wdeprecated声明]codec\u ctx=format\u ctx->streams[0]->codec;::::完全表明您不能使用编解码器功能,请确保使用源代码中的文档,来自web的简单复制粘贴指令可能不起作用,这可能是基于已贬值的旧版本。@arshpreet:我同意您的看法,在编写API代码时,您需要担心警告。但这不是sivamnatesan3在这里所做的,他们只是编译ffmpeg本身,警告在ffmpeg代码中。