DIY Smart Security Camera Python Project - Setting Up The RTSP Stream

Поделиться
HTML-код
  • Опубликовано: 18 июн 2024
  • Today I’ll be starting the smart security camera project that I talked about recently in another video. I’ll be creating a Python program that will take advantage of A.I. and machine learning models such as YOLO object detection so that it will only start recording when it detects a person on the camera. This program will work with any IP camera that supports the RTSP protocol. In this video I show how to set up your own RTSP video stream using a USB webcam or the Raspberry Pi camera, and in my following video I'll be showing the first Python program.
    Part 2: • DIY Smart Security Cam...
    RTSP guide used in this video: phazertech.com/tutorials/rtsp...
    Anpviz 5MP PoE IP Dome Camera: amzn.to/3L8W1yL
    These are affiliate links where I earn a small commission for purchases at no extra cost to you.
    This is the easiest way to help the channel, thank you!
    Amazon: amzn.to/484HUnU
    Website: phazertech.com/
    Donations
    Buy me a coffee: www.buymeacoffee.com/phazertech
    Chapters:
    00:00 Intro
    00:49 Motivations for the project
    02:23 Choosing a camera
    03:53 Set up your own RTSP stream
    10:23 VLC media player
    11:41 Timeline for project & Python programs
    13:16 Outro
  • НаукаНаука

