Re: mplex drops last access unit / frame from input video stream
Darrell Walisser <[email protected]> Wed, 13 Aug 2014 10:32:22 -0400
| Newsgroups | gmane.comp.video.mjpeg.devel |
|---|---|
| Message-ID | <CAPDU3-+eOPAQX2EtmvzXQEE_SZ5q5UPczuR611n=W7ZWrVHkxQ@mail.gmail.com> |
--===============6246021327664448407==
Content-Type: multipart/alternative; boundary=20cf303bfaa6fc4360050083a7df
--20cf303bfaa6fc4360050083a7df
Content-Type: text/plain; charset=UTF-8
I have a modification to the patch. If the stream contains a sequence end,
we probably do not want it to include anything following the sequence end
in the input. This caused a problem on some of the inputs I tried since
there was one I-frame after the end-sequence header with a wacky SCR in it
so it could not be muxed.
diff -ru mjpegtools-2.0.0/mplex/videostrm_in.cpp
mjpegtools/mplex/videostrm_in.cpp
--- mjpegtools-2.0.0/mplex/videostrm_in.cpp 2005-12-09 15:05:26 -0500
+++ mjpegtools/mplex/videostrm_in.cpp 2014-08-13 10:25:27 -0400
@@ -314,6 +314,30 @@
}
}
+ // make sure the last AU gets added at the end of the stream,
+ // unless the stream contains a sequence end header
+ if (bs.eos() && AU_pict_data && num_seq_end == 0)
+ {
+ stream_length = bs.bitcount();
+ access_unit.start = AU_start;
+ access_unit.length = static_cast<int>(stream_length - AU_start)>>3;
+ access_unit.end_seq = 0;
+ avg_frames[access_unit.type-1]+=access_unit.length;
+
+ mjpeg_debug( "LAST AU %d %d %d @ %lld: DTS=%ud",
+ decoding_order,
+ access_unit.type,
+ access_unit.length,
+ bs.bitcount() / 8-4,
+ static_cast<unsigned int>(access_unit.DTS/300) );
+
+ aunits.Append( access_unit );
+ decoding_order++;
+ AU_hdr = syncword;
+ AU_start = stream_length;
+ AU_pict_data = 0;
+ }
+
--20cf303bfaa6fc4360050083a7df
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I have a modification to the patch. If the stream contains=
a sequence end, we probably do not want it to include anything following t=
he sequence end in the input. This caused a problem on some of the inputs I=
tried since there was one I-frame after the end-sequence header with a wac=
ky SCR in it so it could not be muxed.<div class=3D"gmail_extra">
<br></div><div class=3D"gmail_extra"><div class=3D"gmail_extra">diff -ru mj=
pegtools-2.0.0/mplex/videostrm_in.cpp mjpegtools/mplex/videostrm_in.cpp</di=
v><div class=3D"gmail_extra">--- mjpegtools-2.0.0/mplex/videostrm_in.cpp =
=C2=A0 =C2=A0 2005-12-09 15:05:26 -0500</div>
<div class=3D"gmail_extra">+++ mjpegtools/mplex/videostrm_in.cpp =C2=A0 201=
4-08-13 10:25:27 -0400</div><div class=3D"gmail_extra">@@ -314,6 +314,30 @@=
</div><div class=3D"gmail_extra">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 }</div><div class=3D"gmail_extra">=C2=A0 =C2=A0 =C2=A0 =C2=A0=
}</div>
<div class=3D"gmail_extra"><br></div><div class=3D"gmail_extra">+ =C2=A0 =
=C2=A0// make sure the last AU gets added at the end of the stream,</div><d=
iv class=3D"gmail_extra">+ =C2=A0 =C2=A0// unless the stream contains a seq=
uence end header</div><div class=3D"gmail_extra">
+ =C2=A0 =C2=A0if (bs.eos() && AU_pict_data && num_seq_end =
=3D=3D 0)</div><div class=3D"gmail_extra">+ =C2=A0 =C2=A0{</div><div class=
=3D"gmail_extra">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0stream_length =3D bs.bitcount=
();</div><div class=3D"gmail_extra">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0access_uni=
t.start =3D AU_start;</div>
<div class=3D"gmail_extra">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0access_unit.length =
=3D static_cast<int>(stream_length - AU_start)>>3;</div><div cl=
ass=3D"gmail_extra">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0access_unit.end_seq =3D 0;=
</div><div class=3D"gmail_extra">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0avg_frames[ac=
cess_unit.type-1]+=3Daccess_unit.length;</div>
<div class=3D"gmail_extra">+</div><div class=3D"gmail_extra">+ =C2=A0 =C2=
=A0 =C2=A0 =C2=A0mjpeg_debug( "LAST AU %d %d %d @ %lld: DTS=3D%ud"=
;,</div><div class=3D"gmail_extra">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 decoding_order,</div><div class=3D"gmail_ex=
tra">
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 acc=
ess_unit.type,</div><div class=3D"gmail_extra">+ =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 access_unit.length,</div><div=
class=3D"gmail_extra">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 bs.bitcount() / 8-4,</div><div class=3D"gmail_extra">+=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 stat=
ic_cast<unsigned int>(access_unit.DTS/300) );</div>
<div class=3D"gmail_extra">+</div><div class=3D"gmail_extra">+ =C2=A0 =C2=
=A0 =C2=A0 =C2=A0aunits.Append( access_unit );</div><div class=3D"gmail_ext=
ra">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0decoding_order++;</div><div class=3D"gmail=
_extra">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0AU_hdr =3D syncword;</div><div class=
=3D"gmail_extra">
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0AU_start =3D stream_length;</div><div class=3D=
"gmail_extra">+ =C2=A0 =C2=A0 =C2=A0 =C2=A0AU_pict_data =3D 0;</div><div cl=
ass=3D"gmail_extra">+ =C2=A0 =C2=A0}</div><div class=3D"gmail_extra">+</div=
><div><br></div><br></div></div>
--20cf303bfaa6fc4360050083a7df--
--===============6246021327664448407==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
--===============6246021327664448407==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Mjpeg-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mjpeg-developer
--===============6246021327664448407==--