Cov txheej txheem:

IP Lub Koob Yees Duab Siv Raspberry Pi Zero (Kev Tshawb Xyuas Hauv Tsev Ntu 1): 5 Cov Kauj Ruam
IP Lub Koob Yees Duab Siv Raspberry Pi Zero (Kev Tshawb Xyuas Hauv Tsev Ntu 1): 5 Cov Kauj Ruam

Video: IP Lub Koob Yees Duab Siv Raspberry Pi Zero (Kev Tshawb Xyuas Hauv Tsev Ntu 1): 5 Cov Kauj Ruam

Video: IP Lub Koob Yees Duab Siv Raspberry Pi Zero (Kev Tshawb Xyuas Hauv Tsev Ntu 1): 5 Cov Kauj Ruam
Video: Ib Ob Peb, Los Seev Cev (Official Music Video) - Douachi Yang 2024, Hlis ntuj nqeg
Anonim
IP Lub Koob Yees Duab Siv Raspberry Pi Zero (Kev Tshawb Fawb Hauv Tsev Ntu 1)
IP Lub Koob Yees Duab Siv Raspberry Pi Zero (Kev Tshawb Fawb Hauv Tsev Ntu 1)

Nov yog thawj qhov kev tshaj tawm hauv cov yeeb yaj kiab tshiab, uas peb tsim lub tsev saib xyuas lub tsev, feem ntau yog siv Raspberry Pis. Hauv kab ntawv no, peb siv Raspberry PI xoom thiab tsim lub koob yees duab IP uas tso cov vis dis aus hla RTSP. Cov vis dis aus tso tawm yog qhov ua tau zoo dua qub piv rau qhov piv txwv yav dhau los thiab txawm tias yog esp32-cam pawg thawj coj. Los ntawm lub neej ntawd, nws tau teeb tsa tso tawm 1080 video ntawm 30fps nrog tus nqi me ntsis ntawm 2Mbps, tab sis txhua qhov no tuaj yeem hloov kho kom haum rau koj cov kev xav tau.

Cov vis dis aus saum toj no coj koj mus rau tag nrho cov txheej txheem thiab kuv yuav pom zoo saib ua ntej, kom tau txais cov ntsiab lus ntawm yuav ua li cas nws txhua tus tuaj ua ke.

Kauj Ruam 1: Sau cov Cheebtsam

Sau cov Cheebtsam
Sau cov Cheebtsam

Peb yuav siv Raspberry Pi xoom ntawm no, feem ntau yog vim nws yog qhov me me thiab pheej yig dua piv rau lwm qhov sib txawv. Txawm li cas los xij, qhov no tseem yuav ua haujlwm nrog lwm yam Raspberry Pi hloov pauv.

Nov yog cov khoom tseem ceeb uas peb xav tau:

  • Raspberry Pi pawg thawj coj saib
  • daim npav microSD
  • Lub koob yees duab module
  • Haum lub koob yees duab cable
  • Lub hwj chim tsim nyog
  • USB daim npav nyeem ntawv kom nkag mus rau daim npav thiab nws muaj cov ntsiab lus

Kauj Ruam 2: Thauj Cov Txheej Txheem Ua Haujlwm

Load lub Operating System
Load lub Operating System
Load lub Operating System
Load lub Operating System
Load lub Operating System
Load lub Operating System

Thawj qhov peb yuav tsum tau ua yog thauj lub kaw lus ua haujlwm ntawm daim npav microSD. Txhawm rau ua qhov no, mus rau nplooj ntawv rub tawm ntawm Raspberry Pi lub vev xaib thiab rub tawm Raspbian Lite OS.

www.raspberrypi.org/downloads/raspbian/

Tom qab ntawd, rub tawm thiab teeb tsa Etcher, yog tias koj tsis muaj qhov no. Xaiv cov duab koj rub tawm, xyuas kom tseeb tias koj tau xaiv daim npav microSD thiab tom qab ntawd nyem lub pob nyem. Tos kom nws ua tiav.

Tom qab ntawd peb yuav tsum ua kom muaj kev sib txuas WiFi los ntawm kev tsim cov ntaub ntawv wpa_supplicant.conf hauv khau raj. Koj tseem tuaj yeem rub tawm cov qauv hauv qab no thiab hloov kho nws nrog koj cov ntsiab lus - lub teb chaws tus lej, lub npe network thiab tus password. Nws raug nquahu kom siv cov ntawv sau zoo li notepad ++ lossis zoo li ua qhov no.

www.bitsnblobs.com/wp-content/uploads/2020/05/wpa_supplicant.txt

Qhov kawg uas yuav tsum tau ua yog ua kom SSH. Qhov no tso cai rau peb kom nkag mus tau deb thiab tswj hwm Raspberry Pi, hla lub network. Ua qhov no yooj yim. Cias siv ib qho ntawm cov ntawv kho kab lus hais los saum no los tsim cov ntawv tshiab, thiab tom qab ntawd khaws nws rau hauv bootdrive nrog lub npe "ssh". Koj tsis tas yuav ntxiv ib qho txuas ntxiv rau hauv cov ntawv.

Tam sim no peb tau npaj ua lub zog rau ntawm lub rooj tsavxwm, yog li ntxig daim npav microSD rau hauv lub rooj tsavxwm thiab txuas lub koob yees duab siv lub xov tooj. Ua siab mos siab muag nrog cov kab ntawv txuas vim tias lawv me ntsis muag. Thaum ua tiav, ntxig rau microUSB cable thiab lub zog rau ntawm lub rooj tsavxwm. Nws yuav siv sijhawm li ib feeb los khau raj tag, yog li muab sijhawm rau nws.

Txhawm rau sib txuas lus nrog pawg thawj coj siv ssh, peb xav tau IP chaw nyob ntawm pawg thawj coj. Rub tawm thiab teeb tsa AngryIP scanner raws li qhov no yuav pab peb tau txais nws. Koj tseem tuaj yeem rub tawm qhov qub version ntawm lub qhov rais, uas tsis xav tau kev teeb tsa. Thaum ua tiav, nkag mus rau IP ntau yam raws li qhia hauv daim duab thiab ntaus lub pob pib. Tos rau nws txhawm rau txheeb xyuas lub rooj tsavxwm thiab tom qab ntawv nws yog IP chaw nyob. Tus IP chaw nyob ntawm kuv pawg thawj coj yog 192.168.1.35

Kauj Ruam 3: SSH Nkag Rau & Npaj Ua Haujlwm

Qhib qhov hais kom ua qhov rai los ntawm kev ntaus "cmd" hauv cov ntawv qhia zaub mov Pib. Koj tuaj yeem siv lub davhlau ya nyob twg yog tias koj nyob ntawm Mac OS. Tom qab ntawv, ntaus "ssh [email protected]" thiab ntaus nkag. Nco ntsoov siv IP Nws yuav nug koj yog tias koj xav kom txheeb xyuas qhov tseeb/khaws tus yuam sij. Ntaus hauv yog thiab ntaus tus yuam sij nkag mus. Nws mam li nug koj tus password, yog li nkag mus "raspberry" uas yog tus password tsis raug, thiab tom qab ntawd ntaus nkag dua. Qhov no yuav teev koj rau hauv pawg thawj coj saib.

Ua ntej peb tuaj yeem ua haujlwm ntawm tsab ntawv tseeb, peb yuav tsum ua kom lub koob yees duab hloov pauv. Qhov no tuaj yeem ua tiav los ntawm kev khiav "sudo raspi-config" hais kom ua. Nkag mus rau "Cov Kev Xaiv cuam tshuam", tom qab ntawd "Lub Koob Yees Duab" thiab ntaus nkag. Xaiv "yog" thaum nws nug koj yog tias koj xav pab lub koob yees duab thiab tom qab ntawv mus rau qhov "Ua tiav" kev xaiv. Nws yuav nug koj yog tias koj xav rov pib dua. Xaiv "yog" thiab tom qab ntawd tos rau lub rooj tsavxwm kom rov pib dua. Muab lub rooj tsavxwm ib feeb thiab tom qab ntawd ssh rov qab rau nws zoo li ua ntej.

Tom ntej no, nws yog lub tswv yim zoo los hloov kho OS yog li ntaus hauv "sudo apt hloov tshiab" thiab ntaus nkag. Tom qab ntawv ntaus sudo apt hloov kho tshiab "thiab ntaus nkag.

Thaum kawg, peb yuav tsum teeb tsa vlc thiab qhov no tuaj yeem ua tiav los ntawm kev khiav "sudo apt-get install vlc" hais kom ua. Ua raws li cov lus qhia thiab tos kom nws ua tiav. Tam sim no koj tuaj yeem txav mus rau qhov tsim tsab ntawv.

Kauj Ruam 4: Tsim & Xeem Tsab Ntawv

Tsim & Xeem Tsab Ntawv
Tsim & Xeem Tsab Ntawv
Tsim & Xeem Tsab Ntawv
Tsim & Xeem Tsab Ntawv

Txhawm rau tsim tsab ntawv, khiav cov lus txib hauv qab no "sudo nano rtsp-stream.sh". Qhov no yuav qhib cov ntawv nyeem thiab tom qab ntawd koj tuaj yeem ntaus cov ntsiab lus ntawm tsab ntawv uas tau qhia hauv qab no:

#!/bin/tsoo

raspivid -o --t 0 -rot 180 -w 1920 -h 1080 -fps 30 -b 2000000 | cvlc -vvv kwj: /// dev/stdin --sout '#rtp {sdp = rtsp: //: 8554/stream}': demux = h264

