Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/waldoj/moonstriker
Turn a video into per-caption clips and periodically post clips to Mastodon.
https://github.com/waldoj/moonstriker
mastodon video
Last synced: 3 days ago
JSON representation
Turn a video into per-caption clips and periodically post clips to Mastodon.
- Host: GitHub
- URL: https://github.com/waldoj/moonstriker
- Owner: waldoj
- License: gpl-2.0
- Created: 2023-01-06T14:01:12.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-24T15:00:01.000Z (8 months ago)
- Last Synced: 2024-06-11T19:17:50.769Z (5 months ago)
- Topics: mastodon, video
- Language: Shell
- Homepage:
- Size: 52.7 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Moonstriker
A pair of Bash scripts to divide up a video into chunks—one per caption—and then post them to Mastodon, e.g. as a bot. This is designed to post MP4s, but with some tweaks it can post any asset (e.g. images, audio). It was created for excerpts of _Moonstruck,_ hence the name.The video processor iterates through each caption in an SRT file and, for each one, saves that clip from the associated video. The Mastodon bot gets a file listing from an S3 bucket, randomly selects one of the files, and posts it to Mastodon.
## Setup
### Video processor
* Prerequisite: a video file that contains captions and an SRT file of those captions
* Ensure that ffmpeg is installed
* If running this on macOS 13.1 or older, the version of `date` that ships with it doesn't support sub-second accuracy. Install GNU date via `brew install coreutils` and change the `date` reference in `processor.sh` to `gdate`.
* Configure `processor.sh` to use the correct filenames for the two files (or name them `video.m4v` and `captions.srt`)### Mastodon bot
* Ensure that ffmpeg, cURL, and AWS CLI are installed, and that the account is configured to have permission to retrieve files from S3
* Create a new application in your Mastodon account’s settings, giving it `write:statuses` and `write:media` permissions (no other permissions are required), and note the application’s access token
* Put your video clips into a dedicated S3 bucket (or a dedicated directory within an S3 bucket)
* Configure the three variables in the header of `mastobot.sh`: `MASTODON_SERVER`, `MASTODON_TOKEN`, and `S3_BUCKET`
* Create a new cron task to run `mastobot.sh` periodically## Use
* Run `processor.sh` and `clips/` will be filled up with incrementally numbered files, which must be uploaded to an S3 bucket to be accessible to the bot
* Run `mastobot.sh` and it will post a single video clip to Mastodon