Commit 24f9f78a authored by Chipp Jansen's avatar Chipp Jansen
Browse files

Update README.md

parent 5747eecc
......@@ -11,13 +11,13 @@ on your computer where you can run `ssh` from. On a Windows laptop you can use
With the camera's IP address use this command to connect to the camera (this example uses 192.168.1.20 as the IP address, replace it with your camera's IP):
ssh root@192.168.1.20
ssh root@192.168.1.20
The first thime you do tihs you might get something that says this:
The authenticity of host '192.168.1.20 (192.168.1.20)' can't be established.
ECDSA key fingerprint is SHA256:8WvDPcIb1JWa7EY34QHHwRV48vnLakWiJ1xTnz9+hJs.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
The authenticity of host '192.168.1.20 (192.168.1.20)' can't be established.
ECDSA key fingerprint is SHA256:8WvDPcIb1JWa7EY34QHHwRV48vnLakWiJ1xTnz9+hJs.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Type `yes` and hit ENTER.
......@@ -25,11 +25,11 @@ The password to use is `root`.
If successful, you will get a command prompt that looks like this:
#
#
You can check which camera you are on by reading the hostname file on the camera:
more /etc/hostname
more /etc/hostname
It should be the name that is on the camera. If it does not match, you might have connected to someone elses camera! You can type the command `exit` to close the connection and try the `ssh` command again with a different IP address.
......@@ -37,20 +37,20 @@ It should be the name that is on the camera. If it does not match, you might ha
The camera filesystem is set-up with a "traditional" Linux filesystem. You can list the directories at the root of the file system:
ls /
ls /
There is a directory `/sdcard` which is the sdcard of the camera. If you don't see a sdcard directory, let me know. You will need it to run the programs on the camera.
Change directory to the sdcard to see what is there.
cd /sdcard
ls
cd /sdcard
ls
## See what is running on the camera
You can see what programs are running on the camera and other activity statistics by running `htop`.
htop
htop
You will see a listing like this, which updates periodically to show what is running.
......@@ -60,17 +60,17 @@ You can use the up/down arrows to see the different programs running. Notice th
If you have `mjpg_streamer` running, then you can view the stream, by openning a browser to (again, substitute your IP instead of 192.168.1.20):
http://192.168.1.20:8080/?action=stream
http://192.168.1.20:8080/?action=stream
## Grab snapshots of the stream
`mjpg_streamer` also supports grabbing single JPGs of the stream. You can grab an image using the `curl` utility, which let's you do HTTP requests (i.e. grab web-pages) from the command line.
curl -o /sdcard/snaps/test.jpg http://localhost:8080/?action=snapshot
curl -o /sdcard/snaps/test.jpg http://localhost:8080/?action=snapshot
This downloads a jpg into the `snaps` directory on the sdcard.
ls /sdcard/snaps
ls /sdcard/snaps
Note that instead of using your specific IP, we can use `localhost` in the URL to substitute your own IP address when running programs from your camera.
......@@ -78,7 +78,7 @@ Note that instead of using your specific IP, we can use `localhost` in the URL t
Now we will set-up our own seperate hacky stream that will display this jpg. This will run on a seperate port (note the 8081 in the command) on the camera:
mjpg_streamer -i "input_file.so -f /sdcard/snaps" -o "output_http.so -p 8081" > /dev/null 2>&1 &
mjpg_streamer -i "input_file.so -f /sdcard/snaps" -o "output_http.so -p 8081" > /dev/null 2>&1 &
The `&` means this program will run in the background, and you can continue typing on the command prompt. You can run `htop` and find this version of `mjpg_streamer` running. We are running two seperate `mjpg_streamer` programs.
......@@ -86,15 +86,15 @@ The `&` means this program will run in the background, and you can continue typi
`mjpg_streamer` will watch the `snaps` directory for refreshed `test.jpg` to steam. So we will use the `watch` command to re-run the `curl` command once a second (by setting the `-n 1` option).
watch -n 1 curl -o /sdcard/snaps/test.jpg http://localhost:8080/?action=snapshot
watch -n 1 curl -o /sdcard/snaps/test.jpg http://localhost:8080/?action=snapshot
## View our hacky stream
## View your hacky stream
Now using a slightly different url in the browser, we can view our every second "stream" (note that the only difference with this url is the port 8081 instead):
http://192.168.1.20:8081/?action=stream
http://192.168.1.20:8081/?action=stream
***Congratulations!*** You've set-up your own stream.
***Congratulations!*** You've set-up your own web stream.
## Before we modify the stream...
......@@ -106,22 +106,22 @@ So we need to get the `videocapture` program to streamer a smaller resolution fo
First, we need to stop the current running programs. You can easily stop ALL programs running with that name using `killall`. So to stop `videocapture` and `mjpg_streamer`:
killall videocapture
killall mjpg_streamer
killall videocapture
killall mjpg_streamer
You can check `htop` to make sure they are stopped.
Next, we will restart `videocapture` with a configuration file (that is already on the sdcard at `/sdcard/mjpeg.json`) that sets it to stream at 320 by 180:
/usr/bin/videocapture /sdcard/mjpeg.json >> /var/log/videocapture.log 2>&1 &
/usr/bin/videocapture /sdcard/mjpeg.json >> /var/log/videocapture.log 2>&1 &
Next, we will restart streaming this original image with `mjpg_streamer`:
mjpg_streamer -i "input_v4l2loopback.so -d /dev/video4 --fps 15" -o "output_http.so" > /dev/null 2>&1 &
mjpg_streamer -i "input_v4l2loopback.so -d /dev/video4 --fps 15" -o "output_http.so" > /dev/null 2>&1 &
This is the exactly same command as before, and streams to port 8080. We can refresh the browser to view this smaller stream:
http://192.168.1.20:8080/?action=stream
http://192.168.1.20:8080/?action=stream
## Modify the stream
......@@ -131,10 +131,10 @@ Let's test this out first with a single image.
**Step 1** we grab this smaller image using curl (without `watch`) into the `snaps` directory (as before):
curl -o /sdcard/snaps/test.jpg http://localhost:8080/?action=snapshot
curl -o /sdcard/snaps/test.jpg http://localhost:8080/?action=snapshot
Next, we convert this image, we will use the `swirl` option which swirls the center of the image by a number of degrees. Imagemagick's `convert` has SO MANY options to manipulate the image (such as drawing etc...).
convert /sdcard/snaps/test.jpg -swirl 60 /sdcard/stream/out.jpg
convert /sdcard/snaps/test.jpg -swirl 60 /sdcard/stream/out.jpg
Finally, we run our new `mjpg_streamer` which will stream images from a separate
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment