Help on souphttpsrc

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

Help on souphttpsrc

snvd1
Hi ,

I'm creating a video player that can stream video from the internet, and performs seeking on the stream. Somebody indicates souphttpsrc is the solution but it doesn't work for me, my code looks like the beloow, when I call  gst_element_seek_simple(pipeline, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, 5*GST_SECOND), it always fails, please please help.

Thanks so much,
snv


{
   pipeline   = gst_pipeline_new("pipeline");
   src = gst_element_factory_make ("souphttpsrc", "mysrc");
   g_object_set(src, "location", "http://", NULL);
    g_object_set (src, "automatic-redirect", TRUE, NULL);

       queue       = gst_element_factory_make("queue", "vqueue");
       flt         = gst_element_factory_make("capsfilter", "vfilter");
       conv        = gst_element_factory_make("ffmpegcolorspace", "vconv");
       scale       = gst_element_factory_make("videoscale", "vscale");
       vsink       = gst_element_factory_make("xvimagesink", "vsink");

   decodebin  = gst_element_factory_make("decodebin", "decoder");
   g_signal_connect(decodebin, "new-decoded-pad", G_CALLBACK(new_decoded_pad_cb), NULL);

       gst_bin_add_many(GST_BIN(pipeline), src, decodebin, queue, scale, conv, flt, vsink, NULL);

   gst_element_link(src, decodebin);
   gst_element_link_many(queue, scale, conv, flt, vsink, NULL);

   gst_element_set_state(pipeline, GST_STATE_PLAYING);
   g_timeout_add (1000, (GSourceFunc) cb_print_position, pipeline);

   g_main_loop_run(loop);

   /* cleanup */
   gst_element_set_state(pipeline, GST_STATE_NULL);
   gst_object_unref(GST_OBJECT(pipeline));
}


static void
new_decoded_pad_cb(GstElement *decoder, GstPad     *new_pad,
                  gboolean    last,  gpointer    user_data)
{
   GstCaps *caps;
   gchar   *str;


   caps = gst_pad_get_caps(new_pad);
   str = gst_caps_to_string(caps);

   /* video stream */
   if (g_str_has_prefix(str, "video/")) {
       GstPad             *videopad;
       GstCaps            *filtercaps;
       //videopad = gst_element_get_pad(queue, "sink");
       GstElement *vbin = gst_bin_get_by_name(GST_BIN(pipeline),"vqueue");
       videopad = gst_element_get_pad (vbin, "sink");
       gst_pad_link(new_pad, videopad);
       gst_object_unref(videopad);
   }
}

Reply | Threaded
Open this post in threaded view
|

Re: Help on souphttpsrc

Tim-Philipp Müller-2
On Mon, 2009-06-15 at 16:39 -0700, snvd1 wrote:

> I'm creating a video player that can stream video from the internet, and
> performs seeking on the stream. Somebody indicates souphttpsrc is the
> solution but it doesn't work for me, my code looks like the beloow, when I
> call  gst_element_seek_simple(pipeline, GST_FORMAT_TIME,
> GST_SEEK_FLAG_FLUSH, 5*GST_SECOND), it always fails, please please help.

Whether seeking over http will work depends mostly on (a) the type of
stream/file (live broadcast, static file download?) (b) the server (does
it support seeking, does it supply the content length?) (c) the
demuxer/parser in question (ie. the file format of the stream).

So hard to say more without more information.

 Cheers
  -Tim



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Help on souphttpsrc

snvd1
Hi Tim, thanks for replay.

The url I tested is a google video, which is progressive downloading. When I set debug-level=5, I can see that the seeking is successful from souphttpsrc, but playing after seeking freezes. I use seek-by-bytes and give a random number. To your question (c), do you mean demuxer/parser in my pipeline? My pipeline is:

souphttpsrc name=mysrc ! decodebin2 name=decoder decoder. ! queue ! audioconvert ! audioresample ! osssink decoder. ! ffmpegcolorspace ! xvimagesink

Do you see problems in my pipeline?

Thanks so much for your help,
snv


Tim-Philipp Müller wrote
On Mon, 2009-06-15 at 16:39 -0700, snvd1 wrote:

> I'm creating a video player that can stream video from the internet, and
> performs seeking on the stream. Somebody indicates souphttpsrc is the
> solution but it doesn't work for me, my code looks like the beloow, when I
> call  gst_element_seek_simple(pipeline, GST_FORMAT_TIME,
> GST_SEEK_FLAG_FLUSH, 5*GST_SECOND), it always fails, please please help.

Whether seeking over http will work depends mostly on (a) the type of
stream/file (live broadcast, static file download?) (b) the server (does
it support seeking, does it supply the content length?) (c) the
demuxer/parser in question (ie. the file format of the stream).

So hard to say more without more information.

 Cheers
  -Tim



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Help on souphttpsrc

Arnout Vandecappelle
In reply to this post by snvd1
On Tuesday 16 June 2009 01:39:52 snvd1 wrote:
> I'm creating a video player that can stream video from the internet, and
> performs seeking on the stream. Somebody indicates souphttpsrc is the
> solution but it doesn't work for me, my code looks like the beloow, when I
> call  gst_element_seek_simple(pipeline, GST_FORMAT_TIME,
> GST_SEEK_FLAG_FLUSH, 5*GST_SECOND), it always fails, please please help.

 souphttpsrc only supports seeking in bytes, not in time, so unless there is
some element in the pipeline (a demuxer, most likely) that knows how to
convert the time to bytes, soup httpsrc won't help.  How is the stream muxed?

 Also, as Tim indicated, the server must support seeking.  A quick way to test
