[R] install package av on centos 7

Schneider, Dominik dom|n|k@@chne|der @end|ng |rom w@u@edu
Mon Dec 9 19:03:17 CET 2019


I tried to install the av package on centos7 server with R 3.5.3 but am receiving an error. I installed ffmpeg and ffmpeg-devel on centos 7 as below and then followed the instructions of specifying LIB_DIR and INCLUDE_DIR for installing av.

any help would be appreciated. Thanks


```
> install.packages('av', configure.vars = c("LIB_DIR=/usr/lib64","INCLUDE_DIR=/usr/include/ffmpeg"))
Installing package into '/home/dominik/R/x86_64-pc-linux-gnu-library/3.5'
(as 'lib' is unspecified)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0 100  720k  100  720k    0     0   987k      0 --:--:-- --:--:-- --:--:--  987k
No protocol specified
* installing *source* package 'av' ...
** package 'av' successfully unpacked and MD5 sums checked
Found INCLUDE_DIR and/or LIB_DIR!
Using PKG_CFLAGS=-I/usr/include/ffmpeg
Using PKG_LIBS=-L/usr/lib64 -lavfilter
** libs
rm -f av.so formats.o info.o init.o util.o video.o
gcc -std=gnu99 -I/opt/microsoft/ropen/3.5.3/lib64/R/include -DNDEBUG -I/usr/include/ffmpeg   -DU_STATIC_IMPLEMENTATION  -fvisibility=hidden -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c formats.c -o formats.o
gcc -std=gnu99 -I/opt/microsoft/ropen/3.5.3/lib64/R/include -DNDEBUG -I/usr/include/ffmpeg   -DU_STATIC_IMPLEMENTATION  -fvisibility=hidden -fpic  -DU_STATIC_IMPLEMENTATION -O2 -g  -c info.c -o info.o
info.c: In function 'get_video_info':
info.c:33:14: error: 'AVStream' has no member named 'codecpar'
     if(stream->codecpar->codec_type != AVMEDIA_TYPE_VIDEO)
              ^
info.c:35:49: error: 'AVStream' has no member named 'codecpar'
     AVCodec *codec = avcodec_find_decoder(stream->codecpar->codec_id);
                                                 ^
info.c:40:55: error: 'AVStream' has no member named 'codecpar'
     SET_VECTOR_ELT(streamdata, 0, Rf_ScalarReal(stream->codecpar->width));
                                                       ^
info.c:41:55: error: 'AVStream' has no member named 'codecpar'
     SET_VECTOR_ELT(streamdata, 1, Rf_ScalarReal(stream->codecpar->height));
                                                       ^
info.c:45:94: error: 'AVStream' has no member named 'codecpar'
     SET_VECTOR_ELT(streamdata, 5, safe_string(av_get_pix_fmt_name((enum AVPixelFormat) stream->codecpar->format)));
                                                                                              ^
info.c: In function 'get_audio_info':
info.c:64:14: error: 'AVStream' has no member named 'codecpar'
     if(stream->codecpar->codec_type != AVMEDIA_TYPE_AUDIO)
              ^
info.c:66:49: error: 'AVStream' has no member named 'codecpar'
     AVCodec *codec = avcodec_find_decoder(stream->codecpar->codec_id);
                                                 ^
info.c:70:55: error: 'AVStream' has no member named 'codecpar'
     SET_VECTOR_ELT(streamdata, 0, Rf_ScalarReal(stream->codecpar->channels));
                                                       ^
info.c:71:55: error: 'AVStream' has no member named 'codecpar'
     SET_VECTOR_ELT(streamdata, 1, Rf_ScalarReal(stream->codecpar->sample_rate));
                                                       ^
info.c:74:55: error: 'AVStream' has no member named 'codecpar'
     SET_VECTOR_ELT(streamdata, 4, Rf_ScalarReal(stream->codecpar->bit_rate));
                                                       ^
info.c:77:54: error: 'AVStream' has no member named 'codecpar'
     av_get_channel_layout_string(layout, 1024, stream->codecpar->channels, stream->codecpar->channel_layout);
                                                      ^
info.c:77:82: error: 'AVStream' has no member named 'codecpar'
     av_get_channel_layout_string(layout, 1024, stream->codecpar->channels, stream->codecpar->channel_layout);
                                                                                  ^
make: *** [info.o] Error 1
ERROR: compilation failed for package 'av'
* removing '/home/dominik/R/x86_64-pc-linux-gnu-library/3.5/av'
Warning in install.packages :
  installation of package 'av' had non-zero exit status

The downloaded source packages are in
              '/tmp/RtmpMDafXK/downloaded_packages'
```

ffmpeg was installed successfully:

```
sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
Retrieving http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:nux-dextop-release-0-5.el7.nux   ################################# [100%]
sudo yum install ffmpeg ffmpeg-devel -y
```

Result:

```
(base) [dominik using cppc-server ffmpeg]$ ffmpeg
ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfdk-aac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
(base) [dominik using cppc-server ffmpeg]$
```

	[[alternative HTML version deleted]]



More information about the R-help mailing list