{"id":13479279,"url":"https://github.com/LoneWanderer-GH/RaspiVWS","last_synced_at":"2025-03-27T09:31:09.224Z","repository":{"id":205418021,"uuid":"146414116","full_name":"LoneWanderer-GH/RaspiVWS","owner":"LoneWanderer-GH","description":"Raspberry Pi Webcam Streaming with Logitech C920 and VLC","archived":false,"fork":false,"pushed_at":"2020-07-04T18:25:59.000Z","size":259,"stargazers_count":44,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-01T16:55:48.657Z","etag":null,"topics":["h264","http","http-streaming","logitech","logitech-devices","raspberry-pi","videolan","vlc","vlc-media-player","webcam","webcam-stream","webcam-streaming","wifi"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LoneWanderer-GH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-08-28T08:11:15.000Z","updated_at":"2024-04-19T05:52:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"41bac019-cb10-4de7-bfe7-4dc64277ee12","html_url":"https://github.com/LoneWanderer-GH/RaspiVWS","commit_stats":null,"previous_names":["lonewanderer-gh/raspivws"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LoneWanderer-GH%2FRaspiVWS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LoneWanderer-GH%2FRaspiVWS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LoneWanderer-GH%2FRaspiVWS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LoneWanderer-GH%2FRaspiVWS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LoneWanderer-GH","download_url":"https://codeload.github.com/LoneWanderer-GH/RaspiVWS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222222293,"owners_count":16951421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["h264","http","http-streaming","logitech","logitech-devices","raspberry-pi","videolan","vlc","vlc-media-player","webcam","webcam-stream","webcam-streaming","wifi"],"created_at":"2024-07-31T16:02:12.696Z","updated_at":"2024-10-30T12:31:49.394Z","avatar_url":"https://github.com/LoneWanderer-GH.png","language":"Shell","funding_links":["https://img.shields.io/static/v1?label=Patreon\u0026message=Donate\u0026color=0079C1\u0026logo=patreon\u0026link=https://www.patreon.com/bePatron?u=38268348","https://img.shields.io/static/v1?label=PayPal\u0026message=Donate\u0026color=0079C1\u0026logo=paypal\u0026link=https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=lonewandererdev%40gmail.com\u0026item_name=Develop+%26+maintain+somme+addons/softwares+on+my+spare+time\u0026currency_code=EUR\u0026source=url"],"categories":["Shell"],"sub_categories":[],"readme":"# RaspiVWS: Raspberry Pi VLC Webcam Streaming, with Logitech C920 USB webcam\n![](https://img.shields.io/static/v1?label=Patreon\u0026message=Donate\u0026color=0079C1\u0026logo=patreon\u0026link=https://www.patreon.com/bePatron?u=38268348)\n![](https://img.shields.io/static/v1?label=PayPal\u0026message=Donate\u0026color=0079C1\u0026logo=paypal\u0026link=https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=lonewandererdev%40gmail.com\u0026item_name=Develop+%26+maintain+somme+addons/softwares+on+my+spare+time\u0026currency_code=EUR\u0026source=url)\n\n## LICENSE\nI mostly require that this project and my stack overflow and github profile to be credited and linked if you reuse, derive, or are inspired by any part of this project.\n\n## Goal\nThis project aims at providing a simple and convenient way to perform webcam streaming over HTTP using a Raspberry Pi and Logitech C920.\nIt can be used as a babycam, dashcam, surveillance cam, and any other idea you might have.\nThere are ideas for major future improvements, it will depend on how much time I can give to it.\n**This is tested and working in conditions indicated below and in [my original Stack Overflow question](https://stackoverflow.com/questions/49846400/raspberry-pi-use-vlc-to-stream-webcam-logitech-c920-h264-video-without-tran/)**\n\n## How is it different from other projects ?\n\n* It requires little to no additional installation over an existing Raspbian image. It relies on preinstalled software. If it is not installed, it will show an error explaining what is missing.\n* Low CPU footprint: there is little to no transcoding performed by the pi, due to usage of the C920 webcam capabilities (native H264 video stream). (Same result may be achieved with any webcam that provides similar features, such as native encoding such as H264 or any other encoding that won't require Raspberry Pi's CPU power.)\n* Script is straightforward: launch it, and voilà.\n* Can be easily integrated to jobs, cron, \u003cyou name it\u003e and automation.\nEverything is documented [in my Stack Overflow question](https://stackoverflow.com/questions/49846400/raspberry-pi-use-vlc-to-stream-webcam-logitech-c920-h264-video-without-tran/)\n* The system could be also used with on-the-fly transcoding (again [see my Stack Overflow question](https://stackoverflow.com/questions/49846400/raspberry-pi-use-vlc-to-stream-webcam-logitech-c920-h264-video-without-tran/) for some hints on how to use VLC commands and adapt this script.\n\n##### Table of Contents  \n\n1. [Why](#Why)\n2. [Prerequisites](#Prerequisites)\n3. [Usage](#Usage)\n4. [Access to stream](#AccessToStream)\n5. [Additonal commands](#AdditonalCommands)\n   1. [Wifi](#Wifi)\n   2. [Planned execution](#PlannedExecution)\n6. [TROUBLESHOOTING](#TROUBLESHOOTING)\n4. [Credits](#Credits)\n\n\u003ca name=\"Why\"\u003e\u003c/a\u003e\n## 1. Why\nThis project comes from my answer to [my Stack Overflow question](https://stackoverflow.com/questions/49846400/raspberry-pi-use-vlc-to-stream-webcam-logitech-c920-h264-video-without-tran/)\nI decided to push it to another level.\nTo do:\n- [ ] Go to another higher level with a more evolved concept\n\n\u003ca name=\"Prerequisites\"\u003e\u003c/a\u003e\n## 2. Prerequisites\nYou must have :\n 1. basic Linux/Unix/Raspbian, Git or Github knowledge to peform the commands below\n 2. a Raspberry Pi 3B+ (other Raspberries may not be supported). See what it is [on the official website\u003cimg src=\"/assets/Raspi-PGB001[1].png\" width='5%' height='5%'/\u003e](https://www.raspberrypi.org/)\n 3. A Logitech C920 webcam connected to your Raspberry Pi (USB). It *could* work with other webcam with additional modifications. Please give credit to my work if you do any improvements.\n\n\nYou should have `VLC` and `v4l-utils` packages already installed on you Pi. If not, see below:\n ```\n sudo apt-get install vlc v4l-utils\n ```\nSee [VLC website ![Get VLC icon](https://images.videolan.org/images/goodies/getvlc.png)](https://www.videolan.org/vlc)\n\n\u003ca name=\"Usage\"\u003e\u003c/a\u003e\n## 3. Usage\n\nInstall it, assuming you are in your user profile home directory:\n\n```\ngit clone https://github.com/LoneWanderer-GH/RaspiVWS\n```\n\nGo into the created folder:\n\n```\ncd RaspiVWS\n```\n\nEnsure you have execution rigths on the script\n\n```\nchmod +x Raspi_VLC_Webcam_Stream.sh\n```\n\nExecute command, eg:\n\n```\n./Raspi_VLC_Webcam_Stream.sh -h\n```\n\nIt should produce a console output similar to this:\n\n```\nUsage: ./Raspi_VLC_Webcam_Stream.sh [-h|--help] [-o|--output-videos-directory \u003carg\u003e] [-m|--video-file-name-mask \u003carg\u003e] [--video-files-split-after \u003carg\u003e] [--stop-stream-after \u003carg\u003e] [--(no-)use-ssmtp] [--(no-)force-led-on] [--video-width \u003carg\u003e] [--video-height \u003carg\u003e] [-V|--verbose] [-v|--version] \u003cvideo-device-number\u003e [\u003chttp-port\u003e]\n\n\t\u003cvideo-device-number\u003e: The video capture device number (webcam) that can be found in /dev. Ex: Put 0 if your device is /dev/video0\n\t\u003chttp-port\u003e: The HTTP port to be used by VLC to provide the video stream from the video capture device. Default will be 8099 (default: '8099')\n\t-h,--help: Prints help\n\t-o,--output-videos-directory: Directory in which the VLC videos are stored. It means that the video stream will be recorded in addition to HTTP stream. Full path expected. (no default)\n\t-m,--video-file-name-mask: Videos files record name. Files will be generated as: 1970-12-31_%00h00m00s_\u003cyourvalue\u003e  (default: 'Webcam_Stream_Record')\n\t--video-files-split-after: Defines the unitary VLC record file duration in seconds. WARNING: Only necessary when output-videos-directory is used (default: '120')\n\t--stop-stream-after: Defines the delay after which the VLC record will stop in seconds. WARNING: Only necessary when output-videos-directory is used (default: '10800')\n\t--use-ssmtp,--no-use-ssmtp: Send mail using SSMTP command (if exists) indicating start of record (off by default)\n\t--force-led-on,--no-force-led-on: Forces the Logitech C920 LED to be on. (off by default)\n\t--video-width: Force video format width. Use at your own risk. (default: '1920')\n\t--video-height: Force video format height. Use at your own risk. (default: '1080')\n\t-V,--verbose: Console output verbosity. Controls both this command and underlying VLC verbosity.\n\t-v,--version: Prints version\n  ```\n\u003ca name=\"AccessToStream\"\u003e\u003c/a\u003e\n## 4. Access to stream\n\nOn any other device connected to the same network as your pi, you can use VLC to access your RaspberryPi3+ VLC stream at this address:\n\n```\nvlc http://your-raspberrypi-ip:http-port\n```\n\nwhere:\n* `http-port`: is the http-port defined when launching the command (default `8099`)\n* `your-raspberrypi-ip`: your raspberry pi ip, you can find it using command `ifconfig`\n\n\u003ca name=\"AdditonalCommands\"\u003e\u003c/a\u003e\n## 5. Additional commands, usage example\n\n\u003ca name=\"Wifi\"\u003e\u003c/a\u003e\n### 5.1 Make RaspberryPi3+ a Wifi access point\n \nIf you have no existing network to connect your Pi to, you can follow [instructions from official RaspberryPi3+ website](https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md)\nThis will transform your pi into a wifi access point.\n\n\u003ca name=\"PlannedExecution\"\u003e\u003c/a\u003e\n### 5.2 Planned execution tips\n\nThe following assumes your Pi unix user name is `pi` and that you installed RaspiWVS in your home folder, i.e. the script is located here:\n```\n/home/pi/RaspiVWS/Raspi_VLC_Webcam_Stream.sh\n```\n\n#### Method 1: rc.local\n\nYou can make the `rc.local` script use your custom script to be executed at startup.\nYou can follow [instructions from official RaspberryPi3+ website](https://www.raspberrypi.org/documentation/linux/usage/rc-local.md)\n\n#### Method 2: Create a deamon service\n\nWe will create a \"webcam-stream\" service.\n```\ncd /lib/systemd/system/\nsudo nano webcam-stream.service\n```\nAnd write in it:\n```\n[Unit]\nDescription=Custom Webcam Streaming Service\nAfter=multi-user.target\n\n[Service]\nType=simple\nExecStart=/home/pi/RaspiVWS/Raspi_VLC_Webcam_Stream.sh\nRestart=on-abort\n\n[Install]\nWantedBy=multi-user.target\n```\n\nMake the service file and the script executable:\n```\nsudo chmod 644 /lib/systemd/system/webcam-stream.service\nchmod +x /home/pi/RaspiVWS/Raspi_VLC_Webcam_Stream.sh\n```\n\nAllow VLC to be excuted as root:\n```\nsudo sed -i 's/geteuid/getppid/' /usr/bin/vlc\n```\n\nReload deamons and enable our service:\n```\nsudo systemctl daemon-reload\nsudo systemctl enable webcam-stream.service\n```\nCheck it is recognized and working:\n```\nsudo service webcam-stream status\nsudo service webcam-stream start\n```\nYou can check with another computer that the video is correctly streamed.\nNote that the webcam won't be available while the service is running.\n\n### Method 3: Program execution at a given instant\n\nTo launch the execution today at 14:00, you can use the following command:\n```\ncd ~/RaspiVWS \u0026\u0026 ./Raspi_VLC_Webcam_Stream.sh | at 1400\n```\n\nSee the `at` command manual for further details.\n\n\u003ca name=\"TROUBLESHOOTING\"\u003e\u003c/a\u003e\n## 6. TROUBLESHOOTING\n\nI recently ran into VLC error after a dist-upgrade:\n```\nVLC media player 2.2.6 Umbrella (revision 2.2.6-0-g1aae78981c)\n[00acb230] pulse audio output error: PulseAudio server connection failure: Connection refused\n```\nThe solution I found is to launch VLC in GUI mode and change the default audio device to ALSA (instead of Automatic). I can also be done in command line.\nSee the solution found here [VLC issues with PulseAudio](https://www.raspberrypi.org/forums/viewtopic.php?t=29403)\n\n```\ncvlc -A alsa,none --alsa-audio-device default\n```\n\n\u003ca name=\"Credits\"\u003e\u003c/a\u003e\n## 7. Credits\n### 7.1 Project logo\ncredits to user [OpenClipart-Vectors-30363](https://pixabay.com/en/users/OpenClipart-Vectors-30363/)\n[file](https://pixabay.com/en/webcam-cam-camera-digital-online-146301/) licensed under [Creative Commons (CC0) license](https://creativecommons.org/publicdomain/zero/1.0/deed.en) and may subject to [Pixabay terms of usage](https://pixabay.com/en/service/terms/#usage)\n\n### 7.2 VLC logo\ncredits according [this link](https://www.videolan.org/goodies.html):\n\u003e Copyright (c) 1996-2010 VideoLAN. This logo or a modified version may be used or modified by anyone to refer to the VideoLAN project or any product developed by the VideoLAN team, but does not indicate endorsement by the project.\n\n### 7.3 Argbash\nSince I'm lazy at writing bash script arguments management, I used the [Argbash](https://argbash.io/) tool.\nNot sure of the credits I should give them ! Quoting generated code:\n\n\u003e Argbash is a bash code generator used to get arguments parsing right.\n\u003e Argbash is FREE SOFTWARE, see https://argbash.io for more info\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLoneWanderer-GH%2FRaspiVWS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLoneWanderer-GH%2FRaspiVWS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLoneWanderer-GH%2FRaspiVWS/lists"}