Download http stream to local disk and play from downloading location

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

Download http stream to local disk and play from downloading location

Bhavya
Hi Guys,

I am trying to download and play http stream simultaneously

Download http stream

gst-launch-0.10 souphttpsrc location=http://192.168.0.144/Test.avi ! queue2 ! filesink location=Download.avi

Meanwhile through other pipeline start playback from downloading location

gst-launch-0.10 filesrc location=Download.avi ! avidemux name=demux demux. ! queue ! ffdec_h264 ! autovideosink demux. ! queue ! ffdec_mp3 ! alsasink

Now problem with above logic is, video doesn't play completely.

Is this because filesrc caches entire file when pipeline set to play, so data downloaded until that is played?  OR
Do we need to set some property of filesink to make sure it as written to actual location?
Reply | Threaded
Open this post in threaded view
|

Re: Download http stream to local disk and play from downloading location

Ian Davidson
My understanding is that the AVI format has important information
written as a trailer at the end of the file.  In that case, playback
cannot begin until the entire file has been downloaded.

Ian

On 26/06/2015 14:25, Bhavya wrote:

> Hi Guys,
>
> I am trying to download and play http stream simultaneously
>
> Download http stream
>
> gst-launch-0.10 souphttpsrc location=http://192.168.0.144/Test.avi ! queue2
> ! filesink location=Download.avi
>
> Meanwhile through other pipeline start playback from downloading location
>
> gst-launch-0.10 filesrc location=Download.avi ! avidemux name=demux demux. !
> queue ! ffdec_h264 ! autovideosink demux. ! queue ! ffdec_mp3 ! alsasink
>
> Now problem with above logic is, video doesn't play completely.
>
> Is this because filesrc caches entire file when pipeline set to play, so
> data downloaded until that is played?  OR
> Do we need to set some property of filesink to make sure it as written to
> actual location?
>
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Download-http-stream-to-local-disk-and-play-from-downloading-location-tp4672469.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Download http stream to local disk and play from downloading location

Bhavya
Thanks for response.  Is there any alternative option to achieve progressive download while streaming? Tried with tee element, but in this case if seek to some position is requested by application, then data dumped into file wont be continuous.
Reply | Threaded
Open this post in threaded view
|

Re: Download http stream to local disk and play from downloading location

Bhavya
Also Even while downloading, duration remains same throughout playback                    

LOG_MP::Thread: 1689 :: vGstPlayStream::11893::total duration Time: 0:00:30.746122448
LOG_MP::Thread: 1689 :: vGstPlayStream::11901::current time: 0:00:00.510583333

But  Works fine with MP3 Audio with ID3Version 2 Tag.(Is this because as u said header info is at starting of file).

LOG_MP::Thread: 1679 :: vGstPlayStream::11893::total duration Time: 1:54:51.221000000
LOG_MP::Thread: 1679 :: vGstPlayStream::11901::current time: 0:00:11.806622448
LOG_MP::Thread: 1679 :: vGstPlayStream::11893::total duration Time: 2:08:51.423000000
LOG_MP::Thread: 1679 :: vGstPlayStream::11901::current time: 0:00:12.015601615
LOG_MP::Thread: 1679 :: vGstPlayStream::11893::total duration Time: 2:08:51.423000000
LOG_MP::Thread: 1679 :: vGstPlayStream::11901::current time: 0:00:12.224580781

My doubt is duration is computed based on average bit rate and size right? shouldn't it vary as file size changes?
Reply | Threaded
Open this post in threaded view
|

Re: Download http stream to local disk and play from downloading location

Tim Müller
In reply to this post by Bhavya
On Fri, 2015-06-26 at 06:25 -0700, Bhavya wrote:

Hi,

> I am trying to download and play http stream simultaneously
>
> Download http stream
>
> gst-launch-0.10 souphttpsrc location=http://192.168.0.144/Test.avi ! queue2
> ! filesink location=Download.avi
>
> Meanwhile through other pipeline start playback from downloading location
>
> gst-launch-0.10 filesrc location=Download.avi ! avidemux name=demux demux. !
> queue ! ffdec_h264 ! autovideosink demux. ! queue ! ffdec_mp3 ! alsasink
>
> Now problem with above logic is, video doesn't play completely.
>
> Is this because filesrc caches entire file when pipeline set to play, so
> data downloaded until that is played?  OR
> Do we need to set some property of filesink to make sure it as written to
> actual location?

GStreamer 0.10 is pretty ancient and no longer maintained. I would
suggest you switch to GStreamer 1.x.

In recent GStreamer 1.x versions there's an element called
'downloadbuffer' which should do what you want.

The old queue2 element can do something similar if you set the
temp-location property, but it won't do things like 'fill holes' in the
file automatically if there's nothing else to do.

Cheers
 -Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Download http stream to local disk and play from downloading location

Bhavya
Hi Tim,

Thanks for your reply, I have a doubt regarding downloadbuffer usage.
In my requirement on-disk buffering is done to download complete file, so that if i want to play same song again i would prepare playing it from downloaded location instead from server. Can this be achieved using downloadbuffer because if i seek to some position, data downloaded using downloadbuffer might not have the continuous data.

Regards,
Bhavya
Reply | Threaded
Open this post in threaded view
|

Re: Download http stream to local disk and play from downloading location

Bhavya
Hi All,

I tried using multifilesrc and multifilesink element.

Download file into multiple file. So that downloaded chunk will be played. But it works fine only if all chunks are downloaded before starting playback.

0:02:23.800394349  1912   0x21c120 WARN               aiurdemux aiurdemux.c:3977:aiurdemux_loop_state_movie: API[getFileNextSample] failed, ret
=-11
0:02:23.800560349  1912   0x21c120 WARN               aiurdemux aiurdemux.c:1326:aiurdemux_send_stream_eos: Pad video: Send eos.
0:02:23.800815683  1912   0x21c120 WARN               aiurdemux aiurdemux.c:1326:aiurdemux_send_stream_eos: Pad audio: Send eos.

Please help me out. I m confused whether i am proceeding in right direction or not. Thanks
Vnd
Reply | Threaded
Open this post in threaded view
|

Re: Download http stream to local disk and play from downloading location

Vnd
Hi,

Split the pipeline after the source, tee element will do this job for you.
Input buffers will be passed to both file sink and decode branch pipeline by tee element..


gst-launch-0.10 souphttpsrc location=http://192.168.0.144/Test.avi ! tee name=split  \
split. ! queue ! filesink location=Download.avi \
split. ! queue  ! avidemux name=demux demux. ! queue ! ffdec_h264 ! autovideosink demux. ! queue ! ffdec_mp3 ! alsasink


If you are using downloadbuffer element set max-size-bytes property to high value so that entire file will be stored in single file. Provided input file is not more than max-size-bytes.

~ Vinod