Peb tsuas yog tsim cov vis dis aus siv cov lus txib raspivid thiab peb tom qab ntawd ua qhov no muaj nyob hauv lub network siv VLC. Koj tuaj yeem hloov kho qhov kev daws teeb meem, tus lej tus nqi thiab tus lej kom haum rau koj cov kev xav tau. Qhov txuas hauv qab no yuav coj koj mus rau nplooj ntawv uas cuam tshuam nrog qee cov ntaub ntawv.

www.raspberrypi.org/documentation/usage/camera/raspicam/raspivid.md

Thaum qhov no ua tiav, nias "CTRL+X" cov yuam sij thiab nws yuav qhia koj kom khaws Cov Ntaub Ntawv. Ntaus "y" thiab ntaus nkag mus txuag. Tom qab ntawd peb yuav tsum ua tsab ntawv no kom ua tiav thiab tuaj yeem ua tiav los ntawm kev ua haujlwm "chmod +x rtsp-stream.sh" hais kom ua. Txhawm rau ua tsab ntawv, tsuas yog ntaus "./rtsp-stream.sh" thiab ntaus nkag. Qhov no yuav pab kom kwj.

Txhawm rau saib cov kwj deg, koj yuav tsum rub tawm thiab siv VLC. Thaum ua tiav, xaiv qhov "Qhib Network" xaiv los ntawm Cov Ntawv Qhia zaub mov thiab nkag mus rau URL hauv qab no:

"rtsp: //192.168.1.35: 8554/ntws"

Ib zaug ntxiv, nco ntsoov siv tus IP chaw nyob ntawm koj lub rooj tsavxwm. Tom qab ntawd, ntaus lub pob qhib thiab koj yuav tsum tuaj yeem pom cov kwj deg.

Yog tias koj xav tshuaj xyuas cov peev txheej siv, tom qab ntawd koj tuaj yeem qhib lub qhov rai hais kom ua tshiab, SSH rau hauv lub rooj tsavxwm thiab tom qab ntawv ua haujlwm "saum toj" hais kom ua. Thov saib cov vis dis aus kom paub meej ntxiv.

Kauj ruam 5: Automate Kwj

Automate Kwj
Automate Kwj

Tam sim no peb paub tias cov kwj dej ua haujlwm, peb tsuas xav tau siv nws zoo li nws tau khiav ntawm kev pib. Ua qhov no yog qhov yooj yim, tsuas yog ua raws cov lus txib hauv qab no "sudo nano /etc/systemd/system/rtsp-stream.service". Qhov no yuav qhib cov ntawv kho kom raug thiab koj yuav tsum ntaus hauv cov hauv qab no:

[Chav]

Nqe lus piav qhia = pib pib kwj

Tom qab = ntau-user.target

[Kev pabcuam]

Hom = yooj yim

ExecStart =/tsev/pi/rtsp-stream.sh

User = pib

WorkingDirectory =/tsev/pi

Rov pib dua = ntawm-ua tsis tiav

[Nruab]

WantedBy = ntau-user.target

Thaum ua tiav, txuag cov ntawv los ntawm nias "CTRL+X" cov yuam sij, tom qab ntawd Y, tom qab ntawd Enter. Peb tom qab ntawd yuav tsum ua kom muaj kev pabcuam los ntawm kev ua cov lus txib hauv qab no "sudo systemctl pab rtsp-stream.service". Qhov ntawd yog txhua yam peb yuav tsum tau ua. Lub sijhawm tom ntej ntawm lub rooj tsavxwm, nws yuav ua tiav qhov kev pabcuam uas yuav hu rau tsab ntawv. Koj tseem tuaj yeem tswj hwm kev pabcuam tus kheej siv cov lus txib hauv qab no:

Txhawm rau pib: "sudo systemctl pib rtsp-stream.service"

Txhawm rau Nres: "sudo systemctl nres rtsp-stream.service"

Saib Cov xwm txheej: "sudo systemctl xwm txheej rtsp-stream.service"

Rov pib dua lub rooj tsavxwm los ntawm kev ua "sudo reboot" hais kom ua. Muab nws ib pliag rau khau raj thiab tom qab ntawd qhib VLC los saib cov kwj deg.

Thiab yog li cas koj tuaj yeem tsim lub koob yees duab IP siv Raspberry Pi xoom. Txhua lub sijhawm lub rooj tsav nkoj, nws yuav cia li tsim cov kwj deg thiab koj tuaj yeem saib qhov no nyob deb. Hauv qhov tshaj tawm tom ntej no, peb yuav kawm paub tsim NVR uas yuav tso cai rau peb saib ntau lub kwj deg thiab khaws cia rau qee qhov chaw cia. Yog tias koj nyiam cov phiaj xwm no, tom qab ntawv thov txiav txim siab tso npe rau hauv peb YouTube channel vim nws pab peb txuas ntxiv tsim cov phiaj xwm zoo li no.

YouTube:

Ua tsaug rau koj nyeem!

Pom zoo: