Use avg_frame_rate instead of r_frame_rate

See this thread on why it was removed in libav:
https://lists.libav.org/pipermail/libav-devel/2012-June/029761.html

Furthermore, use new AVFrame API.

Fixes #31.