mpegtsenc: Only test the first frame for missing h264_mp4toannexb filter.

Many video players accept broken frames in a transport stream, so there
is no reason to abort remuxing when encountering one, just print a
warning instead.

Fixes ticket #1758.
pull/13/merge
Carl Eugen Hoyos 12 years ago
parent 07d405cc9e
commit 8af593dd80
  1. 3
      libavformat/mpegtsenc.c

@ -1095,10 +1095,13 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
uint32_t state = -1; uint32_t state = -1;
if (pkt->size < 5 || AV_RB32(pkt->data) != 0x0000001) { if (pkt->size < 5 || AV_RB32(pkt->data) != 0x0000001) {
if (!st->nb_frames) {
av_log(s, AV_LOG_ERROR, "H.264 bitstream malformed, " av_log(s, AV_LOG_ERROR, "H.264 bitstream malformed, "
"no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)\n"); "no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
av_log(s, AV_LOG_WARNING, "H.264 bitstream error, startcode missing\n");
}
do { do {
p = avpriv_find_start_code(p, buf_end, &state); p = avpriv_find_start_code(p, buf_end, &state);

Loading…
Cancel
Save