Skip to content
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.

RTSP / HTTP Support for Mijia 360 #4

Open
sandundev opened this issue Jan 1, 2017 · 17 comments
Open

RTSP / HTTP Support for Mijia 360 #4

sandundev opened this issue Jan 1, 2017 · 17 comments

Comments

@sandundev
Copy link

sandundev commented Jan 1, 2017

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,

@niclet
Copy link
Owner

niclet commented Jan 1, 2017

Hi,

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

Regards.

@pronsta
Copy link

pronsta commented Jun 5, 2017

Hi,

Any development on this?

Thanks.

@fittogp
Copy link

fittogp commented Aug 28, 2017

Hi niclet.

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

Thanks a lot in advanced

@brtwrs
Copy link

brtwrs commented Sep 13, 2017

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

@deennoo
Copy link

deennoo commented Oct 12, 2017

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

@brtwrs
Copy link

brtwrs commented Oct 13, 2017

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.

@deennoo
Copy link

deennoo commented Oct 25, 2017

@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.

@brtwrs
Copy link

brtwrs commented Oct 26, 2017

@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

@deennoo
Copy link

deennoo commented Oct 26, 2017

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

@deennoo
Copy link

deennoo commented Nov 10, 2017

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

@brtwrs
Copy link

brtwrs commented Nov 11, 2017

@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!

@niclet
Copy link
Owner

niclet commented Nov 12, 2017

@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.

@brtwrs
Copy link

brtwrs commented Nov 13, 2017

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

@niclet
Copy link
Owner

niclet commented Nov 13, 2017

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.

@pronsta
Copy link

pronsta commented Apr 15, 2018

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

@brtwrs
Copy link

brtwrs commented Apr 15, 2018

@pronsta
Copy link

pronsta commented Dec 25, 2018

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

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

No branches or pull requests

6 participants