<HTML><BODY><div>Thank you for reply, Nicolas!</div><div> </div><div>>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.</div><div> </div><div>I don’t quite understand your clarification because I’m quite new to this domain. I split rtsp stream into mp4 files via</div><div>rtsp ! h264depay ! h264parse ! splitmuxsink location=… max-time-size=5 seconds .</div><div>Given camera with 15 fps and ~5 sec. video I suppose that I need to iterate over 75 frames. So it is unclear to me what you mean by «video frame of the first frame». Keyframe and it’s subframes or I-frame and sequential p-frames or all GOP’s in a file. I need to extract timestamp for each frame and find the most accurate frame for a given timestamp.</div><div>My pipe for this is filesrc ! decodebin ! appsink, where I hope to handle new-sample or preroll event for each frame (buffer contents == frame).</div><div> </div><div>>Frame stepping is unlikely what you are a looking for.</div><div> </div><div>I supposed that it means just manual iteration over frames in video file — step by step. Like loop with opencv. </div><div> </div><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">Среда, 26 июля 2023, 22:42 +03:00 от Nicolas Dufresne <nicolas@ndufresne.ca>:<br> <div id=""><div class="js-helper js-readmsg-msg"><div><div id="style_16904005412054447954_BODY"><div class="cl_424004"><div>Hi,</div><div> </div><div>Le mercredi 26 juillet 2023 à 18:48 +0300, Антон Шаров via gstreamer-devel a écrit :</div><blockquote type="cite" style="margin:0 0 0 .8ex;border-left:2px #729fcf solid;padding-left:1ex"><div>Hi.</div><div> </div><div>Where I can find example of reading mp4 file frame by frame, so it was equivalent to OpenCv code like:</div></blockquote><div> </div><div>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.</div><div> </div><div>Nicolas</div><div> </div><blockquote type="cite" style="margin:0 0 0 .8ex;border-left:2px #729fcf solid;padding-left:1ex"><div><div><div> </div><div>while(cap.isOpened()):</div><div> # Capture frame-by-frame</div><div> ret, frame = cap.read()</div></div></div><div> </div><div>I saw this frame stepping example <a href="https://fossies.org/linux/gstreamer/tests/examples/stepping/framestep1.c" target="_blank">https://fossies.org/linux/gstreamer/tests/examples/stepping/framestep1.c</a></div><div>and . I’ve tried to recreate this example on gstreamer-sharp and here is my approach:</div><div><a href="https://gist.github.com/sharov-am/78949b8866235ca14112818385893152" target="_blank">https://gist.github.com/sharov-am/78949b8866235ca14112818385893152</a></div></blockquote><div> </div><div>Frame stepping is unlikely what you are a looking for.</div><div> </div><blockquote type="cite" style="margin:0 0 0 .8ex;border-left:2px #729fcf solid;padding-left:1ex"><div> </div><div>And of course it doesn’t work. I’ve read this doc (<a href="https://gstreamer.freedesktop.org/documentation/additional/design/framestep.html?gi-language=c#frame-stepping" target="_blank">https://gstreamer.freedesktop.org/documentation/additional/design/framestep.html?gi-language=c#frame-stepping</a>)</div><div>and got from it that there are two main very important parameters like flush and intermediate and sequnce of events:</div><div>2 step start and 1 step done. Also I expected that appsink preroll or new-sample event would be raised, but nothing</div><div>happens.</div><div> </div><div>My expectations are: I raise step event, some machinery happens and eventually I handle appsink preroll or new-sample</div><div>events with needed frame buffer with actual frame. And it continues till EOS (end of file).</div><div><font face="Arial">So, what I’m doing wrong?</font></div><div> </div><div>Also, I’ve noticed that my pipe has WARN messages like</div><div><div> </div><div>WARN basesrc gstbasesrc.c:3132:gst_base_src_loop:<filesrc> error: Internal data stream error.</div><div>WARN basesrc gstbasesrc.c:3132:gst_base_src_loop:<filesrc> error: streaming stopped, reason not-linked (-1)</div></div><div><pre style="-webkit-text-stroke-width:0px; background-color:#ffffff; color:#000000; font-style:normal; font-variant-caps:normal; font-variant-ligatures:normal; font-weight:400; letter-spacing:normal; orphans:2; padding-bottom:0.5em; padding-top:0.5em; text-align:start; text-decoration-color:initial; text-decoration-style:initial; text-decoration-thickness:initial; text-indent:0px; text-transform:none; widows:2; word-spacing:0px"><font face="Arial">but I’m not sure that this is the cause…</font></pre><div><font face="Arial">Thanks in advance.</font></div></div><div> </div><div> </div><div> </div></blockquote><div> </div><div> </div></div></div></div></div></div></blockquote><div> <div> </div><div data-signature-widget="container"><div data-signature-widget="content"><div>--<br>С Уважением,<br>Шаров Антон</div></div></div><div> </div></div></BODY></HTML>