avformat/movenc: Ensure packet is writable before modifying it

Fixes e.g.

ffmpeg -i fate-suite/h264/bbc2.sample.h264 -c:v rawvideo -map 0:v -frames:v 10 -pix_fmt gray8 -f tee "first.mov|second.mov"

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
release/5.1
Andreas Rheinhardt 3 years ago
parent dc977f94d5
commit a256426411
  1. 3
      libavformat/movenc.c

@ -6513,6 +6513,9 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
} else if (trk->par->codec_id == AV_CODEC_ID_RAWVIDEO &&
(trk->par->format == AV_PIX_FMT_GRAY8 ||
trk->par->format == AV_PIX_FMT_MONOBLACK)) {
ret = av_packet_make_writable(pkt);
if (ret < 0)
goto fail;
for (i = 0; i < pkt->size; i++)
pkt->data[i] = ~pkt->data[i];
}

Loading…
Cancel
Save