xiaomi_hack icon indicating copy to clipboard operation
xiaomi_hack copied to clipboard

RTSP / HTTP Support for Mijia 360

Open sandundev opened this issue 9 years ago • 17 comments

Hi Niclet,

Is it possible to stream the video of this device on a web browser / RTSP ?

Is there any way to build REST API to control this device over a HTTP instead of MI apps?

Thanks,

sandundev avatar Jan 01 '17 13:01 sandundev

Hi,

It is not currently available with this hack. And unfortunately, I don't have enough time to work on it for now.

Regards.

niclet avatar Jan 01 '17 15:01 niclet

Hi,

Any development on this?

Thanks.

pronsta avatar Jun 05 '17 16:06 pronsta

Hi niclet.

Do you know if you could to work for RTSP someday?

Thanks a lot in advanced

fittogp avatar Aug 28 '17 11:08 fittogp

I managed to get a RTSP server working on the Mijia 360 720p. Look at this threat maybe it will help you: https://github.com/Filipowicz251/mijia-1080P-hacks/issues/5

brtwrs avatar Sep 13 '17 10:09 brtwrs

@brtws, any way to share your work please ? Google Drive with à copy of your sd ? Or à repo with thé content.

deennoo avatar Oct 12 '17 20:10 deennoo

Sure! But there is not much to share. Ik just downloaded the SDK from the project I mentioned https://github.com/Filipowicz251/mijia-1080P-hacks/wiki You'll find all the source code in there. I used the code and makefile from de SDK (GM8136 SDK release v1.0/Software/Embedded_Linux/source/gm_graph/product/GM8136_1MP/samples) I did changed the make file a bit. Added the croscompile and made it build static:

GMLIB=../../../gm_lib CROSS_COMPILE=arm-linux-gnueabi-

ifeq ($(shell find $(GMLIB)/../ -name gmlib.mak),) sinclude /usr/src/arm-linux-3.3/linux-3.3-fa/cross_compiler_def else sinclude $(GMLIB)/gmlib.mak endif

uclibc=$(shell echo $(CROSS_COMPILE)|grep uclib) ifeq ($(uclibc),) LIBRTSP=librtsp_glibc.a else LIBRTSP=librtsp.a endif

CC=$(CROSS_COMPILE)gcc CPP=$(CC) -E LD=$(CROSS_COMPILE)ld AS=$(CROSS_COMPILE)as MAKE=make PROGS=rtspd

LDFLAGS += -L$(GMLIB)/lib -lpthread -lm -lrt -lgm #CFLAGS += -I$(GMLIB)/inc CFLAGS += -Wall -I$(GMLIB)/inc -static

TARGETS := $(PROGS)

.PHONY: $(TARGETS)

all: $(TARGETS)

$(TARGETS): %: %.c Makefile $(GMLIB)/inc/gmlib.h $(CC) $(CFLAGS) $< $(LIBRTSP) $(LDFLAGS) -o $@

clean: rm -f $(TARGETS)

Or do you need something else?

btw did any of you guys made any progress on how to control the motors end ir leds from anything but the Xiaomi app? As far as I can see its been done from the miio_avstreamer process which also sets up the stream to Xiaomi. I tried to decompile the binary file but its very hard te read the decompiled code.

brtwrs avatar Oct 13 '17 08:10 brtwrs

@brtwrs thx for your input...i'm not confortable with crosscompile and other stuff like this.

Having à .img from your sdcard will be perfect, but that à bit easy i understand. I just get my cam today , on looks how it Works.

Rstp or http://ip/snap.img can be good as it was already do for the fang or ante One. Thé great feature who is missing is just position préset, as i understand this will only Can be done when WE will have accès to motorisation driver.

deennoo avatar Oct 25 '17 14:10 deennoo

@deennoo, just an image of my sdcard wont help you. You also need to change some init scripts on the cam itself and enable telnet to do so. Look at my comments here on how to do that: Filipowicz251/mijia-1080P-hacks#5 . If it helps, here is the compiled binary: https://bartwijers.stackstorage.com/s/1VdEqFz77VVcY9v

FYI on my cam I've disabled the miio_avstreamer proces at startup so the cam doesn't move when rebooting and keeps its position. I still havent found a way to make the cam move and sadly dont have much time to do more research. Hope this helps

brtwrs avatar Oct 26 '17 10:10 brtwrs

Thx for your input, will try your way to do when i will have time

deennoo avatar Oct 26 '17 17:10 deennoo

@brtwrs i'm looking hard on your comment, but can't find a way to start telnet server, any advice on i_t please ?

deennoo avatar Nov 10 '17 17:11 deennoo

@deennoo You have to take the camera apart and look for the rx and tx pins. ( I didnt took a picture so I cant tell you exactly which one but its marked in the pcb) Connect a serial to usb cable to the rx, tx and ground on the camera and you will get a uboot console on your pc. You have to change the console variable (or something like that) in uBoot to make the output point to /dev/ttyS0 instead of /dev/null (make sure to save it) and reboot the camera. If all good you'll see a linux console and you can enable the telnet startup script (by removing the "_" from the name if I recall correctly). Now the telnet session will be active on your next reboot. I hope this helps you. Im sorry I dont have a more detailed description because I wrote this all from memory. Goodluck!

brtwrs avatar Nov 11 '17 17:11 brtwrs

@brtwrs Your post looks very interesting to me. Do you know if I can use a raspberry pi to connect RX/TX/GND from camera to RPI GPIO and have a console on the RPI ? Or do I have to buy a serial to usb cable ? In any case, do you have some links which would guide me on such console installation/usage ? I have never used such low level hacking, but it seems very promising.

niclet avatar Nov 12 '17 07:11 niclet

That should work. Google is your friend;) this is the first hit google gave me: https://oscarliang.com/raspberry-pi-and-arduino-connected-serial-gpio/ You could try without resistors at first. I dont think you need them.

When in the uboot cli:

  1. printenv that should print al the env variables. look for the bootargs variable
  2. setenv bootargs "bootargs variable string you got from step 1 but replace the console variable with /dev/ttyS0"
  3. saveenv
  4. reset or reboot (im not sure about this one)

now you should boot into a linux console

brtwrs avatar Nov 13 '17 12:11 brtwrs

Thanks a lot :) On google, I had found many articles to monitor the serial port of RPI, but not from RPI. I'll test it asap, thanks again.

niclet avatar Nov 13 '17 12:11 niclet

@brtwrs @niclet any development on the mijia 1080 360 hack?

pronsta avatar Apr 15 '18 12:04 pronsta

Check these projects: https://github.com/ghoost82/mijia-720p-hack https://github.com/cck56/mijia-720p-ctrl :)

brtwrs avatar Apr 15 '18 12:04 brtwrs

I also didnt find any infos about the JTSXJ01CM camera. I hope someday this will be hacked :)

pronsta avatar Dec 25 '18 02:12 pronsta