Тёмный

Beginner Tutorial: How to Stream Video from Raspberry Pi Camera to Local Computer using Python (P1) 

Shilleh
Подписаться 3,7 тыс.
Просмотров 23 тыс.
50% 1

Learn how to set up a Flask App on your Raspberry Pi and create a live video feed that you can access on your local network, creating a real-time security camera. You will be able to view the video stream over the internet on your local network by the end of this video! All you will need is a Raspberry Pi (I used a 4b), a camera, and a power supply.
Where to buy a camera:
www.raspberrypi.com/products/...
Donate or Book a Consulting Slot:
www.buymeacoffee.com/mmshilleh
Join this channel to get access to the perks:
/ @mmshilleh
Link to Medium Article:
/ how-to-stream-video-fr...
Link to Blog Post:
shillehtek.com/blogs/news/beg...
Link to Medium Article:
/ how-to-stream-video-fr...
TIMESTAMPS:
00:00 Intro
01:49 Package Installation
05:26 Code Walkthrough

Наука

Опубликовано:

 

1 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 89   
@mmshilleh
@mmshilleh 3 месяца назад
If this video saved you time or you learned something, please Subscribe to the channel. Every subscription means I can continue making more informative and better videos for the community, thank you all!
@joethehoe8839
@joethehoe8839 4 месяца назад
Great video thanks for giving information about the code being used in it, most videos dont explain what the code is actually doing but you do a great job !
@mmshilleh
@mmshilleh 4 месяца назад
Glad it helped! Yeah unfortunately there is a tradeoff between going into detail and people's attention spans haha, so I am very glad I am in the goldilocks zone for this one :)
@dabunnisher29
@dabunnisher29 6 месяцев назад
Great video man.
@mmshilleh
@mmshilleh 6 месяцев назад
Hey thank alot I appreciate it :) yeah cameras are cool
@mattkojetin8198
@mattkojetin8198 6 месяцев назад
Very nice! Thank you!
@mmshilleh
@mmshilleh 6 месяцев назад
You bet!
@james1760
@james1760 4 месяца назад
Well made video, very helpful!
@mmshilleh
@mmshilleh 4 месяца назад
Thank you again pal! Hope you subscribe :)
@ikponmwosai.k.evbayiro1771
@ikponmwosai.k.evbayiro1771 5 месяцев назад
Hello, I'm trying to do this same thing with a USB Camera module, is there any edits you suggest to this prcess?
@mmshilleh
@mmshilleh 5 месяцев назад
Hey buddy never used that module not sure, to be honest. Goodluck mate :)
@denigajah6369
@denigajah6369 Месяц назад
Great video. im wondering if you could tell me what os of raspberry are you using in this video? im having trouble finding turning on legacy camera option in my OS, it doesnt have any. Should i install legacy OS system? or something elses. aslo there are many error in the code which said that there is no such file or directory for the picamera, so from there i figure that it might have something to do with OS differences. If you could reply to this quick i would greatly appreciate it because i need it for my final university project which is due soon
@mmshilleh
@mmshilleh Месяц назад
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
@OverAndOverAndOver
@OverAndOverAndOver 3 месяца назад
Dawg, this is EXACTLY what I have been looking for for SO LONG!!! The code is mad simple and self explanatory, I really appreciate this man... I'm a bit of a newbie when it comes to coding systems like this that directly interface with IO on a non-windows based machine, is there a means of using a USB camera on this to stream from the Pi, like a Logitech WebCam or similar as the "PiCamera" in question, or does the "PiCamera" package allow this code to be so small with the ease of "camera.resolution" "camera.framerate" and "capture.continous"?
@mmshilleh
@mmshilleh 3 месяца назад
I have another video where I utilized a USB camera, go ahead and watch that. Hopefully, it works for you. Don't forget to subscribe that's all I ask ;)
@OverAndOverAndOver
@OverAndOverAndOver 3 месяца назад
@@mmshilleh Don't worry, I subscribed after this video! I've seen that one, and it helped me substantially! Thank you again for these! Do you know of any other packages except for OpenCV that have this video capture functionality? I'm trying to package all dependencies for this little test application I'm making into itself so that I don't have to install separate packages while I'm installing the application I'm crafting
@mmshilleh
@mmshilleh 3 месяца назад
@@OverAndOverAndOver Honestly you could probably use some native python packages to save the image but it would be more complicated and you would have to get crafty on the bytes level. Python's standard library doesn't provide built-in functionality for capturing video from cameras hence why opencv makes it super easy to do so in one line of code
@swastikdey7498
@swastikdey7498 3 месяца назад
Hello, thanks for the video guide. I faced some errors, which is, when I am typing the ip address followed by port number and video feed, my local computer shows me INTERNAL SERVER Error, and the raspberry pi display also show some different type of exception.
@mmshilleh
@mmshilleh 3 месяца назад
Hard to debug that without specifics my friend
@danielsher5439
@danielsher5439 4 месяца назад
Tried doing this with a pi zero2w, can't get it to work. Script by lutz channel works but not using flask, which I would prefer. When loading the webpage, it never actually loads.
@mmshilleh
@mmshilleh 4 месяца назад
Sorry to hear that, yeah there are so many cameras and OS's and potential issues that can go wrong here. I leave it up to the viewer to debug any edge cases to be frank
@Brahim-hx1vr
@Brahim-hx1vr 4 месяца назад
hello what version of os do you use pls ?
@mmshilleh
@mmshilleh 4 месяца назад
Great question PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)" Hope you subscribe ;)
@gyaanipakiya1889
@gyaanipakiya1889 3 месяца назад
I'm using Pixy Cam 2 as the camera, what I've to do for this?
@mmshilleh
@mmshilleh 3 месяца назад
I have another video on that, can you try it?
@danielg1165
@danielg1165 4 месяца назад
Great video, thanks a lot!! Could you give advice what to change when using the latest picamera2 library? Especially how to replace the capture.continuous attribute?
@mmshilleh
@mmshilleh 4 месяца назад
I would have to check for you buddy, I havent played with that camera in a couple weeks! Never used that library. I am gonna make a part 3 soon so hopefully I remind myself to look into this question. I will add a note ;)
@danielg1165
@danielg1165 4 месяца назад
Awesome, looking forward to part three! Maybe streaming by using the picamera2 library is interesting for the community. The picamera library seems not to be supported anymore for latest OS - at least that is my understanding as a beginner… but please correct me :)
@jaxjax7318
@jaxjax7318 29 дней назад
@@mmshilleh @danielg1165 Cant wait to get this running on picamera2 with wide noir
@tiennguyen4025
@tiennguyen4025 3 месяца назад
Hi Sir, I am doing the exact same project at school, I notice errors when importing picamera in the python file, it was related to my RaspbianOS build being 64-bit instead of 32-bit, I just want to know if your RaspbianOS is 32-bit ?
@mmshilleh
@mmshilleh 3 месяца назад
Not sure will need to check sometime, I am on vacation :(
@denigajah6369
@denigajah6369 Месяц назад
@@mmshilleh any news on what os u using great guy?
@haroldbarner6865
@haroldbarner6865 4 месяца назад
Great video! I just have one issue. When I enter the inet address into my computer, it starts a download instead of a stream. When I stop/cancel the download, it automatically restarts in a couple of minutes.
@mmshilleh
@mmshilleh 4 месяца назад
Very weird no idea here, that should not happen if you are using the same code... sorry fam
@haroldbarner6865
@haroldbarner6865 4 месяца назад
Thank you, I appreciate it. Maybe some browser/firewall settings. 🤷🏽‍♂️
@logeinn_3396
@logeinn_3396 Месяц назад
do I have to use bullseye os I am using raspberry pi 4 ubuntu linux os, Thonny ide and it is not working, do you have a solution and thank you
@mmshilleh
@mmshilleh Месяц назад
Idk, hard to tell
@mattkojetin8198
@mattkojetin8198 6 месяцев назад
I'm going to use that idea for a parking camera.
@mmshilleh
@mmshilleh 6 месяцев назад
That is a solid idea. First thought to me is I am wondering how much power it consumes
@highroyds
@highroyds 4 месяца назад
Hi, Tried this on bullseye and worked perfectly, but when I tried with bookworm I couldnt get it to work at all. The pip commands dont work btw, but the script doesnt work with stating theres no module.
@mmshilleh
@mmshilleh 4 месяца назад
Sorry to hear about the trouble with Bookworm. Here are a few suggestions: Check Python & pip Versions: Use python3 --version and pip3 --version to ensure you're using the correct versions. Debian Bookworm might have updated defaults. Install/Update pip: If pip isn't working, try sudo apt-get install python3-pip to install or update pip for Python 3. Use a Virtual Environment: This can help manage dependencies. Create one with python3 -m venv myenv and activate it using source myenv/bin/activate. Install Missing Modules: Ensure all required modules are installed within the environment, e.g., pip install numpy for the numpy module. Permissions & $PATH: Check your permissions and ensure your $PATH includes Python and pip locations. Sometimes sudo or adjusting $PATH can resolve issues. If these steps don't help, consider checking Debian and Raspberry Pi documentation or community forums for specific advice on Bookworm.
@RossPotts
@RossPotts 4 месяца назад
By any chance were you using a non-branded (raspberry pi) camera? I could not get mine to work on bookworm until I got a branded camera and cable. I also fell down a rabbit hole on the raspy forums where it seems branded cables are cross-overs. It was a combo for me: camera and cable.
@highroyds
@highroyds 4 месяца назад
@@RossPotts yes, it’s an arducam 5 mb camera. I did get it to work on another app perfectly that I got from GitHub
@LaserGrunt
@LaserGrunt 6 месяцев назад
Can you do a setup that does video and 2 way audio ?
@mmshilleh
@mmshilleh 6 месяцев назад
Dont have that in the pipeline but I will definitely take note buddy!
@RizGaming1
@RizGaming1 24 дня назад
i cannot see the legacy camera enable option in interface, while libcamera-still command is showing that my camera v2 is working, can anyone guide in this regard
@mmshilleh
@mmshilleh 22 дня назад
Perhaps you have a newer OS
@RizGaming1
@RizGaming1 22 дня назад
@@mmshilleh yes i got it, i installed the old version now everything works fine.
@STMONDEO1
@STMONDEO1 17 дней назад
Hi Shilleh solved the problem with line5. The other problem i have is when i put the ip address of the pi into a web browser it says cannot connect. The pi and pc are on the same network.
@mmshilleh
@mmshilleh 16 дней назад
Hmmm did you mess around with any firewall settings? Are you seeing any python logs on the Raspberry Pi side?
@STMONDEO1
@STMONDEO1 16 дней назад
@@mmshilleh Hi i have not messed around with any firewall. How do i check python logs.
@STMONDEO1
@STMONDEO1 18 дней назад
Hi please can you tell me why i get a error message on Line 5. about (name). I have checked ever bit of your code but when i try to run the program it keeps saying (ERROR) Line 5 (name)
@mmshilleh
@mmshilleh 17 дней назад
A lot of this depends on your OS and Python Version, hard to say!
@STMONDEO1
@STMONDEO1 17 дней назад
@@mmshilleh What version of OS are you using.
@AngelaLaCreatrice
@AngelaLaCreatrice 3 месяца назад
What is that software that you used to create in the Python script?
@mmshilleh
@mmshilleh 3 месяца назад
Are you referring to Flask? Flask is a framework/library in Python that allows you to host something called a web server. A web server is a basic building block of web applications.
@EsotericArctos
@EsotericArctos 4 месяца назад
Can this be done with the new Camera-Streamer (libcamera) instead of the legacy camera, which is going to be removed soon?
@mmshilleh
@mmshilleh 4 месяца назад
Hey sorry might get one soon, never tried that yet!
@MattMascolo.
@MattMascolo. 4 месяца назад
Got this working with libcamera. Used libcamera and ffmpeg to create a m3u8 stream then flask and hls-js to have the stream show on the webpage. Good luck! It's also possible to do with python3-tornado and websockets but that was a little complex for me.
@ajitgupta1530
@ajitgupta1530 3 месяца назад
@@MattMascolo. Hey can you please share your code of libcamera Thanks
@bungle6334
@bungle6334 2 месяца назад
On OS version 'bookworm', the option does appear to have been removed.
@MattMascolo.
@MattMascolo. 2 месяца назад
@@ajitgupta1530 just now seeing this, I'll boot it up and get the code this evening into a GitHub.
@STMONDEO1
@STMONDEO1 11 дней назад
@STMONDEO1 5 days ago Hi Shilleh Do i need to port forward this raspberry pi for me to view this camera.
@mmshilleh
@mmshilleh 11 дней назад
if its from an external IP address you have to yes
@STMONDEO1
@STMONDEO1 10 дней назад
@@mmshilleh Hi i have tried every thing but still no joy. I can view the Raspberry pi through VNC with my PC no problem. So i no they are both on the same Network. But for some reason i cannot view the camera over the internet.
@vikramgogoi3621
@vikramgogoi3621 28 дней назад
Do we need internet connection? Both devices just have on be on the same network, right?
@mmshilleh
@mmshilleh 28 дней назад
They do, but you can use a tailscale to do this externally
@vikramgogoi3621
@vikramgogoi3621 28 дней назад
@@mmshilleh Thank you
@HoiPolloi
@HoiPolloi Месяц назад
Which OS version are you using?
@mmshilleh
@mmshilleh Месяц назад
See comments !
@RemyAngelle
@RemyAngelle 2 месяца назад
what operating system are you using?
@mmshilleh
@mmshilleh 2 месяца назад
Bullseye ;)
@noumanahmedkhan8630
@noumanahmedkhan8630 5 месяцев назад
Legacy camera option not available in my pi 4 why?? Please help
@mmshilleh
@mmshilleh 5 месяцев назад
Check Raspberry Pi OS Version: Ensure your Raspberry Pi OS is up to date. The legacy camera support might require specific versions of the OS.
@noumanahmedkhan8630
@noumanahmedkhan8630 5 месяцев назад
@@mmshilleh I have desbian bookworms that has auto detect camera feature enable but I am getting no camera.... In 32 bit os my noir camera v2 working fine but in 64 bit os no camera available please help
@Emrose_Green
@Emrose_Green 4 месяца назад
If you are using Bookworm then legacy camera support is no longer supported, but if you switch to Bullseye then it should have legacy camera support. There are some tradeoffs when doing this switch, but if you really need it then go for it, otherwise you could try using a branded camera and cable that works with the Raspberry Pi. I am using an OV5647 5MP 1080P Arducam which I have found needs legacy camera support.
@Jun-zq3bn
@Jun-zq3bn Месяц назад
followed the tutorial but i got: OSError: libmmal.so: cannot open shared object file: No such file or directory what should i do?
@mmshilleh
@mmshilleh Месяц назад
Make sure you update apt and redownload all of your packages sudo apt-get update
@Jun-zq3bn
@Jun-zq3bn Месяц назад
@@mmshilleh tried that but to no avail. even tried reinstalling the os. any workarounds?
@mmshilleh
@mmshilleh Месяц назад
​@@Jun-zq3bn Hard to say without me having access to your OS tbh! You can always consult with me on buymeacoffee link but otherwise you will have to debug yourself. I have not seen this error before.
@thanhchung9133
@thanhchung9133 Месяц назад
Can i use the webcam for this project ?
@mmshilleh
@mmshilleh Месяц назад
You can as long as it connects to the Pi with USB
@thanhchung9133
@thanhchung9133 Месяц назад
​@@mmshilleh Thank you so much!
@anupr3592
@anupr3592 4 месяца назад
When is the next part coming ?
@mmshilleh
@mmshilleh 4 месяца назад
Soon my friend, soon
@anupr3592
@anupr3592 4 месяца назад
@@mmshilleh Thank you man.
@RemyAngelle
@RemyAngelle 2 месяца назад
is this bullseye or buster?
@mmshilleh
@mmshilleh 2 месяца назад
Bullseye
Далее
Testing out the NEW Raspberry Pi Camera Module 3
9:40
Просмотров 303 тыс.
Викторина от МАМЫ 🆘 | WICSUR #shorts
00:58
Good deed #standoff #meme
00:15
Просмотров 682 тыс.
I Can Save You Money! - Raspberry Pi Alternatives
15:04
Pico W Episode 1: Setting Up the Raspberry Pi Pico W
12:48
Hacking Windows TrustedInstaller (GOD MODE)
31:07
Просмотров 412 тыс.