[FFmpeg-devel] [PATCH]lavc/h264_mp4toannexb: Do not fail if frame already starts with startcode
Carl Eugen Hoyos
cehoyos at ag.or.at
Sat Mar 26 10:18:41 CET 2016
Hi!
The h264_mp4toannexb filter already does not fail if no extradata
is provided. Attached patch makes it also not fail if extradata
was provided but the stream is already in Annex B format.
Fixes ticket #5380.
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c
index 2d447f7..170db31 100644
--- a/libavcodec/h264_mp4toannexb_bsf.c
+++ b/libavcodec/h264_mp4toannexb_bsf.c
@@ -167,7 +167,8 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
int ret = 0;
/* nothing to filter */
- if (!avctx->extradata || avctx->extradata_size < 6) {
+ if ( !avctx->extradata || avctx->extradata_size < 6
+ || !buf[0] && !buf[1] && (buf[2] == 1 || !buf[2] && buf[3] == 1)) {
*poutbuf = (uint8_t *)buf;
*poutbuf_size = buf_size;
return 0;
More information about the ffmpeg-devel
mailing list