- if (s->oformat->codec_tag) {
- if (st->codec->codec_tag && st->codec->codec_id == AV_CODEC_ID_RAWVIDEO && av_codec_get_tag(s->oformat->codec_tag, st->codec->codec_id) == 0 && !validate_codec_tag(s, st)) {
- //the current rawvideo encoding system ends up setting the wrong codec_tag for avi, we override it here
- st->codec->codec_tag = 0;
+ if (of->codec_tag) {
+ if (codec->codec_tag &&
+ codec->codec_id == AV_CODEC_ID_RAWVIDEO &&
+ !av_codec_get_tag(of->codec_tag, codec->codec_id) &&
+ !validate_codec_tag(s, st)) {
+ // the current rawvideo encoding system ends up setting
+ // the wrong codec_tag for avi, we override it here
+ codec->codec_tag = 0;