Комментарии • 24

  • @CptFitzgerald
    @CptFitzgerald Год назад +1

    Awesome. I'm excited. We get a programming, and a little electrical engineering lesson on the side.

    • @PhazerTech
      @PhazerTech  Год назад +1

      Yea it should be a lot of fun! I know you've been waiting for this one. Afterwards I'm planning to focus on these sort of projects that involve programming and circuits. My hope is to make content that's approachable for anyone, so not only will it help college students who are taking intro engineering classes, but also anyone at home who's interested in learning this stuff.

  • @cjlowe1650
    @cjlowe1650 28 дней назад +1

    Hey silly question. I bought a few (but never used) Raspberry Pi Pico's. Do you know of any Diet-pi OS for them? Or since they are basically micro-controllers are the OS's already small? I also got a few ESP32 camera's and ESP32 Camera's on pico's. I assume the projects for RTSP are already stream lined for these type of boards? Just wondering if you had any knowledge of them or where to find the info. LOL. When you retire you start to get bored and go on-line buy crazy. LOL. The ESP32 cameras would be a better fit (size wise) for my Dummy Camera cases. Also any help you could give me or point me to so I could start a RUclips site like you have would be greatly appreciated. I think I'm gonna start and host a small website first to get started. Thanks in advance.

    • @PhazerTech
      @PhazerTech  27 дней назад

      You're correct, the Pi Pico is in fact a microcontroller (MCU for short). But MCUs actually don't have an OS. They can only run a single program, typically a C program but the Pico also supports micro Python. I'm planning to do videos on MCUs in the future. To program the ESP32 Cam as an RTSP camera you can use this project: github.com/rzeldent/esp32cam-rtsp
      I suggest using PlatformIO for programming MCUs.
      As far as starting a YT channel goes, I'm guessing YT didn't notify you on the other comment where I answered this. So I'll copy n paste my reply here again. The only software you really need is OBS Studio for recording video and audio, and a video editing program. There's lots of different video editing programs and it really comes down to personal choice. I use Shotcut since I mainly use Linux, but KdenLive is also a good choice. DaVinci Resolve is also a very popular choice and it works on all the platforms, but the free version is limited in features so you'd probably want to purchase a license for that one. And of course Adobe Premier is a popular choice for Windows users.
      The first thing I'd do is decide on which video editor you want to use, then watch a bunch of tutorials on it. Do the same for OBS Studio. You'll also want to get a good quality microphone and webcam or mirrorless camera. After that you should be good to go! Just use the "create" button on the top right of YT to upload your videos. Let me know if you have any specific questions and I'll be happy to answer. I'm guessing you're planning to make electronics projects? Or what type of content do you plan on making?

  • @williamlucid8907
    @williamlucid8907 Год назад +1

    Can a Wyse Cam v3 with RTSP be setup with this process? How?

    • @PhazerTech
      @PhazerTech  Год назад

      The process I showed will work for any camera that connects to a computer, such as USB webcams or the RPi camera. Most security cams such as the Wyze do support RTSP, but the exact steps to set it up will depend on the particular brand/model. Here's how to set it up on a Wyze Cam: support.wyze.com/hc/en-us/articles/360026245231-Wyze-Cam-RTSP

  • @cjlowe1650
    @cjlowe1650 28 дней назад +1

    Will it record audio also (if the cam has a mic) or USB microphone?

    • @PhazerTech
      @PhazerTech  27 дней назад +1

      Yes it will copy audio if the stream has audio. If you use my guide for setting up MediaMTX then you'll need to make sure your ffmpeg command includes audio. The command I provided in the written guide does not include audio since the RPi camera doesn't have mic. I'm planning to make another video on MediaMTX which will show how to do this for cameras that have a mic.

    • @cjlowe1650
      @cjlowe1650 26 дней назад +1

      Thanks for the reply. I bought a few USB mics for the raspberry pi's. Hopefully they will still work.

    • @cjlowe1650
      @cjlowe1650 15 дней назад

      ​@@PhazerTechforget my question about the mic in the other video. I just saw i have to find the code to record audio. Will let you know how it goes.

    • @PhazerTech
      @PhazerTech  15 дней назад

      ​@@cjlowe1650 First make sure you go into dietpi-config and enable audio. Now you'll need to include audio into the ffmpeg command. The command will be something like this: ffmpeg -f alsa -i plughw:1,0 -input_format h264 -video_size 1280x720 -framerate 30 -i /dev/video0 -c:v copy -c:a libopus -b:a 128k -r 30 -f rtsp rtsp://localhost:8554/StreamName -rtsp_transport tcp
      Notice there are several new options compared to the code on my website. "plughw:1,0" is the mapping to my particular audio device, chances are yours might be different mapping. Check out this link to determine what your plughw mapping will be: superuser.com/questions/53957/what-do-alsa-devices-like-hw0-0-mean-how-do-i-figure-out-which-to-use
      The '-c:a libopus' part is the codec. There are a large number of audio encoders that can be used, so if you have problems with libopus you can try aac or another codec. '-b:a 128k' sets the audio bitrate to 128k.

  • @atomicbuilds7579
    @atomicbuilds7579 4 месяца назад

    Hey, im trying to use this now and when i copy the ffmpeg -input_format.... line and execute it i get the following error: Cannot find a proper format for codec 'h264' (id 27), pixel format 'none' (id -1) /dev/video0: Invalid argument
    Any ideas how i can solve this?
    P.S. i did use the 1.5.1 version of mediamtx instead of the one used in the video

    • @PhazerTech
      @PhazerTech  4 месяца назад

      Which camera are you using?

    • @atomicbuilds7579
      @atomicbuilds7579 4 месяца назад

      @@PhazerTech Raspberry pi camera V2.1

    • @PhazerTech
      @PhazerTech  4 месяца назад

      @@atomicbuilds7579 And you already installed v4l-utils and ffmpeg, correct? What does the output of this command show?
      v4l2-ctl --list-devices

    • @atomicbuilds7579
      @atomicbuilds7579 4 месяца назад

      @PhazerTech its shows a list of devices including /dev/video0 there also has the h264 format if i use v4l2-ctl -d /dev/video0 --list-formats

    • @PhazerTech
      @PhazerTech  4 месяца назад

      @@atomicbuilds7579 Are you using DietPi or the vanilla RPi OS? I found this thread that appears to have your exact same issue: forums.raspberrypi.com/viewtopic.php?t=328574

  • @cjlowe1650
    @cjlowe1650 28 дней назад +1

    Move out of California!

    • @PhazerTech
      @PhazerTech  27 дней назад

      I know! I'm planning to at some point.