avformat/assenc: optimize writing dialogs