Looping playback of a streamed file.

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Looping playback of a streamed file.

Baldur Gislason
I have an application in which I read mpeg2 transport stream from a file and send it out on UDP.
I'm trying to make it loop the file, so start over from the beginning of the file when the end is reached.
So far I have not been successful in doing this, any suggestions?

Pipeline currently looks like this: filesrc ! mpegtsdemux ! mpegtsmux ! bufresize ! udpsink

I've tried sending seek events to every element in the pipeline and they all either ignore the seek or break.
        if (!gst_element_seek (tp->sink, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
                         GST_SEEK_TYPE_SET, 0,
                         GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE)) {
          l_debug("Seek failed!\n");
If I do this from the signal handler on an "end of stream" event, it will be too late as some of the elements will have received the EOS and shut down, but even if I send the seeks well before the end is reached I've not managed to make it do what I want.

There has to be a way to do this that is cleaner than shutting down, deleting everything and creating a new pipeline!

Baldur

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Looping playback of a streamed file.

qt next
Hi,

I have the same trouble : I am trying to loop an mpeg2 file (local file) and  I have the same seek trouble...


2010/11/5 Baldur Gislason <[hidden email]>
I have an application in which I read mpeg2 transport stream from a file and send it out on UDP.
I'm trying to make it loop the file, so start over from the beginning of the file when the end is reached.
So far I have not been successful in doing this, any suggestions?

Pipeline currently looks like this: filesrc ! mpegtsdemux ! mpegtsmux ! bufresize ! udpsink

I've tried sending seek events to every element in the pipeline and they all either ignore the seek or break.
        if (!gst_element_seek (tp->sink, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
                         GST_SEEK_TYPE_SET, 0,
                         GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE)) {
          l_debug("Seek failed!\n");
If I do this from the signal handler on an "end of stream" event, it will be too late as some of the elements will have received the EOS and shut down, but even if I send the seeks well before the end is reached I've not managed to make it do what I want.

There has to be a way to do this that is cleaner than shutting down, deleting everything and creating a new pipeline!

Baldur

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Looping playback of a streamed file.

Marco Ballesio
In reply to this post by Baldur Gislason
Hi,

On Fri, Nov 5, 2010 at 6:32 PM, Baldur Gislason <[hidden email]> wrote:
I have an application in which I read mpeg2 transport stream from a file and send it out on UDP.
I'm trying to make it loop the file, so start over from the beginning of the file when the end is reached.
So far I have not been successful in doing this, any suggestions?

Pipeline currently looks like this: filesrc ! mpegtsdemux ! mpegtsmux ! bufresize ! udpsink

I've tried sending seek events to every element in the pipeline and they all either ignore the seek or break.
        if (!gst_element_seek (tp->sink, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
                         GST_SEEK_TYPE_SET, 0,
                         GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE)) {
          l_debug("Seek failed!\n");
If I do this from the signal handler on an "end of stream" event, it will be too late as some of the elements will have received the EOS and shut down, but even if I send the seeks well before the end is reached I've not managed to make it do what I want.


Is it out of your scope to wait for the EOS, state change to NULL and then set again the pipeline to PLAYING?

 Alternatively, you could wait for the clip to be played, say, at 95% and then send the seek event. If the clip is longer than 1s  this should avoid the EOS from being propagated.

Regards
 
There has to be a way to do this that is cleaner than shutting down, deleting everything and creating a new pipeline!

Baldur

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Looping playback of a streamed file.

Gruenke, Matt

It seems like you shouldn’t need to go all the way to NULL.  For one thing, this would wipe out the filename supplied to the source.

 

Could a generic bin be created that hides the EOS and the reset of the source & demuxer/parser from the rest of the pipeline?  The bin could use a probe on its ghost pad to look for EOS and either replay the most recent SEEK event received or state-change the elements back to READY and then to PLAYING.

 

 

Matt

 

 


From: Marco Ballesio [mailto:[hidden email]]
Sent: Sunday, November 07, 2010 02:48
To: Discussion of the development of GStreamer
Subject: Re: [gst-devel] Looping playback of a streamed file.

 

Hi,

<snip/>


Is it out of your scope to wait for the EOS, state change to NULL and then set again the pipeline to PLAYING?

<snip/>

 

 

 


------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Looping playback of a streamed file.

Baldur Gislason


On Mon, Nov 8, 2010 at 3:53 AM, Gruenke, Matt <[hidden email]> wrote:

It seems like you shouldn’t need to go all the way to NULL.  For one thing, this would wipe out the filename supplied to the source.

 

Could a generic bin be created that hides the EOS and the reset of the source & demuxer/parser from the rest of the pipeline?  The bin could use a probe on its ghost pad to look for EOS and either replay the most recent SEEK event received or state-change the elements back to READY and then to PLAYING.

 

 

Matt

 

 


From: Marco Ballesio [mailto:[hidden email]]
Sent: Sunday, November 07, 2010 02:48
To: Discussion of the development of GStreamer
Subject: Re: [gst-devel] Looping playback of a streamed file.

 

Hi,

<snip/>


Is it out of your scope to wait for the EOS, state change to NULL and then set again the pipeline to PLAYING?

<snip/>

 

 

 


------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


If I set the state to NULL, the pipeline does not work after setting it back to PLAYING for some reason, the filesrc element blows up:
http://pastebin.com/VyEbwazz
Any ideas?

Baldur

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Looping playback of a streamed file.

Marco Ballesio
Hi,

On Mon, Nov 8, 2010 at 2:12 PM, Baldur Gislason <[hidden email]> wrote:

..snip..


If I set the state to NULL, the pipeline does not work after setting it back to PLAYING for some reason, the filesrc element blows up:
http://pastebin.com/VyEbwazz
Any ideas?

gsttypefindhelper.c:174:helper_find_peek: typefind function returned: wrong-state

As debug states, It looks like some parts of the pipeline have not been set to the proper state yet.

I'm not that good with mpeg-ts, but.. is it doing the same when you're using a more common format? Can you try, for instance, to convert your clip to mp4 or avi and test the same?

Regards
 

Baldur

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Looping playback of a streamed file.

Gruenke, Matt
In reply to this post by Baldur Gislason
RE: [gst-devel] Looping playback of a streamed file.

I actually said DO NOT go all the way to NULL.  If you do, the filesrc will forget the filename.  Any other properties you set should get lost, as well.


Matt


-----Original Message-----
From: Baldur Gislason [[hidden email]]
Sent: Mon 11/8/2010 7:12 AM
To: Discussion of the development of GStreamer
Subject: Re: [gst-devel] Looping playback of a streamed file.

On Mon, Nov 8, 2010 at 3:53 AM, Gruenke, Matt <[hidden email]> wrote:

>  It seems like you shouldn't need to go all the way to NULL.  For one
> thing, this would wipe out the filename supplied to the source.

<snip/>

If I set the state to NULL, the pipeline does not work after setting it back
to PLAYING for some reason, the filesrc element blows up:
http://pastebin.com/VyEbwazz
Any ideas?

Baldur


------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Looping playback of a streamed file.

Marco Ballesio
Hi,

On 11/8/10, Gruenke, Matt <[hidden email]> wrote:
> I actually said DO NOT go all the way to NULL.  If you do, the filesrc will
> forget the filename.  Any other properties you set should get lost, as well.

the log on pastebin says Baldur properly re-set the uri, so imho it is
not because of the transition to NULL in itself that he's getting the
error (but I may be wrong). It would be interesting to get some
verbose debug from the pipeline, especially the typefind element.

Regards

>
>
> Matt
>
>
> -----Original Message-----
> From: Baldur Gislason [mailto:[hidden email]]
> Sent: Mon 11/8/2010 7:12 AM
> To: Discussion of the development of GStreamer
> Subject: Re: [gst-devel] Looping playback of a streamed file.
>
> On Mon, Nov 8, 2010 at 3:53 AM, Gruenke, Matt <[hidden email]> wrote:
>
>>  It seems like you shouldn't need to go all the way to NULL.  For one
>> thing, this would wipe out the filename supplied to the source.
>
> <snip/>
>
> If I set the state to NULL, the pipeline does not work after setting it back
> to PLAYING for some reason, the filesrc element blows up:
> http://pastebin.com/VyEbwazz
> Any ideas?
>
> Baldur
>
>

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Looping playback of a streamed file.

Baldur Gislason
Now I have turned off the typefind so filesrc no longer bombs.
However, when I set the pipeline to NULL or READY and then back to PLAYING, the mux element breaks and starts feeding out (and in) only the audio stream, but no PMT and no video. Looks like it's not resetting like it should when pipeline goes to NULL or something.

Baldur

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Looping playback of a streamed file.

Marco Ballesio
Hi,

On Tue, Nov 9, 2010 at 1:14 PM, Baldur Gislason <[hidden email]> wrote:
Now I have turned off the typefind so filesrc no longer bombs.
However, when I set the pipeline to NULL or READY and then back to PLAYING, the mux element breaks and starts feeding out (and in) only the audio stream, but no PMT and no video. Looks like it's not resetting like it should when pipeline goes to NULL or something.

- have you tried setting the pipeline to PAUSED instead of NULL as Matt suggests?
- are you using a plain playbin2 (I think not)? If not, can you explain us its topology?

Regards
 

Baldur

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Looping playback of a streamed file.

Baldur Gislason
I have not tried setting it to PAUSED as the objective is to start over from the beginning of the file.
I am not using playbin, I am using a hand constructed bin with the following topology:
filesrc -> mpegtsdemux -> mpegtsmux -> bufresize -> udpsink

Baldur

On Tue, Nov 9, 2010 at 12:14 PM, Marco Ballesio <[hidden email]> wrote:
Hi,

On Tue, Nov 9, 2010 at 1:14 PM, Baldur Gislason <[hidden email]> wrote:
Now I have turned off the typefind so filesrc no longer bombs.
However, when I set the pipeline to NULL or READY and then back to PLAYING, the mux element breaks and starts feeding out (and in) only the audio stream, but no PMT and no video. Looks like it's not resetting like it should when pipeline goes to NULL or something.

- have you tried setting the pipeline to PAUSED instead of NULL as Matt suggests?
- are you using a plain playbin2 (I think not)? If not, can you explain us its topology?

Regards
 

Baldur

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Looping playback of a streamed file.

qt next
Hi,

I am investigating using gstreamer in my application instead of directshow ... And I will be very happy to drop directshow !!! But I don't understand why it's so difficult to loop a movie ... It seems a basic feature . Why can't we just to do a seek to start when we intercept EOS ? 



2010/11/9 Baldur Gislason <[hidden email]>
I have not tried setting it to PAUSED as the objective is to start over from the beginning of the file.
I am not using playbin, I am using a hand constructed bin with the following topology:

filesrc -> mpegtsdemux -> mpegtsmux -> bufresize -> udpsink

Baldur


On Tue, Nov 9, 2010 at 12:14 PM, Marco Ballesio <[hidden email]> wrote:
Hi,

On Tue, Nov 9, 2010 at 1:14 PM, Baldur Gislason <[hidden email]> wrote:
Now I have turned off the typefind so filesrc no longer bombs.
However, when I set the pipeline to NULL or READY and then back to PLAYING, the mux element breaks and starts feeding out (and in) only the audio stream, but no PMT and no video. Looks like it's not resetting like it should when pipeline goes to NULL or something.

- have you tried setting the pipeline to PAUSED instead of NULL as Matt suggests?
- are you using a plain playbin2 (I think not)? If not, can you explain us its topology?

Regards
 

Baldur

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Looping playback of a streamed file.

Baldur Gislason
My final result was to destroy the pipeline and create it again at the EOS event. The behavior of the mux element after stopping and going back to PLAYING state was not as desired.
This works for now but I'll probably have to study the mux element better to get the desired functionality in the future.

Baldur

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel