JohnnyCyp
Posts: 75
Joined: Sun Mar 31, 2019 11:05 pm

How to stream RTSP with IP camera in Webserver flask ?

Thu Jun 27, 2019 1:24 pm

How I stream with IP camera using RTSP protocol in my webserver flask ? Please do not send me guides that you are not sure about it and haven't tried it because i tried over 10 guides and sample codes and nothing works...

User avatar
topguy
Posts: 5569
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: How to stream RTSP with IP camera in Webserver flask ?

Thu Jun 27, 2019 1:44 pm

I think the simple answer is "You can't".
I used some time on google the last time you posted this question, and I did not either find any guides I thought would work.

This is something I think could work: https://www.quora.com/How-do-I-embed-RTSP-into-HTML5 ( but I havent tried it )

But all falls back to the fact that no browser support RTSP so you have to recode the stream to something different, using VLC or ffmpeg.
In the flask server you just (in theory) have to add the correct tags and stream-url to the html output.

JohnnyCyp
Posts: 75
Joined: Sun Mar 31, 2019 11:05 pm

Re: How to stream RTSP with IP camera in Webserver flask ?

Thu Jun 27, 2019 3:35 pm

topguy wrote:
Thu Jun 27, 2019 1:44 pm
I think the simple answer is "You can't".
I used some time on google the last time you posted this question, and I did not either find any guides I thought would work.

This is something I think could work: https://www.quora.com/How-do-I-embed-RTSP-into-HTML5 ( but I havent tried it )

But all falls back to the fact that no browser support RTSP so you have to recode the stream to something different, using VLC or ffmpeg.
In the flask server you just (in theory) have to add the correct tags and stream-url to the html output.
I tried it now and only in VLC program the streaming works, in the html doesn't show the streaming box.

<video id="video" src="http://IP_of_VLC_computer:VLC_Port" autoplay="autoplay" width="videowidth" height="videoheight"></video>

The "IP of vlc computer" is the ip of the pc where the vlc program is running right ?

User avatar
topguy
Posts: 5569
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: How to stream RTSP with IP camera in Webserver flask ?

Thu Jun 27, 2019 4:01 pm

Code: Select all

<video id="video" src="http://IP_of_VLC_computer:VLC_Port" autoplay="autoplay" width="videowidth" height="videoheight"></video>
The "IP of vlc computer" is the ip of the pc where the vlc program is running right ?
Yes.. and that IP must be reachable also from the PC with the browser.. also remember to change "VLC_Port"

To test the transcoding you should be able to open VLC on a different computer and open the URL: "http://IP_of_VLC_computer:VLC_Port"

JohnnyCyp
Posts: 75
Joined: Sun Mar 31, 2019 11:05 pm

Re: How to stream RTSP with IP camera in Webserver flask ?

Thu Jun 27, 2019 4:17 pm

topguy wrote:
Thu Jun 27, 2019 4:01 pm

Code: Select all

<video id="video" src="http://IP_of_VLC_computer:VLC_Port" autoplay="autoplay" width="videowidth" height="videoheight"></video>
The "IP of vlc computer" is the ip of the pc where the vlc program is running right ?
Yes.. and that IP must be reachable also from the PC with the browser.. also remember to change "VLC_Port"

To test the transcoding you should be able to open VLC on a different computer and open the URL: "http://IP_of_VLC_computer:VLC_Port"
I'm running the vlc program and the browser from the PC but the flask webserver from raspberry PI. Is that wrong ? should be running the vlc program from raspberry pi?

Return to “Networking and servers”