[FFmpeg-devel] [PATCH]Only test the first frame for malformed bitstreams
Michael Niedermayer
michaelni at gmx.at
Mon Mar 25 00:39:17 CET 2013
On Mon, Mar 25, 2013 at 12:03:25AM +0100, Carl Eugen Hoyos wrote:
> Hi!
>
> Currently, the mpegts, the flv and the mov muxer test every h264 / aac frame
> for a missing bitstream filter, making remuxing of broken streams impossible.
>
> Testing only the first frame should be sufficient to inform the user of a
> missing bitstream filter.
>
> Attached patches fix tickets #1758 and #2380, I tested the remuxed files
> successfully with WMP and QT.
>
> Please review, Carl Eugen
> mpegtsenc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> bdc3c59730f4da7cb36f7709b42a418574f4afeb patch264ts.diff
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index 7016774..617b9a7 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -1093,7 +1093,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
> const uint8_t *p = buf, *buf_end = p+size;
> uint32_t state = -1;
>
> - if (pkt->size < 5 || AV_RB32(pkt->data) != 0x0000001) {
> + if (!st->codec->frame_number && (pkt->size < 5 || AV_RB32(pkt->data) != 0x0000001)) {
> av_log(s, AV_LOG_ERROR, "H.264 bitstream malformed, "
> "no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)\n");
> return AVERROR(EINVAL);
at least a warning should still be printed also
st->nb_frames seems more correct than st->codec->frame_number if
it works
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130325/e8f94f2c/attachment.asc>
More information about the ffmpeg-devel
mailing list