this is to wget the URL and see if the size is reported before it starts
downloading.  If it isn't, seeking almost certainly doesn't work.


>    g_object_set(src, "location", "http://", NULL);

 I do hope there is some real URL here, because this obviously won't work...

 Regards,
 Arnout
--
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  D206 D44B 5155 DF98 550D  3F2A 2213 88AA A1C7 C933

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Help on souphttpsrc

snvd1
Hi Arnout, thanks for help.

I did change seeking by bytes, now the seeking is successful, but playing after that freezes. The URL is too long, so I did put in my original post, I tested it with wget as you adviced, len is reported, here is the URL:

http://vp.video.google.com:80/videodownload?version=0&secureurl=pwAAALxRpszUgTK_K_xaZ04iy5twIwiMBWR6G-P45DX_bflgErWPVfqlFRpAIRXPH0_f_S-vjr5fsjelV_b5a60KGO9-J5oM9waHrXbIp9TGcWil_918u10kdE07KD02uypssqtNkGBYhLcEBNsiUOVTSQesba0hY6i9lc5MslYTZmYH-KQCUNwMPL-Atkb15uIOeyUgx6uFXC-CGZLBbGzc-v99UGEyk_rCk0JSgNwzOdmX&sigh=5MvtdS0Pg_tizyUqpTRfwhK0Smk&begin=0&len=219000&docid=-3666353226986284383&client=655722610335

You and Tim both mentioned demuxer, I use decodebin, my pipeline looks like:

souphttpsrc  ! decodebin name=decoder decoder. ! queue ! audioconvert ! audioresample ! osssink decoder. ! videoscale ! ffmpegcolorspace ! xvimagesink

Do you see any problem in this pipeline?

Thanks so much for your help
snv


Arnout Vandecappelle wrote
On Tuesday 16 June 2009 01:39:52 snvd1 wrote:
> I'm creating a video player that can stream video from the internet, and
> performs seeking on the stream. Somebody indicates souphttpsrc is the
> solution but it doesn't work for me, my code looks like the beloow, when I
> call  gst_element_seek_simple(pipeline, GST_FORMAT_TIME,
> GST_SEEK_FLAG_FLUSH, 5*GST_SECOND), it always fails, please please help.

 souphttpsrc only supports seeking in bytes, not in time, so unless there is
some element in the pipeline (a demuxer, most likely) that knows how to
convert the time to bytes, soup httpsrc won't help.  How is the stream muxed?

 Also, as Tim indicated, the server must support seeking.  A quick way to test
this is to wget the URL and see if the size is reported before it starts
downloading.  If it isn't, seeking almost certainly doesn't work.


>    g_object_set(src, "location", "http://", NULL);

 I do hope there is some real URL here, because this obviously won't work...

 Regards,
 Arnout
--
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  D206 D44B 5155 DF98 550D  3F2A 2213 88AA A1C7 C933

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Help on souphttpsrc

snvd1
I find that for the mp4 stream I use, qtdemux is selected.  qtdemux doesn't seek in push mode, but souphttpsrc is a pushsrc. Is there a solution for this if I really want to do seeking on mp4 streams.

Thanks for your help,
snv


snvd1 wrote
Hi Arnout, thanks for help.

I did change seeking by bytes, now the seeking is successful, but playing after that freezes. The URL is too long, so I did put in my original post, I tested it with wget as you adviced, len is reported, here is the URL:

http://vp.video.google.com:80/videodownload?version=0&secureurl=pwAAALxRpszUgTK_K_xaZ04iy5twIwiMBWR6G-P45DX_bflgErWPVfqlFRpAIRXPH0_f_S-vjr5fsjelV_b5a60KGO9-J5oM9waHrXbIp9TGcWil_918u10kdE07KD02uypssqtNkGBYhLcEBNsiUOVTSQesba0hY6i9lc5MslYTZmYH-KQCUNwMPL-Atkb15uIOeyUgx6uFXC-CGZLBbGzc-v99UGEyk_rCk0JSgNwzOdmX&sigh=5MvtdS0Pg_tizyUqpTRfwhK0Smk&begin=0&len=219000&docid=-3666353226986284383&client=655722610335

You and Tim both mentioned demuxer, I use decodebin, my pipeline looks like:

souphttpsrc  ! decodebin name=decoder decoder. ! queue ! audioconvert ! audioresample ! osssink decoder. ! videoscale ! ffmpegcolorspace ! xvimagesink

Do you see any problem in this pipeline?

Thanks so much for your help
snv


Arnout Vandecappelle wrote
On Tuesday 16 June 2009 01:39:52 snvd1 wrote:
> I'm creating a video player that can stream video from the internet, and
> performs seeking on the stream. Somebody indicates souphttpsrc is the
> solution but it doesn't work for me, my code looks like the beloow, when I
> call  gst_element_seek_simple(pipeline, GST_FORMAT_TIME,
> GST_SEEK_FLAG_FLUSH, 5*GST_SECOND), it always fails, please please help.

 souphttpsrc only supports seeking in bytes, not in time, so unless there is
some element in the pipeline (a demuxer, most likely) that knows how to
convert the time to bytes, soup httpsrc won't help.  How is the stream muxed?

 Also, as Tim indicated, the server must support seeking.  A quick way to test
this is to wget the URL and see if the size is reported before it starts
downloading.  If it isn't, seeking almost certainly doesn't work.


>    g_object_set(src, "location", "http://", NULL);

 I do hope there is some real URL here, because this obviously won't work...

 Regards,
 Arnout
--
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  D206 D44B 5155 DF98 550D  3F2A 2213 88AA A1C7 C933

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel