From 249d3cadc56cfaf74d68e28dfde7595884114b30 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 21 Sep 2016 12:17:09 -0400 Subject: [PATCH] fix for video on stream 1 --- src/zm_videostore.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index d59a9b467..d9a6507b7 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -272,7 +272,15 @@ int VideoStore::writeVideoFramePacket(AVPacket *ipkt, AVStream *input_st){//, AV opkt.data = ipkt->data; opkt.size = ipkt->size; - opkt.stream_index = ipkt->stream_index; + + // Some camera have audio on stream 0 and video on stream 1. So when we remove the audio, video stream has to go on 0 + if ( ipkt->stream_index > 0 and ! audio_stream ) { + Debug(1,"Setting stream index to 0 instead of %d", ipkt->stream_index ); + opkt.stream_index = 0; + } else { + opkt.stream_index = ipkt->stream_index; + } + /*opkt.flags |= AV_PKT_FLAG_KEY;*/ if (video_st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (fmt->flags & AVFMT_RAWPICTURE)) {