This is an old revision of the document!
FFmpeg is a free software project consisting of a vast software suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the FFmpeg program itself, designed for command-line-based processing of video and audio files, and widely used for format transcoding, basic editing (trimming and concatenation), video scaling, video post-production effects, and standards compliance (SMPTE, ITU). FFmpeg includes libavcodec, an audio/video codec library used by many commercial and free software products, libavformat (Lavf), an audio/video container mux and demux library, and the core ffmpeg command line program for transcoding multimedia files. FFmpeg is published under the GNU Lesser General Public License 2.1+ or GNU General Public License 2+ (depending on which options are enabled).
Ubuntu 14:
apt-get install libav-tools
Ubuntu 15 and newer:
apt-get install ffmpeg
If you need the codecs for “MP3, AAC, AMR, MPEG-4 and H.264 (MPEG-4 AVC)”, install them via
apt-get install libavcodec-extra
Ubuntu 14 uses “avconv”, 15+ uses “ffmpeg”, the parameters are mostly the same.
This is an example code to convert all images in the current folder to an .avi video with 5 frames per second
ffmpeg -f image2 -r 5 -pattern_type glob -i '*.jpg' 5fps.avi
If you consider using this to autogenerate videos via script, you might want to use the following code to mute the output
ffmpeg -f image2 -r 5 -pattern_type glob -i "$PATHJPG/*.jpg" $PATHAVI/movie.avi 2> /dev/null
Full example with output:
> ffmpeg -f image2 -r 5 -pattern_type glob -i '*.jpg' 5fps.avi ffmpeg version 3.2.12-1~deb9u1+rpt1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516 configuration: --prefix=/usr --extra-version='1~deb9u1+rpt1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --arch=armhf --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 34.101 / 55. 34.101 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.101 / 57. 56.101 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libavresample 3. 1. 0 / 3. 1. 0 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 Input #0, image2, from '*.jpg': Duration: 00:00:53.40, start: 0.000000, bitrate: N/A Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 1:1 DAR 16:9], 5 fps, 5 tbr, 5 tbn, 5 tbc [swscaler @ 0x181a2a0] deprecated pixel format used, make sure you did set range correctly Output #0, avi, to '5fps.avi': Metadata: ISFT : Lavf57.56.101 Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 5 fps, 5 tbn, 5 tbc Metadata: encoder : Lavc57.64.101 mpeg4 Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1 Stream mapping: Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg4 (native)) Press [q] to stop, [?] for help frame= 267 fps=1.9 q=31.0 Lsize= 1696kB time=00:00:53.40 bitrate= 260.2kbits/s speed=0.387x video:1684kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.713759%