telmomarques / xiaomi-360-1080p-hacks

Hacks for the Xiaomi Mi 360 1080p camera (MJSXJ02CM).
761 stars 129 forks source link

How to install rtsp service without downgrade but have busybox telnetd open? #108

Open rainow opened 1 month ago

rainow commented 1 month ago

I have a MJSXJ02CM with firmware version version 4.0.9_0409. I have flashromed the chip but can not downgrade. I have tried many times with different tf_recovery.bin or tf_update.bin but when I reboot I can only find the file be reanmed to .bak but the firmware version is still 4.0.9_0409. That drived me mad. I decide not to try to downgrade again. Now I can modify the rom and start busybox telnetd and have a root access remotely. I copy the sdcard folder to the sdcard, and install the hack with execute /mnt/sdcard/manu_test/configure_services.sh. Now the service start successfully, I can visit the webpage on port 80, but I still cannot get the rtsp stream.

Need some help :)


# netstat -tnlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:8554            0.0.0.0:*               LISTEN      1693/rtspserver
tcp        0      0 0.0.0.0:4558            0.0.0.0:*               LISTEN      1684/websocket-stre
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1027/web-config-ser
tcp        0      0 127.0.0.1:54320         0.0.0.0:*               LISTEN      205/miio_agent
tcp        0      0 127.0.0.1:54322         0.0.0.0:*               LISTEN      195/miio_client
tcp        0      0 127.0.0.1:54323         0.0.0.0:*               LISTEN      195/miio_client
tcp        0      0 0.0.0.0:23              0.0.0.0:*               LISTEN      238/busybox-armv7l
netstat: /proc/net/tcp6: No such file or directory

# ps aux | grep /mnt/data/etc
 1018 root     runsvdir /mnt/data/etc/runit
 1663 root     /mnt/data/bin/framegrabber -f /mnt/data/etc/framegrabber/websocket_mainstream -c 0
 1666 root     /mnt/data/bin/framegrabber -f /mnt/data/etc/framegrabber/websocket_substream -c 1
 1670 root     /mnt/data/bin/framegrabber -f /mnt/data/etc/framegrabber/rtsp_mainstream -c 0
 1684 root     ./websocket-stream-server -m=/mnt/data/etc/framegrabber/websocket_mainstream -s=/mnt/data/etc/framegrabber/websocket_substream
 1686 root     /mnt/data/bin/framegrabber -f /mnt/data/etc/framegrabber/rtsp_substream -c 1
 1693 root     /mnt/data/bin/rtspserver -c ../config/config.json -m /mnt/data/etc/framegrabber/rtsp_mainstream -s /mnt/data/etc/framegrabber/rtsp_substream
 2936 root     grep /mnt/data/etc

On remote host, I tried: ffmpeg -rtsp_transport tcp -i rtsp://192.168.31.221:8554/substream -f rawvideo -y /dev/null and get this: rtsp://192.168.31.221:8554/substream: Invalid data found when processing input Exiting normally, received signal 2.

On the webpage, I turned on websocket and H264, but the preview part is always loading and cannot see anything.


Detail log:

mkfifo: /mnt/data/etc/framegrabber/websocket_mainstream: File exists
mkfifo: /mnt/data/etc/framegrabber/rtsp_substream: File exists
mkfifo: /mnt/data/etc/framegrabber/rtsp_mainstream: File exists
mkfifo: /mnt/data/etc/framegrabber/websocket_substream: File exists
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET    /favicon.ico              --> main.setupRouter.func1 (5 handlers)
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET    /                         --> main.setupRouter.func2 (5 handlers)
[GIN-debug] GET    /api/hack/rtsp-server/config --> main.setupRouter.func3 (5 handlers)
[GIN-debug] GET    /api/hack/rtsp-server/info --> main.setupRouter.func4 (5 handlers)
[GIN-debug] POST   /api/hack/rtsp-server/config --> main.setupRouter.func5 (5 handlers)
[GIN-debug] GET    /api/hack/websocket-stream-server/config --> main.setupRouter.func6 (5 handlers)
[GIN-debug] GET    /api/hack/websocket-stream-server/info --> main.setupRouter.func7 (5 handlers)
[GIN-debug] GET    /api/hack/websocket-stream-server/endpoints --> main.setupRouter.func8 (5 handlers)
[GIN-debug] POST   /api/hack/websocket-stream-server/config --> main.setupRouter.func9 (5 handlers)
[GIN-debug] GET    /api/hack/ssh-server/config --> main.setupRouter.func10 (5 handlers)
[GIN-debug] GET    /api/hack/ssh-server/config/general --> main.setupRouter.func11 (5 handlers)
[GIN-debug] GET    /api/hack/ssh-server/config/users --> main.setupRouter.func12 (5 handlers)
[GIN-debug] POST   /api/hack/ssh-server/config/general --> main.setupRouter.func13 (5 handlers)
[GIN-debug] POST   /api/hack/ssh-server/config/users --> main.setupRouter.func14 (5 handlers)
[GIN-debug] DELETE /api/hack/ssh-server/config/users/:username --> main.setupRouter.func15 (5 handlers)
[GIN-debug] Listening and serving HTTP on :80
[GIN-debug] GET    /mainstream               --> main.setupRouter.func1 (3 handlers)
[GIN-debug] GET    /substream                --> main.setupRouter.func2 (3 handlers)
[GIN-debug] Listening and serving HTTP on :4558
./framegrabber: exec: line 17: /mnt/data/bin/framegrabber: Text file busy
./framegrabber: exec: line 17: /mnt/data/bin/framegrabber: Text file busy
mkfifo: /mnt/data/etc/framegrabber/websocket_mainstream: File exists
mkfifo: /mnt/data/etc/framegrabber/rtsp_mainstream: File exists

can't catch SIGKILL

can't catch SIGSTOP

can't catch SIGKILL

can't catch SIGSTOP
./framegrabber: exec: line 17: /mnt/data/bin/framegrabber: Text file busy
mkfifo: /mnt/data/etc/framegrabber/websocket_mainstream: File exists
Streaming encoding: "h264"

can't catch SIGKILL

can't catch SIGSTOP

"mainstream" stream, from the file "/mnt/data/etc/framegrabber/rtsp_mainstream"
Play this stream using the URL "rtsp://192.168.31.221:8554/mainstream"

"substream" stream, from the file "/mnt/data/etc/framegrabber/rtsp_substream"
Play this stream using the URL "rtsp://192.168.31.221:8554/substream"

can't catch SIGKILL

can't catch SIGSTOP
82305 | 65536 | 0
82305 | 65536 | 0
82305 | 65536 | 1
82305 | 65536 | 1
82305 | 65536 | 2
82305 | 65536 | 2
82305 | 65536 | 3
82305 | 65536 | 3
82305 | 65536 | 4
82305 | 65536 | 4
82305 | 65536 | 5
82305 | 65536 | 5
82305 | 65536 | 6
82305 | 65536 | 6
82305 | 65536 | 7
82305 | 65536 | 7
82305 | 65536 | 8
82305 | 65536 | 8
82305 | 65536 | 9
82305 | 65536 | 9
13209 | 8192 | 0
13209 | 8192 | 1
13209 | 8192 | 2
13209 | 8192 | 3
13209 | 8192 | 4
13209 | 8192 | 5
13209 | 8192 | 6
13209 | 8192 | 7
13209 | 8192 | 8
13209 | 8192 | 9

[GIN] 2024/05/20 - 15:01:19 | 304 |   44.765005ms |        10.8.0.2 | GET      "/"
[GIN] 2024/05/20 - 15:01:21 | 200 |   31.110336ms |        10.8.0.2 | GET      "/api/hack/websocket-stream-server/info"
[GIN] 2024/05/20 - 15:01:24 | 200 |  2.940916628s |        10.8.0.2 | GET      "/api/hack/websocket-stream-server/endpoints"
[GIN] 2024/05/20 - 15:01:24 | 200 |  3.086588142s |        10.8.0.2 | GET      "/api/hack/rtsp-server/info"
Reading substream
Reading substream
Reading substream
Reading substream
Reading substream
Reading substream
Reading substream
Reading substream
Reading substream
Reading substream
Reading substream
Reading substream