rtsp to html5 video tag

Dimitrios Katsaros patcherwork at gmail.com
Tue Jan 24 09:01:29 UTC 2017


> this is the heart of my question. isn't there any way to use gstreamer to
> put the rtsp stream into a container (or anything else the browser needed)
> and serve to the browser with tcpserversink? i tried mp4mux or splitmuxsink
> in various incantations with various errors.
>

rtsp is a protocol for controlling media across a network. In other words,
the rtsp is the final step for you media pipeline. I am clarifying this
since you are stating that you want to put your rtsp stream into a
container, something that can not/should not be done. This might be a
mistake but if you are confused about this it may be why you are having
trouble transmitting data.

The normal order of tramsmission of media is raw media -> encoded media ->
encoded media wrapped in a container -> media bundled in a network
transmission protocol -> transfer across the wire. RTSP is nedded for
transmission using udp.If you want to transmit a container format without
using a network protocol then you would probably have to use something like
tcpserversink to transmit the media correctly.

I am not sure how Carlos implemented his solution, but based o what he
suggested I would imagine a pipeline looking like:

rtspsrc location=rtsp://user:password@192.168.1.5:554 ! rtph264depay !
h264parse ! qtmux ! <http compatible sink>

The http compatible sink depends on how you are transmitting the media and
how the browser is expecting it. You also need to set the qtmux properties
to the correct values. fragment-duration needs to be a positive value and
you should also set the streamable flag to true. You will probably have to
play around with the values a bit.

For the sink you will either want to use something like hlssink, but that
expects a hls compatible player on the other end, or you can use something
like multifilesink to create fragmented files, that you can serve using a
standard http server. that will need from you to save the framgents in the
correct location, with the correct name so the browser can request them. I
am not sure how the video tag will work with a fragmented file on its own.
That will need some looking into, A lot of people use stuff like dash.js or
video.js to enhance the video tag. Again, some research is required.

On Fri, Jan 20, 2017 at 7:51 PM, ITwrx.org <info at itwrx.org> wrote:

> On 01/20/2017 02:54 AM, Dimitrios Katsaros wrote:
>
> The video tag in html is a bit problematic. The idea behind it was to be
> able to play any video in a browser but it requires that the browser
> implement the logic for handing the media types, which is a big blunder.
> Here is a table with a few media types:
>
> https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
>
> right. firefox supports h264/aac but it doesn't support rtsp so i'm trying
> to use gstreamer to package the rtsp stream so that the browser doesn't
> know the difference.
>
>
> From what I see you are trying to reencode h264. Is there any reason why
> h264parse is not enough?
>
> no, i just didn't know what i was doing. :)
>
> h264 is a video compression standard but it does not provide any
> information on duration, metadata about the stream etc. You need to put the
> video in a container format that will handle all that for you.
>
> this is the heart of my question. isn't there any way to use gstreamer to
> put the rtsp stream into a container (or anything else the browser needed)
> and serve to the browser with tcpserversink? i tried mp4mux or splitmuxsink
> in various incantations with various errors.
>
> If you intend on streaming to a media player you can use tsmux to get an
> mpegts stream. However, you will need a compatible player on the client
> side like the vlc embedded player. That has it's own problem in that you
> need to assume that the client has vlc or any other player installed.
>
> trying to avoid.
>
> One other alternative is to go for hls or mpeg dash. That will require
> that you create a fragmented stream, create the media descriptor file for
> the fragmented stream and then provide it via a http server. The nice thing
> about this approach is that there are javascript based players you can
> embed in your webpage. But it requires a lot of work to implement all the
> requirements.
>
> thanks for that info. will keep it in mind. would prefer just to use
> gstreamer. i can do it with videotestsrc and webm (seems to work well) and
> i can do it with v4l2src and webcam(poorly). hoping there's a way to do it
> with rtspsrc.
>
>
> I am sure people can suggest more alternatives, but these are the ones I
> have played around with. If you want something simple I would try the
> mpegts stream to vlc. you will have a client to start with and can then
> work towarsd embedding it into your site.
>
> Dimitrios
>
> Thanks
>
>
>
> On Wed, Jan 18, 2017 at 9:07 PM, ITwrx.org <info at itwrx.org> wrote:
>
>> hi,
>>
>> i'm trying to use gstreamer to get an rtsp stream from an ip cam into my
>> browser(html video tag). I'm currently trying to use
>>
>> "gst-launch-1.0 rtspsrc location=rtsp://user:password@192.168.1.5:554 !
>> rtph264depay ! h264parse ! decodebin ! x264enc ! tcpserversink
>> host=127.0.0.1 port=8080"
>>
>> which seems to be sending something, but firefox won't display the video
>> and reports that it has mime type "text/plain".
>>
>> Could anyone recommend the proper command for accomplishing this?
>>
>> thanks
>>
>> --
>> Information Technology Works
>> https://ITwrx.org
>> @ITwrxorg
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>
>
>
> _______________________________________________
> gstreamer-devel mailing listgstreamer-devel at lists.freedesktop.orghttps://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
> --
> Information Technology Workshttps://ITwrx.org
> @ITwrxorg
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170124/7df54278/attachment-0001.html>


More information about the gstreamer-devel mailing list