Manual installation

Some users may wish to skip the package or AUR and compile FFmpeg themselves from its git master directly, and add /usr/local/lib to /etc/ld.so.conf. This can cause the /usr/bin/ffmpeg tool provided by ffmpeg to crash or work improperly due to the library version mismatch. (Frequently ffmpeg is still installed as a dependency.) One fix for this is to add /usr/lib to the rpath of /usr/bin/ffmpeg with a tool such as patchelf:

# patchelf --set-rpath /usr/lib /usr/bin/ffmpeg

This will be revoked whenever ffmpeg is reinstalled or upgraded, so adding a pacman hook might be prudent:

You may want to adjust the parameters (left-to-right): input format, [input]size, framerate, input (in this case display, but could be a file too), input format, input, codec:video, bitrate:video, [output]size of output. Without context the meaning of the parameters may seem ambigious. See the manpage for the synopsis.

Recording webcam

FFmpeg supports grabbing input from Video4Linux2 devices. The following command will record a video from the webcam, assuming that the webcam is correctly recognized under /dev/video0:

$ ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 output.mkv

The above produces a silent video. It is also possible to include audio sources from a microphone. The following command will include a stream from the default ALSA recording device into the video:

x264: constant rate factor

Used when you want a specific quality output. General usage is to use the highest -crf value that still provides an acceptable quality. Lower values are higher quality; 0 is lossless, 18 is visually lossless, and 23 is the default value. A sane range is between 18 and 28. Use the slowest -preset you have patience for. See the x264 Encoding Guide for more information.

Tip: If you receive Unknown encoder 'libvo-aacenc' error (given the fact that your ffmpeg is compiled with libvo-aacenc enabled), you may want to try -acodec libvo_aacenc, an underscore instead of hyphen.

Two-pass MPEG-4 (very high-quality)

Audio deactivated as only video statistics are logged during the first of multiple pass runs:

Second pass

The second pass parses the stabilization parameters generated from the first pass and applies them to produce "output-stab_final". You will want to apply any additional filters at this point so as to aboid subsequent transcoding to preserve as much video quality as possible. The following example performs the following in addition to video stabilization:

unsharp is recommended by the author of vid.stab. Here we are simply using the defaults of 5:5:1.0:5:5:1.0

Tip: fade=t=in:st=0:d=4

fade in from black starting from the beginning of the file for four seconds

Tip: fade=t=out:st=60:d=4

fade out to black starting from sixty seconds into the video for four seconds

-c:a pcm_s16le XAVC-S codec records in pcm_s16be which is losslessly transcoded to pcm_s16le

Hardware acceleration

Warning: Encoding may fail when using hardware acceleration, use software encoding as a fallback.

Encoding performance may be improved by using hardware acceleration API's, however only a specific kind of codec(s) are allowed and/or may not always produce the same result when using software encoding.

FFserver

The FFmpeg package includes FFserver, which can be used to stream media over a network. To use it, you first need to create the config file /etc/ffserver.conf to define your feeds and streams. Each feed specifies how the media will be sent to ffserver and each stream specifies how a particular feed will be transcoded for streaming over the network. You can start with the sample configuration file or check ffserver(1) for feed and stream examples. Here is a simple configuration file for streaming flash video: