Re: How to reuse pipeline to read different mp4 files. Few questions.

Антон Шаров sharov_am at mail.ru
Wed Aug 9 09:37:48 UTC 2023


Hi, thank you for reply!
 
Here is my code for now:
   foreach (var videoFile in videoFiles)
            {
                fileSrc["location"] = videoFile;
 
                readerPipe.SetState(State.Playing);
 
                var step = 1; //fn тоже с 1 начинается
                while (step < frameNumber)
                {
                    appSink.PullSample();
                    step++;
                }
 
                Debug.SetDefaultThreshold(DebugLevel.Debug);
 
                readerPipe.SetState(State.Null);
                fileSrc.Unlink(decodebin);
 
                fileSrc.Link(decodebin);
            }
        }
 
Still it hangs on SetState(State.Null) with continous messages:
0:00:48.596434300 DEBUG             bufferpool gstbufferpool.c:312:do_alloc_buffer:<d3d11bufferpool2> max buffers reached
0:00:48.597077100DEBUG               GST_POLL gstpoll.c:1414:gst_poll_wait: 000001F550D09AE0: timeout :99:99:99.999999999
 
It seems to be the reason of hang behaviour. I’ve added queue before appsink (filesrc ! decodebin ! queue ! appsink),
but still no luck. 
>Вторник, 8 августа 2023, 20:55 +03:00 от cfd new <newcfd at yahoo.com>:
> 
> 
>for question 1:
>Steps:
>1. set pipeline state to null
>2. disconnect  decodebin ! appsink from  filesrc
>3. set new location to filesrc
>4. reconnect  decodebin ! appsink to  filesrc
>5. set pipeline state to play
>On Monday, August 7, 2023, 08:45:50 a.m. EDT, Антон Шаров via gstreamer-devel < gstreamer-devel at lists.freedesktop.org > wrote:
> 
> 
>Hi.
> 
>I have following  pipeline filesrc ! decodebin ! appsink
>By some condition I need to exctract some frame (cond. for now is exact frame number):
>(here is code sample on C#)
> 
>  var fileSrc = readerPipe.GetByName("filesrc");
>   fileSrc["location"] = videoFile; // new file to read from
> 
>   var appSink = (AppSink) readerPipe.GetByName("my_appsink");
>   readerPipe.SetName($"file {videoFile} frame_stepper");
>   var q = readerPipe.SetState(State.Playing);
>   var step = 1;
>   while (step < frameNumber)
>        {
>            appSink.PullSample();
>            step++;
>        }
> 
>The questions:
>*  It seems that it doesn’t matter what video file is set, it will always read from first setuped file. How to reset pipeline to read from new file? Should I create new pipeline or can I reset given pipeline so it can read from given file?
>*  What is the best and fastest pipeline to read frame-by-frame from file ? Maybe the one above is not goot,  maybe playbin + appsink is better?
>Thanks in advance.
> 
>  
 
 
--
С Уважением,
Шаров Антон
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230809/896abd78/attachment-0001.htm>


More information about the gstreamer-devel mailing list