[Tutorial] [Record] Raspberry Pi Raspberry+motion+camera realizes photo, video, real-time video functions

I am new to Raspberry Pi, so please give me your advice.


1. Preparation

1. Raspberry Pi 4B
2. Raspberry Pi camera 500W pixels (Taobao more than ten dollars)
3.motion
insert image description here

2. Operation steps

1. Enter the settings to open the camera module

In the Raspberry Pi terminal window type:

sudo raspi-config 

Select interface option–>I1 Camera in turn, then enter, confirm, and restart, as shown in the figure
insert image description hereinsert image description here

2. Take pictures

sudo raspistill -t 1000 -o first.jpg

-t 1000 # means to take pictures after a delay of 1000ms.
-o first.jpg #Represents the jpg format file named first.
Use the ls command to see if you have successfully captured and saved the file.
For raspistill detailed instructions, please refer to this article
to view the photos you just took: xdg-open image path.

xdg-open first.jpg

insert image description here

3. Video

raspivid -t 5000 -o 1.h264

-t 5000 #Indicates recording 5000ms video.
-o 1.h264 #Indicates the h264 format file named 1.
View the video you just recorded: xdg-open video path.

xdg-open 1.h264

insert image description here

4. Real-time monitoring

(1) Install the motion module

sudo apt-get install motion

(2) Configure motion
command line input:

sudo nano /etc/default/motion

Change the no inside to yes

start_motion_daemon=yes

**Note:** If there is nothing after opening the file, you start_motion_daemon=yes can add it yourself
insert image description here
(3) Configure the motion.conf
command line input:

sudo nano /etc/motion/motion.conf

insert image description hereinsert image description here
**Note:** Be sure to stream_maxrate 参数改为100add it yourself if you don’t have it.
Ctrl+s to save, Ctrl+x to exit
(5) Start and view
Kill the motion first.

sudo killall -TERM motion

Then start motion.

sudo motion

Now you can go to the browser to view the real-time monitoring, and enter in the browser:
**Note: **The following IP is replaced with your own Raspberry Pi IP address, for example, mine is 192.168.137.79, and then it ishttp://raspberry 192.168.137.79:8081

http://raspberry IP:8081

insert image description here

3. Summary

I just started to get in touch with Raspberry Pi, and I plan to use Raspberry Pi to do some small projects I like, and use this blog series as my own study notes to communicate and learn with everyone. The May 1st holiday is over, and I wish everyone a happy May 4th Youth Day! I would like to share the passion of youth with all of you.


Additional articles:

[Record] [Tutorial] Raspberry Pi + server + frp realizes intranet penetration for remote real-time video
to solve the problem of high motion delay, and the delay of remote real-time video is controlled at about 100ms.
[Tutorial] [Record] Raspberry Pi Raspberry+mjpg-streamer+camera realizes photo, video and real-time video functions

Guess you like

Origin blog.csdn.net/qq_44696500/article/details/124586822