10 ms·
Raspberry Pi Webcam
- JohnTHaller 6y agoAssociated YouTube video with quality comparison: https://www.youtube.com/watch?v=8fcbP7lEdzY https://www.youtube.com/watch?v=8fcbP7lEdzY I just happened to have watched this earlier today.
- keeganpoppen 6y agothis is great, and im super into it, but i do find it kind of funny how the other post the author mentioned was “super vague”, whereas somehow installing ansible and blindly installing a random playbook is any more explicative. (for me it’s fine because i’m always happy to read the code— i’m not complaining) really glad to see a quality comparison; definitely gonna try this with my pi zero w i have lying around.
- geerlingguy 6y agoThe main comparison here is that IMO, if you've never encountered UVC-gadget, OTG configuration, dtparams, etc., then seeing/auditing an Ansible playbook that can reproducibly set up a Pi over and over is a lot simpler than reading through about 20 different steps of instructions that are setting up serial interfaces and the like. In the former case, you have something that many of us who are more intimate with code could follow along with and tweak. In the latter, it's something that still requires a little knowledge, but IMO a lot less to get started. Something like https://github.com/showmewebcam/showmewebcam https://github.com/showmewebcam/showmewebcam takes it a step further, but obfuscates some of the code more (IMO) by bundling it in an image that is generated with some build scripts (though that might be the direction I move my project eventually... people don't seem to care as much about trust and auditability nowadays).
- raspyberr 6y agoWhat I do actually like about this is that it has no microphone. It's impossible to find a decent webcam without a microphone.
- lucb1e 6y agoYou can just select a different mic input? Or desolder it if it's a security concern? It's not that difficult, speaking as someone with three left hands when it comes to soldering (or drawing for that matter) and next to zero experience with hardware/electronics. Recently took out the camera board from a webcam and added an LED: that consisted of removing a few screws, wiggling some plastic clips until it came apart, and finally a bit of yolo soldering an LED from an old keychain light onto the + and - pins of the USB connector. It's almost certainly the wrong voltage but it works. I also removed a speaker from an annoying toy: undo a screw, wiggle, identify speaker (activate the toy a few times), and just hold the soldering iron's tip to the pins until it comes off. With a 5 minute internet video on how melting solder works, I'd be fairly confident that my mom can desolder a microphone without damaging the webcam. (She'd just need more confidence in herself..!)
- rcarmo 6y agoI'm using https://github.com/showmewebcam/showmewebcam https://github.com/showmewebcam/showmewebcam, which is a prebuilt image with a (more) finely tuned uvc-gadget implementation and lower CPU usage when idle (I've added a few tweaks to it myself). It also boots _very_ fast. Works great, although you do have to fine-tune the settings for your environment (which you can do by editing a camera.txt file on the SD card or using a serial TTY via USB) (edit: typos)
- voltagex_ 6y agoOh hey, it's an actually good example of using an external buildroot tree. Often vendors will ship the whole of buildroot from about 4 years ago with their patches on top (of course, with no source control so you have to diff it yourself to extract their changes)
- deleted 6y ago[deleted]
- lucgommans 6y agoDoes anyone know of a raspberry pi (or similar) webcam system that can upload an encrypted video stream to a server? Preferably a (any) plain file host rather than hosting some custom service, but I'm interested in either option. I want to have an off-site backup of the security cam but preferably only access my camera data myself. That's what I'm always missing in these projects. There are dozens, perhaps hundreds of raspberry pi (security) camera setup tutorials and scripts with motion detection and all sorts of features, but I haven't found any that implement any sort of encryption, if they do uploading at all...
- zamadatix 6y agoDepends what you mean by "plain file host". To some that means a server I control that has a simple file share configuration. To others that means Google Drive. In the case of the former just mount the storage securely on the pi and save "locally" to it. Could be as simple as mounting the remote server via sshfs and selecting that mount directory to save the file. In the case of the latter usually a similar concept but depends on the service/protocol.
- lucgommans 6y ago> Could be as simple as mounting the remote server via sshfs Right but that's not encrypted and requires me to maintain another server. With unattended upgrades it isn't much, but it adds up if you have ten other things already running and you're actually trying to downsize this time commitment (mainly for the major version upgrades which take days out of holidays every few years, upgrading and re-testing everything again, sometimes fixing dependency issues, reinstalling things...). Storage can be an "as a service" thing these days, indeed Google Drive / OVH NAS / hosted NextCloud / HiDrive / etc. is what I meant, basically anything that could interface with a pi in a way that it uploads the encrypted stream, so you capture whoever unplugs it -- at least that's how I imagine a regular security camera would work. But then, the only things I find online start at 4 figures and none of them are open source so who knows what encryption (if any) they really apply... Is there really no one on this planet running open source encrypted cameras, are all these systems that consumers use (some of whom are hackers) 100% proprietary, plaintext, or only stored on-site?
- rubatuga 6y agoQuality is not that great unfortunately.
- MR4D 6y agoCan you elaborate? I thought the YouTube video looked pretty good.
- rubatuga 6y agoFor between $22 to $72, you can put together a cracked/used iPhone 5S ($50 to free), a MS2109 HDMI capture ($7), and a lightning to HDMI adapter ($15), CameraVision app (free), and obtain a much, much higher quality video, incl. autofocus.
- walrus01 6y agofrom the article: > Powering down the Pi If you want, and you still have WiFi enabled, or the Pi is otherwise connected to your network, you can log into it via SSH and run sudo shutdown now to power it off cleanly. But I like living on the edge... it's not like the thing is writing a ton of data to the microSD card. When I'm finished using it as a webcam, I just unplug it. Simple as that. If, for some strange reason, it did end up getting corrupted, I could just re-run this automation to set it up again. No big deal! I haven't had that happen yet, though. ################ If you want to do this you can tune ext4fs to flush writes to disk more often, which does have a small impact on disk performance (a moot point on something using a microsd card for a / partition, really, and on the anemic cpu performance of a pi zero w). if you google "ext4fs power loss flush writes" you'll find some other references to making an ext4 system slightly more resilient to being abruptly powered off. https://lwn.net/Articles/322823/ https://lwn.net/Articles/322823/ One possible solution is, of course, to just run ext3. Another is to shorten the system's writeback time, which is stored in a couple of sysctl variables: /proc/sys/vm/dirty_expire_centisecs /proc/sys/vm/dirty_writeback_centisecs The first of these variables (dirty_expire_centiseconds) controls how long written data can sit in the page cache before it's considered "expired" and queued to be written to disk; it defaults to 30 seconds. The value of dirty_writeback_centiseconds (5 seconds, default) controls how often the pdflush process wakes up to actually flush expired data to disk. Lowering these values will cause the system to flush data to disk more aggressively, with a cost in the form of reduced performance.
- fuzzy2 6y agoI think a readonly root + tmpfs overlay is a better solution. Like live Linux, but without squashfs. It would also greatly prolong SD card life.
- bmurphy1976 6y agoI love this! I've been using mine as a webcam for a couple months now (among other side-projects). You need a different lens though. The 6mm fisheye lens is crappy and the distortion is terrible. The 16mm lens is higher quality but the zoom makes it difficult to use as a webcam. I bought the 6mm M12 portrait lens from https://commonlands.com/products/portrait-6mm-m12-lens https://commonlands.com/products/portrait-6mm-m12-lens which works much better. Being M12 it's not the best form factor, but it has a rectilinear picture and the framing is what you want for a webcam.
- kingosticks 6y agoIsn't the example footage in this video using the fisheye lens? Where is the distortion? https://www.youtube.com/watch?v=8fcbP7lEdzY https://www.youtube.com/watch?v=8fcbP7lEdzY
- bmurphy1976 6y agoHere's a picture taken (not by me) with the 6mm lens: https://www.reddit.com/r/RASPBERRY_PI_PROJECTS/comments/gnwwkc/any_way_to_help_compensate_for_lens_distortion_on/ https://www.reddit.com/r/RASPBERRY_PI_PROJECTS/comments/gnww... It works well as a macro camera for super close up pictures, but otherwise it's pretty terrible when compared to my other lenses. I don't know which lens Jeff used in his video, I would have to rewatch it and I'm not inclined to do that. If he used the 6mm lens he would have likely cropped the image or used post-processing to remove the distortion. Processing the image is a solution, but it has tradeoffs and I'm not sure how easy it is to do it in real-time on a rapsberry pi zero.
- kingosticks 6y ago> I don't know which lens Jeff used in his video, I would have to rewatch it and I'm not inclined to do that. He uses the "official" 6mm lens. I use it daily for video and I just loaded it up and re-checked - I don't see distortion like in that reddit posted image. I see something very similar to the examples in Jeff's video. I highly doubt he'd have post-processed the video, that would be extremely misleading. In the context of similarly priced webcams that are available to buy in 2020, I find it very usable and not at all terrible. But I do appreciate it's all subjective.
- yskchu 6y agoThis reminds me of the Pisight - Raspberry Pi inside an Apple iSight https://github.com/maxbbraun/pisight https://github.com/maxbbraun/pisight Of course, this one has a better lens than the pisight, and uses the high quality camera module also
- geerlingguy 6y agoI really, really wish I hadn't gotten rid of my old iSight years ago (sold it on eBay)—I loved (and still love) the design of that camera... it's like a lens that's a camera.
- djsumdog 6y agoAre there any good outdoor enclosures for housing a pi camera? I've been trying to something I could either mount on a tripod screw or railing clip.
- kiddico 6y agoI assume it still functions normally while acting as a webcam (aka it's a general purpose computer with ssh etc.) Would it be possible to insert ffmpeg in between the camera and the output to usb? It'd be fun to throw some weird post processing in there.
- wegs 6y agoI'd want OBS running. I'd love to offload OBS from my computer to a Pi. It'd be nice if there were some docs about how this works and how to hack it. Key thing with tools like OBS is you want a dedicated CPU. It's not super-CPU hungry, but it can stall if your CPU is otherwise, erm, occupied.
- geerlingguy 6y agoOBS would really kill a Pi if you tried doing anything too complicated. It can do screen capture, and maybe a few simple scenes, but things like multiple sources/compositing are too taxing on the SoC right now. But you can get it to run—see: https://obsproject.com/forum/threads/obs-raspberry-pi-build-instructions.115739/ https://obsproject.com/forum/threads/obs-raspberry-pi-build-...
- numpad0 6y agoI bought a beaten up Sony NEX camera with PMCA(discontinued Android app market feature, not to be confused with other PlayMemories features) while ago, and turned out there’s already an app on GitHub to start telnet over Wi-Fi with root. The camera seems to use standard gadget modules to handle USB connections, but Kernel seems to predate gadget UVC driver, and the main image sensor is not operating as a V4L2 device. If anyone could get a UVC module to compile and load, and use Sony API to pipe video from, that’ll let users skip the HDMI part when using it as webcam.
- msoad 6y agoCan you please share the GitHub repo? I have a NEX
- numpad0 6y agohttps://github.com/ma1co/OpenMemories-Tweak https://github.com/ma1co/OpenMemories-Tweak
- porphyra 6y agoOn Linux you can use gphoto2 + v4l2loopback and use the Sony camera as a webcam over USB: https://superuser.com/questions/870768/can-i-use-my-dslr-as-webcam-through-gphoto2-v4l2loopback https://superuser.com/questions/870768/can-i-use-my-dslr-as-... sudo modprobe v4l2loopback devices=1 exclusive_caps=1 card_label="porphyracam" gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -f v4l2 /dev/video0
- cghendrix 6y agoHow feasible would it be to have the device wireless? I understand you can host a cctv like option but what about selecting a device as a webcam that’s not plugged in but served over WiFi? (Sorry if that’s not well worded)
- rahimnathwani 6y agoYou need two pieces: 1. Something to stream the video over the network (like https://github.com/mpromonet/v4l2rtspserver https://github.com/mpromonet/v4l2rtspserver). 2. A 'driver' for your desktop operating system that can take the stream and present it as a (virtual) webcam.
- cghendrix 6y agoAh exactly what I was looking for. Thanks a bunch!
- geerlingguy 6y agoAlso check out https://piwebcam.github.io https://piwebcam.github.io — that use case is slightly different but closely related.
- arc-in-space 6y agoSurprisingly so, I use uv4l¹ for capturing 720p60 and 1080p30 and it has worked well, though I don't know if this method would work in your use case, since all it gives is a raw h264 stream over http, and a browser preview into it. ¹ http://www.davidhunt.ie/raspberry-pi-high-quality-camera-setup-for-low-latency-video-conferencing/ http://www.davidhunt.ie/raspberry-pi-high-quality-camera-set...
- j-james 6y agoPretty cool. Recently, I made a Raspberry Pi webcam myself as a replacement to my laptop camera, following Max Braun's tutorial and using the (considerably cheaper) Camera Board v2. Although it takes about thirty seconds to boot up, and I've yet to design a mount, it just works with everything. https://github.com/maxbbraun/pisight https://github.com/maxbbraun/pisight
- johnchristopher 6y agoWould you say the image quality of the pi cam is better than the laptop camera ?
- j-james 6y agoIt's just about the same. The real advantage of making a standalone webcam for me was because my laptop's camera is just above the keyboard and unusable in most scenarios.
- johnchristopher 6y agoI see, thanks. Considering the pi needs to be powered over one USB port and the other USB port is used for data that makes two wire hanging around: ts that really better than an USB webcam then ?
- j-james 6y agoThe Pi can be powered from the same data port so that it only needs one cable. If you're comparing this project to an off-the-shelf USB webcam, also consider that a Raspberry Pi makes for a very hackable base (for example, I'm planning on wiring up an LED ring to it sometime soon).
- johnchristopher 6y ago> The Pi can be powered from the same data port so that it only needs one cable. Great, I didn't know that. I happen to have two pi0+camera that I now know how to recycle :).
- rahimnathwani 6y agoHow is the quality compared to a decent webcam (like a Logitech C920), assuming regular lighting? BTW I noticed this towards the end, which probably doesn't matter if you're using this only for video calls: "The upstream repository providing the uvc-gadget application currently defaults to 720p resolution, which is great for most use cases. You can stream at 1080p, though the Pi Zero and older Pis may drop frames at that resolution. Follow this issue for progress making resolution more easily configurable."
- geerlingguy 6y agoIn the video, I specifically highlighted the C920 at 0:50 or so (compare that—in the same lighting conditions—to the footage at the start of the video). Note that the default viewing angle of the C920 is a bit wider than the 6mm lens on the Pi.
- rahimnathwani 6y agoThank you. I'll check out the video. The C920 viewing angle is a bit wide for me, actually, so I have it mounted on a 12" monopod attached to the wall behind my monitor. EDIT: In the video, your Pi camera looks sharper than the C920, and the depth of field is shallower. Your skin colour looks comparatively flat in front of the C920. I think I have a Pi Zero gathering dust somewhere, so maybe...
- intpx 6y agothe TLDR is: better, but you lose important features like autofocus.
- pasdechance 6y agoI watched your video about this last night. Very nice work. It is exactly what lots if rpi users would love to find while looking for projects.
- rasz 6y agohttps://www.youtube.com/watch?v=8fcbP7lEdzY https://www.youtube.com/watch?v=8fcbP7lEdzY "what if I told you I am recording this on a professional quality webcam that" nah mate, it looks like ass, Apple Air FaceTime levels of ass. Besides if it was any good you wouldnt switch back to your fancy gear for the rest of the video ;-)
- mattstudio 6y agoThe first shot looks bad because he forgot to light it correctly (see caption in video). But the rest looks pretty good to me.
- rasz 6y agoHaha sure. The first shot is the only shot done with the rpi camera.