Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of RTSP anytime soon..? #92

Open
gojiii opened this issue Dec 5, 2017 · 40 comments
Open

Support of RTSP anytime soon..? #92

gojiii opened this issue Dec 5, 2017 · 40 comments

Comments

@gojiii
Copy link

gojiii commented Dec 5, 2017

Hello, thanks for making this :) Just wanted to know if a version with RTSP support is incoming anytime soon? Let us know, thanks :)

@seydx
Copy link

seydx commented Dec 5, 2017

RTSP pleaaaaaaaase

@shadow-1
Copy link
Owner

shadow-1 commented Dec 6, 2017

@gojiii
I have been very time poor in the last few months. I already know how I would like to develop RTSP support, however I need to hack some of the Xiaomi programs to determine how they work before I will be able to release something that is stable.

@kruschman
Copy link

Would RTSP support without the Yi app compatibility be any easier? I know that there are a lot of people that would basically like a solution like fritz's that works with the new hardware.

@galadril
Copy link

galadril commented Dec 7, 2017

#15

@galadril
Copy link

galadril commented Dec 7, 2017

You can add a bounty on this feature:
https://www.bountysource.com/issues/44753535-rtsp-server

@shadow-1
Copy link
Owner

shadow-1 commented Dec 8, 2017

@kruschman
RTSP support without Yi App compatibility might be a little easier to achieve. However it does have its own challenges which are different.

@feeling001
Copy link

feeling001 commented Dec 14, 2017

Does somebody have an idea how to capture still images "ie : each X seconds via cron job" to put them on the FTP ?
I did'nt find a way to access the device (i suppose trough hi3518e_jpege) to grab images.

(seems to be the same kind of hardware : http://www.itread01.com/articles/1476576329.html)

regards,
L.

@uorriz
Copy link

uorriz commented Dec 14, 2017

I was able to achieve this on my 27US using one of the examples of the SDK.
The code is in mpp/samples/venc/sample_venc.c
I was able to capture a snapshot and save it as /tmp/sd/snap.jpg (therefore the file snap.jpg is in the root of the SD card) every X ms.
Then I created a symlink to snap.jpg from the www directory. My goal was to implement a sort of crude MJPEG server using the already available HTTP server. Unfortunately, this is not going to work because the HTTP requests could be served while the capture program is saving the jpg file.
So the next step is to implement an HTTP server directly in the sample program. As soon as I'll have some time I'll work on it.

Obviously this will conflict with the cloud software, so it can only work if the original yi apps are killed.

I'm attaching the binary in case you have a 27US and want to give it a try. To test it, just copy it to the sd card (you can use FTP for that), kill all the yi apps and start it with ./sample_venc 4
sample_venc.tar.gz

@shadow-1
Copy link
Owner

@uorriz
Great progress! I'm sure this will help many people.

@dvv
Copy link

dvv commented Jan 2, 2018

If we have still images we could use them as the source for https://github.com/jacksonliam/mjpg-streamer/tree/master/mjpg-streamer-experimental/plugins/input_file.

@dvv
Copy link

dvv commented Jan 2, 2018

@uorriz how do we "kill all the yi apps"?

@uorriz
Copy link

uorriz commented Jan 2, 2018

@dvv I manually kill them using telnet.
Here is a script I launch at startup to disable Internet access and kill all the yi apps:

#!/bin/sh

# disable internet access
route del default

# kill yi processes
killall watch_process
killall cloud
killall mp4record
killall rmm
killall oss
killall dispatch
killall log_server
killall udevd
killall p2p_tnp
killall arp_test

@dvv
Copy link

dvv commented Jan 2, 2018

I get

/tmp/sd # ./sample_venc 4
=============SAMPLE_COMM_VI_SetMipiAttr enWDRMode: 0
[Func]:HI_MPI_ISP_MemInit [Line]:144 [Info]:ISP[0] get Mem info failed!
SAMPLE_COMM_ISP_Init: HI_MPI_ISP_Init failed!
[SAMPLE_COMM_VI_StartIspAndVi]-2040: SAMPLE_COMM_VI_StartIspAndVi: Sensor init failed!
[SAMPLE_VENC_1080P_JPEG_Thumb]-1623: start vi failed!
program exit abnormally!

@uorriz
Copy link

uorriz commented Jan 2, 2018

Two things come to mind:

  1. wrong model / sensor. I compiled it to work with the 27US (the 720p model). It will not work with other sensors;
  2. yi apps still running;

@dvv
Copy link

dvv commented Jan 2, 2018

The model should match. Any trick to check the model/sensor from telnet session?

@dvv
Copy link

dvv commented Jan 12, 2018

@uorriz I have

/tmp/sd # rtsp/sample_venc
Usage : ./sample_venc <index>
index:
         0) 1*1080p H264 + 1*VGA H264.
         1) 1*1080p MJPEG encode + 1*1080p jpeg.
         2) low delay encode(only vi-vpss online).
         3) roi background framerate.
         4) Thumbnail of 1*1080p jpeg.
         5) svc-t H264

