{"id":15020528,"url":"https://github.com/mosnfar/raspberrypi4-camera-to-cloud","last_synced_at":"2025-10-26T04:30:18.442Z","repository":{"id":229734487,"uuid":"773852448","full_name":"mosnfar/raspberrypi4-camera-to-cloud","owner":"mosnfar","description":"Camera connected to Raspberry Pi enables direct cloud streaming. Repository offers seamless online sharing solution.","archived":false,"fork":false,"pushed_at":"2024-10-19T01:32:00.000Z","size":11020,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T14:17:34.846Z","etag":null,"topics":["raspberry-pi","raspberry-pi-4","shell","webcam-capture","webcam-streaming"],"latest_commit_sha":null,"homepage":"https://forge.mosn.me/stream-raspberry-pi-camera-feed-to-cloud","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/mosnfar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-18T14:09:48.000Z","updated_at":"2024-11-28T08:14:43.000Z","dependencies_parsed_at":"2024-07-11T11:12:29.681Z","dependency_job_id":null,"html_url":"https://github.com/mosnfar/raspberrypi4-camera-to-cloud","commit_stats":null,"previous_names":["mosnfar/raspberrypi4-camera-to-cloud"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mosnfar%2Fraspberrypi4-camera-to-cloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mosnfar%2Fraspberrypi4-camera-to-cloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mosnfar%2Fraspberrypi4-camera-to-cloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mosnfar%2Fraspberrypi4-camera-to-cloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mosnfar","download_url":"https://codeload.github.com/mosnfar/raspberrypi4-camera-to-cloud/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238254151,"owners_count":19441799,"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":["raspberry-pi","raspberry-pi-4","shell","webcam-capture","webcam-streaming"],"created_at":"2024-09-24T19:55:13.608Z","updated_at":"2025-10-26T04:30:18.067Z","avatar_url":"https://github.com/mosnfar.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raspberry Pi Feed to Cloud\n\nConnecting a camera to a Raspberry Pi through the on-board camera port or USB port can assist in capturing images or videos. This setup can serve various purposes. In this repository, you can find a prebuilt shell script designed to facilitate continuous image streaming to online cloud services such as Google Drive for Linux-operated Raspberry Pi.\n\n## 📋 Use cases\n\n- Online Stream of Camera\n- Frame Capture for Time-lapse\n- Object Tracking using Cloud\n\n## 🔧 How to use\n\nFirst, you should install dependencies like 'ffmpeg', 'rclone'. To do it use the command below:  \n\n```bash\nsudo apt update \u0026\u0026 sudo apt install ffmpeg rclone\n```\n\nAfter that, you should configure your cloud service, which here we continue with the Google Drive option.\nI suggest to use this two complete tutorials for proper configuration:  \n\n- [Google Drive by rclone on Bealdung](https://www.baeldung.com/linux/google-drive-guide#2-rclone)\n- [Official rclone Google Drive Document](https://rclone.org/drive/)\n\nBut simply to do that start with rclone, you should use the command below and follow the given instructions:  \n\n```bash\nrclone config\n```\n\nNow, You should have a directory on your local device to sync Google Drive with it. Here we create a directory named `/home/user/path/to/`, to do this you can use this command:\n\n```bash\nmkdir /home/user/path/to\n```\n\nSo, Time to **configure a webcam or camera**. Here I'm using a USB webcam but if you want to use the on-board Raspberry Pi camera follow [this link](https://www.codeinsideout.com/blog/pi/set-up-camera/#record-h264-video).  \n\n![USB webcam connected to Raspberry Pi 4](/assets/images/webcam-to-rp4.png)\n\nConnect the USB webcam to Raspberry Pi and find the hardware directory which in this example is `/dev/video0`.\n\nAwesome, All essential parts are configured. Now the script is ready for use.  \nDownload the script file to your local machine:\n\n```bash\ncurl -L https://raw.githubusercontent.com/mosnfar/raspberrypi4-camera-to-cloud/main/run.sh -o ./run.sh\n```\n\nBefore using the script you should change some variables in the script to work correctly. Use `nano run.sh` to open text editor then go to 'Configure global variables' section and change the variable.\n\n```bash\n...\n\n# Configure global variables\n\nDRIVE_ADD=\"drive:/parentfolder/subfolder\" #rclone given address for drive main folder and subfolder\n\nSTORE_DIR=\"/home/user/path/to/\" #Local directory which will link to drive\nLOG_DIR=\"/home/user/path/for/log/\" #Directory to store log for command\n\nCAMERA_ADD=\"/dev/video0\" #Hardware directory for Video Input\n\nDAY_OF_STORAGE=2 #Maximum date for storage - e.g. 2 days\nMAX_STORAGE_SIZE=200000000 #Maximum size for storage - e.g. 200000000 Byte -\u003e 200 MB\n\nINTERVAL_DELAY=10 #Interval between taking frames - e.g. 10 seconds\n\nMAX_RETRIES=10 #Times to rclone try\n\n...\n```\n\nYou should change these variables:\n\n**Essential Variables**\n\nShould change this before running this script according to your configuration.  \n\n- **DRIVE_ADD**: The address to which you configure Google Drive with rclone command.\n- **STORE_DIR**: This directory will be connected to Drive and sync with it.\n- **LOG_DIR**: Where you want to store your system script logs and errors.\n- **CAMERA_ADD**: Hardware address of video input (webcam|camera) to use.\n- **DAY_OF_STORAGE**: By this variable, you can configure how many days should store the content.\n- **MAX_STORAGE_SIZE**: This variable manages Drive capacity and prevents extending from Google storage limit.\n- **INTERVAL_DELAY**: This is the gap time between taking frames.\n\n**Additional Variables**\n\nIf you customize the script more, you can change this too.\n\n- **MAX_RETRIES**: This variable defines how many times should rclone try.  \n\nNow everything is done and you should add `run.sh` command to system jobs to be run on every reboot. To do that use this command:\n\n```bash\nsudo chmod +x run.sh \u0026\u0026 (crontab -l ; echo \"@reboot /real/path/to/run.sh\") | crontab - \u0026\u0026 crontab -l\n```\n\nAnd its better to reboot your system.\n\n🎉 It's Done. All is ready.\n\n---\n\n### Find More\n\nI hope this can help you. You can subscribe to my [yotube channel](https://www.youtube.com/channel/UC3pFrJCbA9GuHs5uEkexgdw) or support [my blog](https://forge.mosn.me/?source=github-rp4-to-drive) to find out more stuff which help you.  \n\n[![Youtube](https://img.shields.io/badge/Youtube_Channel-FF0000?style=for-the-badge\u0026logo=Youtube\u0026logoColor=white)](https://www.youtube.com/channel/UC3pFrJCbA9GuHs5uEkexgdw)\n\n---\n\nRESOURCES: [Using USB Webcam](https://raspberrypi-guide.github.io/electronics/using-usb-webcams), [Use rclone for Google Drive](https://www.baeldung.com/linux/google-drive-guide#2-rclone), [rclone, Google Drive](https://rclone.org/drive/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmosnfar%2Fraspberrypi4-camera-to-cloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmosnfar%2Fraspberrypi4-camera-to-cloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmosnfar%2Fraspberrypi4-camera-to-cloud/lists"}