frame: fix the error path in av_frame_copy_props()

First free metadata, then the side data it is contained in.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
matroskaenc: base DefaultDuration on the framerate, not the codec timebase

This results in DefaultDuration not being written when the framerate is
not known, but as this field is purely informative, this should not
break any sane demuxers.
movenc: write avg_frame_rate as the framerate, not the codec timebase
flvenc: only write the framerate tag based on avg_frame_rate

Do not fall back on the codec timebase, since that can be anything for
VFR video.
matroskaenc: set the stream timebase earlier

Fixes calculating the ts offset for audio codecs with delay.