but the cam is 720p one.
Couldn't you post here a 720p version of sample_venc.

TIA,
--V

@ordimans
Copy link

ordimans commented Jan 19, 2018

I am working on RTSP on 47US, i use rtsp2301 .

I have this logwhen i connect to VLC....
`_<><><><>Creat RTP<><><><>
pstr=-59927
adding a schedule object action rtsputils.c,322
TRANSFER TO READY STATE!
exit Rtsp_state_machine
4
S192.168.0.1 Port:58277
+++++++++++++++++++++
start to play 0 now!
+++++++++++++++++++++
Start Playing!
exit Rtsp_state_machine
4
SIncoming RTSP connection accepted on socket: 6
EventLoop Connection reached: 4
192.168.0.1 Port:58277
exit Rtsp_state_machine
4
S192.168.0.1 Port:58296
exit Rtsp_state_machine
4
Sfd:4,RTSP connection closed by client.
first error,pRtsp is null
192.168.0.1 Port:58296
server:192.168.0.101
port:-1093458630

GetSdpDescr,703===>psp.base64profileid=,psp.base64sps=,psp.base64pps=

exit Rtsp_state_machine
4
S192.168.0.1 Port:58296
*** transport: RTP/AVP/TCP;unicast;interleaved=0-1 ***
pstr=/TCP;unicast;interleaved=0-1
AAAAAAAAAAA Unsupported Transport,rtspservice.c,1118
TRANSFER TO READY STATE!
exit Rtsp_state_machine
4
S192.168.0.1 Port:58296
*** transport: RTP/AVP;unicast;client_port=59928-59929 ***
!!!!!!!!!!!!!!!!!!!!!!rtp create:addr:100a8c0,port:59928,localc0a80065
<><><><>success creat RTP<><><><>
<><><><>Creat RTP<><><><>
pstr=-59929
adding a schedule object action rtsputils.c,322
exit Rtsp_state_machine
4
S192.168.0.1 Port:58296
+++++++++++++++++++++
start to play 0 now!
+++++++++++++++++++++
Start Playing!
exit Rtsp_state_machine
4
S^Cbegin free mem
The Server quit!
/tmp/sd/test/app # ^C_
`

@kapollo
Copy link

kapollo commented Mar 23, 2018

