Read frame by frame mp4 file, need example.

Nicolas Dufresne nicolas at ndufresne.ca
Wed Jul 26 19:42:18 UTC 2023


Hi,

Le mercredi 26 juillet 2023 à 18:48 +0300, Антон Шаров via gstreamer-devel a
écrit :
> Hi.
>  
> Where I can find example of reading mp4 file frame by frame, so it was
> equivalent to OpenCv code like:

The question is ambiguous, since MP4 containers can contains multiple streams
and metadata. Do you want to read each video frame of the first video frame ? Do
you want these to be coded or decoded ? All this is important, because before
pulling this data into your application (I would suggesting using appsink
element), you will have to design the right pipeline.

Nicolas

>  
> while(cap.isOpened()):
>   # Capture frame-by-frame
>    ret, frame = cap.read()
>  
> I saw this frame stepping
> example https://fossies.org/linux/gstreamer/tests/examples/stepping/framestep1.c
> and .  I’ve tried to recreate this example on gstreamer-sharp and here is my
> approach:
> https://gist.github.com/sharov-am/78949b8866235ca14112818385893152

Frame stepping is unlikely what you are a looking for.

>  
> And of course it doesn’t work. I’ve read this doc
> (https://gstreamer.freedesktop.org/documentation/additional/design/framestep.html?gi-language=c#frame-stepping
> )
> and got from it that there are two main very important parameters like flush
> and intermediate and sequnce of events:
> 2 step start and 1 step done. Also I expected that appsink preroll or new-
> sample event would be raised, but nothing
> happens.
>  
> My expectations are: I raise step event, some machinery happens and eventually
> I handle appsink preroll or new-sample
> events with needed frame buffer with actual frame. And it continues till EOS
> (end of file).
> So, what I’m doing wrong?
>  
> Also, I’ve noticed that my pipe has WARN messages like
>  
> WARN                 basesrc gstbasesrc.c:3132:gst_base_src_loop:<filesrc>
> error: Internal data stream error.
> WARN                 basesrc gstbasesrc.c:3132:gst_base_src_loop:<filesrc>
> error: streaming stopped, reason not-linked (-1)
> but I’m not sure that this is the cause…
> 
> Thanks in advance.
>  
>  
>  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230726/507815e1/attachment-0001.htm>


More information about the gstreamer-devel mailing list