matroskaenc: fix cue tracknum off by 1 error

Fixes out of array accesses

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avformat: Allocate duration_error separately

This significantly reduces the memory needed per AVStream when the
array is not needed.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>