Hi I don't know what exactly rtsp2301 is under the hood, but I do own a D-Link 5222L B2 which is based on Hi3518C, and it has RTSP streaming based on the Live555 media server.
Dlink like some other OEMs has gpl code for their gpl sw, and for cameras at least it equals to a buildable fw somewhat (it doesn't contain rootfs, but then neither does their fw updates).
All in all there is code for Live555 which already has some interfacing done with the SDK binaries from the chipmaker. It could be a great starting point. At least it should be fairly easy to combine venc with stills and mjpeg stream for starters.

There is also other apporach possible like in Edimax's cameras it uses spook as RTSP server (GPL code also provides source code for spook which interfaces with the raw stream directly).
hope this helps, just had some encounters with both and wanted to add my two cents.

@dvv
Copy link

dvv commented Apr 5, 2018

@pmarrapese can we look at protocol current documentation?

@JocPelletier
Copy link

What happened to @pmarrapese messages about his progress?

@dwild
Copy link

dwild commented Apr 5, 2018

He is afraid of infringing the ToS of Xiaomi.

@Necromix
Copy link

Initial version (and not stable) of RTSP server and H264 recorder for YHS-113-IR (27US):
https://github.com/Necromix/yi-vencrtsp

@DarthMadeHer
Copy link

DarthMadeHer commented Jul 30, 2018

I have copied the yi-vencrtsp files from the SD directory onto a working SD that has shadow-1's firmware hack. My understanding is that the startup.sh will be run and call what it needs to from the yi-hack-v3 dir on the SD card. Do I need to telnet to the camera and manually start the processes? Is the url the same as previous ones rtsp://root:@IP_Address:554/ch0_0.h264?

Edit: Never mind. Turns out the startup.sh wasn't running for some reason, so the init.sh in /home/app was never replaced with the Necromix version. Ran the cp manually.

@kaizday
Copy link

kaizday commented Aug 12, 2018

@DarthMadeHer so what happens after you cp manually, is rtsp working now? What is the url? Thankx

@jpenyc
Copy link

jpenyc commented Aug 13, 2018

I used this https://github.com/Necromix/yi-vencrtsp on this YHS-113-IR (27US) and it works using vencrtsp
How do I get vencrtsp to start on boot without having to ssh in.

@Minims
Copy link

Minims commented Aug 13, 2018

@jpenyc Can you explain how you make it working ? I try to follow the readme on my 27US cam, but i may do something wrong. Thank you !

@bobaxx
Copy link

bobaxx commented Aug 29, 2018

Hello. For those who are in the same situation as me: waiting for RTSP on the 27US camera for a looooooooong time.
You can do it mixing the two following firmwares:
*yi-hack-v3 from Shadow1
*yi-vencrstp

Here are the steps (it worked for me on 2 different cameras). It's a bit tedious but it works:

1-Copy the files from the "SD" directory from necromix firmware (https://github.com/Necromix/yi-vencrtsp) to the root of your SD card;

2-Flash your camera using yi-hack-v3 and following the steps on the page : https://github.com/shadow-1/yi-hack-v3;

3-After the camera is flashed successfully, you should acess it with its IP in your web browser. For example , mine is 192.168.1.65.

4-Go to "system config" tab and enable telnet server, then apply. Your camera will reboot.

5-Connect to your camera with telnet using its IP, with putty for example.
Port is 23, user login is "root", and password is empty.
For now, you should be logged on your camera.

6-Use the following commands:
cd /tmp/sd/yi-hack-v3/
./startup.sh

This script will replace some native properties of the original camera firmware.
If the script doesn't work (it can happen), you have to do it manually using this command line:

cp /tmp/sd/yi-hack-v3/yi_init.sh /home/app/init.sh

7-After camera reboot, you should be able now to use RTSP !
Unfortunately, you have to start the service manually but hey, it's a good start !

To launch RTSP service, connect to your camera with telnet (as seen before) and type this lines:

cp /tmp/sd/
./vencrtsp

And voilà ! You can now access RTSP with VLC or another client using rtsp://root@CAMERAIP:554/ch0_1.h264. Mine is rtsp://[email protected]:554/ch0_1.h264

I noticed a bug when the ambient light is too low. The rtsp service show error "segmentation fault" and stops working.

Enjoy !

@McVillano
Copy link

@bobaxx would the original app still work after this mod?¿

@Minims
Copy link

Minims commented Aug 31, 2018

RTSP seems working, but i have sometimes some segfaults on my 27US.
The original app doesn't work anymore on my side. but you can revert by reinstalling the original yi-hack-v3

@McVillano
Copy link

Yep, finally i´ve turned back my camera, i was lookingfor full functional RTSP and the project has been without update for months i need rtsp for Home Assistant

@fluidof
Copy link

fluidof commented Sep 14, 2018

@bobaxx but just for my understanding, after starting the service with ./vencrtsp shall I have to leave open the SSH connection? Can I close terminal? It seems not...
schermata 2018-09-15 alle 01 06 19

@fluidof
Copy link

fluidof commented Sep 15, 2018

@bobaxx And, is there a way to run a command at startup to run automatically the ssh [email protected]. ./tmp/sd/vencrtsp or something similar?

@hoopsta1423
Copy link

@bobaxx This guide worked perfectly for me so thank you! Has anybody had any luck using this with BlueIris? I can connect with VLC but can't get BlueIris to pull the stream in using the rtsp address

@jpawlowski
Copy link

That wouldn't work anymore it seems because the kernel modules are not compatible with newer firmware versions. I opened a bug report for it: Necromix/yi-vencrtsp#7

@Necromix
Copy link

Necromix commented Dec 2, 2018

@fluidof: to start vencrtsp at startup.

Edit the /tmp/sd/yi-hack-v3/yi_init.sh or /home/app/init.sh

Add to line 58 (just before the exit)
/tmp/sd/vencrtsp &

@Necromix
Copy link

Necromix commented Dec 2, 2018

@jpawlowski
I anticipated this issue and in my initial plan, I would like to use the original ko from CAM but I never achieve to run yi-vencrtsp on those modules.

We can try https://github.com/Necromix/yi-vencrtsp_v2 which uses all files from cam and extract video from /tmp/view.

@lupo-ch
Copy link

lupo-ch commented Jan 1, 2019

I have US47 Yi Home camera with yi-hack-v3 and yi-vencrtsp_v2 running, but I can't connect the camera to RTSP client ... what is the correct URL to connect to?
I tested with
rtsp://ipaddress:554/ch0_0.h264

@mvklingeren
Copy link

That is the correct url.

@bobaxx
Copy link

bobaxx commented May 15, 2019

It's a bite late, but the correct adress is
rtsp://root@ipaddress:554/ch0_0.h264

@plutosherry
Copy link

/home/yi-hack-v3 # ./vencrtsp RTSP:-----Init Rtsp server =============SAMPLE_COMM_VI_SetMipiAttr enWDRMode: 0 [Func]:HI_MPI_ISP_MemInit [Line]:144 [Info]:ISP[0] get Mem info failed! SAMPLE_COMM_ISP_Init: HI_MPI_ISP_Init failed! [SAMPLE_COMM_VI_StartIspAndVi]-2040: SAMPLE_COMM_VI_StartIspAndVi: Sensor init failed! [SAMPLE_VENC_1080P_CLASSIC]-1351: start vi failed! program exit abnormally!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests