segment: Free and reinit the muxer before calling avformat_write_header