Allow encoding with libx264 via ffmpeg to work

Add a call to avcodec_get_context_defaults3, this sets per-codec default values
and in the case of libx264 will stop VideoWriter::open (with fourcc=x264) from
failing due to libx264 complaining about broken ffmpeg default settings.

Set some additional libx264 encoder parameters.
Add version checks to previous modifications to ffmpeg_cap_impl.hpp

Add version checks around uses of AVCodecID and av_opt_set, since these aren't
defined for older versions of ffmpeg.
Merge pull request #618 from caotto:master