[gst-devel] How to make typefind drop data?

Michael Smith msmith at xiph.org
Wed Oct 15 18:24:13 CEST 2008


On Wed, Oct 15, 2008 at 6:18 AM, Arnout Vandecappelle <arnout at mind.be> wrote:
>  Hoi,
>
>  I'm trying to push an MPEG4 stream from a JVC camera into my GStreamer
> pipeline.  However, this camera does not start the stream on a keyframe
> boundary, but just starts emitting the current P frame.  The headers are
> therefore not recognized by typefind, and typefind returns an error.
>
>  I would now like to drop data (buffers or bytes) until typefind does
> recognize the MPEG4 stream start.  How should I implement this?  I see the
> following options:
>
>  - In mpeg4_video_type_find(), be less picky about the start codes, i.e.
> accept an isolated B-frame start code as well.

This is probably the best option.


>  - Make mpeg4_video_type_find() look ahead more, cfr.
> mpeg_video_stream_type_find().

This might be worth doing _in addition_ to the first one.

You'll need to be very careful to not trigger false positives when
doing stuff like this though.

>  The first two cases don't actually skip over the unrecognized part.  This
> happens to be OK for the MPEG4 decoder, but results in some leading garbage
> in the output (it assumes a gray reference frame).  It would be nice if it
> were possible for typefind to also indicate an offset at which it detected
> the type found, and give the application the option to skip over leading
> garbage.  That would be a major overhaul, though...

That's a bug in the MPEG-4 decoder - it should drop data until it gets
a keyframe (although an optional mode to do what it's currently doing
might be good for some uses).

Mike




More information about the gstreamer-devel mailing list