Crash fixes and removal if deprecated libav feature.

These commits fix two crashes on exit and remove one usage of av_reverse which for no apparent reason was deprecated by libav developers.