I
I
ibalashov242016-06-28 22:13:38
linux
ibalashov24, 2016-06-28 22:13:38

How to make FFMPEG work on Raspberry Pi?

Hello. Sometimes I need to remotely (via SSH) record 5-10 fps video from a USB webcam connected to a Raspberry Pi 2 (there should be enough power). For these purposes, ffmpeg / avconv was chosen, but the problem is that neither one nor the other wants to work on raspberries: they stupidly loop when entering any command. At the same time, if you plug the camera into a PC (on Ubuntu 14.04) with ffmpeg installed, then the same commands on this PC run without problems.
avconv output on any command:

[email protected]:~ $ avconv -f video4linux2 -i /dev/video0 out.mpg
avconv version 11.7-6:11.7-1~deb8u1+rpi1, Copyright (c) 2000-2016 the Libav developers
  built on Jun 17 2016 02:13:49 with gcc 4.9.2 (Raspbian 4.9.2-10)
... Далее висит ...

avconv output with -loglevel debug flag
[email protected]:~ $ avconv -loglevel debug -f video4linux2 -i /dev/video0 out.mpg
avconv version 11.7-6:11.7-1~deb8u1+rpi1, Copyright (c) 2000-2016 the Libav developers
  built on Jun 17 2016 02:13:49 with gcc 4.9.2 (Raspbian 4.9.2-10)
  configuration: --arch=arm --enable-pthreads --enable-runtime-cpudetect --extra-version='6:11.7-1~deb8u1+rpi1' --libdir=/usr/lib/arm-linux-gnueabihf --prefix=/usr --disable-yasm --disable-avserver --disable-protocol=concat --disable-armv6t2 --disable-neon --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-swscale --enable-libcdio --enable-x11grab --enable-libx264 --enable-libxvid --shlibdir=/usr/lib/arm-linux-gnueabihf --enable-shared --disable-static --disable-armv6t2 --disable-neon
  avutil      configuration: --arch=arm --enable-pthreads --enable-runtime-cpudetect --extra-version='6:11.7-1~deb8u1+rpi1' --libdir=/usr/lib/arm-linux-gnueabihf --prefix=/usr --disable-yasm --disable-avserver --disable-protocol=concat --disable-armv6t2 --disable-neon --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-swscale --enable-libcdio --enable-x11grab --enable-libx264 --enable-libxvid --shlibdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=armv7-a --extra-cflags='-mfpu=neon -fPIC -DPIC' --enable-shared --disable-static
  avcodec     configuration: --arch=arm --enable-pthreads --enable-runtime-cpudetect --extra-version='6:11.7-1~deb8u1+rpi1' --libdir=/usr/lib/arm-linux-gnueabihf --prefix=/usr --disable-yasm --disable-avserver --disable-protocol=concat --disable-armv6t2 --disable-neon --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-swscale --enable-libcdio --enable-x11grab --enable-libx264 --enable-libxvid --shlibdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=armv7-a --extra-cflags='-mfpu=neon -fPIC -DPIC' --enable-shared --disable-static
  avformat    configuration: --arch=arm --enable-pthreads --enable-runtime-cpudetect --extra-version='6:11.7-1~deb8u1+rpi1' --libdir=/usr/lib/arm-linux-gnueabihf --prefix=/usr --disable-yasm --disable-avserver --disable-protocol=concat --disable-armv6t2 --disable-neon --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-swscale --enable-libcdio --enable-x11grab --enable-libx264 --enable-libxvid --shlibdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=armv7-a --extra-cflags='-mfpu=neon -fPIC -DPIC' --enable-shared --disable-static
  avdevice    configuration: --arch=arm --enable-pthreads --enable-runtime-cpudetect --extra-version='6:11.7-1~deb8u1+rpi1' --libdir=/usr/lib/arm-linux-gnueabihf --prefix=/usr --disable-yasm --disable-avserver --disable-protocol=concat --disable-armv6t2 --disable-neon --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-swscale --enable-libcdio --enable-x11grab --enable-libx264 --enable-libxvid --shlibdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=armv7-a --extra-cflags='-mfpu=neon -fPIC -DPIC' --enable-shared --disable-static
  avfilter    configuration: --arch=arm --enable-pthreads --enable-runtime-cpudetect --extra-version='6:11.7-1~deb8u1+rpi1' --libdir=/usr/lib/arm-linux-gnueabihf --prefix=/usr --disable-yasm --disable-avserver --disable-protocol=concat --disable-armv6t2 --disable-neon --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-swscale --enable-libcdio --enable-x11grab --enable-libx264 --enable-libxvid --shlibdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=armv7-a --extra-cflags='-mfpu=neon -fPIC -DPIC' --enable-shared --disable-static
  avresample  configuration: --arch=arm --enable-pthreads --enable-runtime-cpudetect --extra-version='6:11.7-1~deb8u1+rpi1' --libdir=/usr/lib/arm-linux-gnueabihf --prefix=/usr --disable-yasm --disable-avserver --disable-protocol=concat --disable-armv6t2 --disable-neon --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-swscale --enable-libcdio --enable-x11grab --enable-libx264 --enable-libxvid --shlibdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=armv7-a --extra-cflags='-mfpu=neon -fPIC -DPIC' --enable-shared --disable-static
  swscale     configuration: --arch=arm --enable-pthreads --enable-runtime-cpudetect --extra-version='6:11.7-1~deb8u1+rpi1' --libdir=/usr/lib/arm-linux-gnueabihf --prefix=/usr --disable-yasm --disable-avserver --disable-protocol=concat --disable-armv6t2 --disable-neon --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-swscale --enable-libcdio --enable-x11grab --enable-libx264 --enable-libxvid --shlibdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=armv7-a --extra-cflags='-mfpu=neon -fPIC -DPIC' --enable-shared --disable-static
  libavutil     54.  3. 0 / 54.  3. 0
  libavcodec    56.  1. 0 / 56.  1. 0
  libavformat   56.  1. 0 / 56.  1. 0
  libavdevice   55.  0. 0 / 55.  0. 0
  libavfilter    5.  0. 0 /  5.  0. 0
  libavresample  2.  1. 0 /  2.  1. 0
  libswscale     3.  0. 0 /  3.  0. 0
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set libav* logging level) with argument 'debug'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'video4linux2'.
Reading option '-i' ... matched as input file with argument '/dev/video0'.
Reading option 'out.mpg' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set libav* logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file /dev/video0.
Applying option f (force format) with argument video4linux2.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2 @ 0x30b200] [4]Capabilities: 84200001
[video4linux2 @ 0x30b200] Querying the device for the current frame size
[video4linux2 @ 0x30b200] Setting frame size to 320x240
[video4linux2 @ 0x30b200] The V4L2 driver changed the pixel format from 0x32315559 to 0x56595559
    Last message repeated 1 times
[video4linux2 @ 0x30b200] The V4L2 driver changed the pixel format from 0x50323234 to 0x56595559
[video4linux2 @ 0x30b200] The V4L2 driver set input_id: 0, input: Camera 1
... Далее висит ...

The processor is loaded by 1%.
With ffmpeg, the situation is exactly the same, except that after Ctrl + C an empty file is created in the output directory.
How can you make it work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Ilinykh, 2016-07-05
@greyhard

I record video like this, from a camera connected via USB Logitech
/usr/bin/avconv -f video4linux2 -r 12 -i /dev/video0 -strict experimental -vcodec mpeg4 -y video.avi

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question