~loli/shr-moe-screenshot

This is a command-line tool that takes a regular screenshot using either PNG, JPG, or a video capture using MP4, WebM, APNG and uploads it to https://shr.moe
Updated version because of bug fix
Updated .gitignore to ignore my AUR package
Fixed bug where h264 would cause encode to fail

clone

read-only
https://git.sr.ht/~loli/shr-moe-screenshot
read/write
git@git.sr.ht:~loli/shr-moe-screenshot

You can also use your local clone with git send-email.

#Screenshot utility for shr.moe

This is a command-line tool that takes a regular screenshot using either PNG, JPG, or a video capture using MP4, WebM, APNG and uploads it to shr.moe.

#Features

  • Quickly take highly compressed screenshots in PNG or JPEG
  • Easily take video screenshots in WebM, MP4, or APNG
  • Upload screenshots through Tor
  • Automatically insert image or video URL into clipboard
  • Direct links!

#Installation

#Dependencies

  • maim - (Make Image).
  • slop - (Select Operation).
  • curl - is a command-line tool for transferring data specified with URL syntax.
  • XSel - is a command-line program for getting and setting the contents of the X selection.
  • zopflipng (Optional) - PNG optimisation tool using Google's zopfli library.
  • MozJPEG (Optional) - MozJPEG reduces file sizes of JPEG images while retaining quality and compatibility with the vast majority of the world's deployed decoders.
  • bc *(Optional) - bc is an arbitrary precision numeric processing language.
  • ffmpeg (Optional) - a complete, cross-platform solution to record, convert and stream audio and video.
  • torsocks (Optional) - Torsocks allows you to use most applications in a safe way with Tor.

* bc is not necessary if you use both zopflipng and mozjpeg and only partially optional if you use either but not optional if you use neither.

#Install from the AUR

If you're on archlinux you can install it from the AUR:

#Install from git

git clone https://git.sr.ht/~loli/shr-moe-screenshot
cd ./shr-moe-screenshot && sudo cp ./screenshot /usr/bin/

#Usage

#Examples

Take a normal screenshot.

screenshot

Take a PNG screenshot, but don't preview it.

screenshot -n -e png

Optimize the screenshot for the smallest file size and return a direct link to the image.

screenshot -od

Start recording a WebM at 30 fps. (Run "screenshot -a" again to stop. Note: The second run will take a while to compress then upload so be patient)

screenshot -a -f 30

After the command successfully completes, the URL to your image or video will be copied to your clipboard so you can just paste anywhere you want.

#Options & Environment Variables

Option Description Default Options
Environment Variable
-a Start and stop video capture (requires ffmpeg) N/A N/A
N/A
-b Set video colour depth 8 Is the default only because 10 bit doesn't work on firefox yet 8, 10
SCREENSHOT_COLOUR_DEPTH
-c Turns off PNG crushing On because most systems are fast enough to handle this kind of compression and it can really save on upload for people with slow internet (not to mention drive space for the server) N/A
SCREENSHOT_PNG_HIGH_COMPRESSION
-d Returns a direct link to the image or video Off N/A
SCREENSHOT_DIRECT_LINK
-e Sets the image encoder to be used jpeg png, jpeg
SCREENSHOT_ENCODER
-f Set the fps to capture video at (can only be specified for the first command with -a) 30 float:1-144 You're welcome to try higher if your display supports it
SCREENSHOT_FPS
-h Show help message and exit N/A N/A
N/A
-p Sets the pixel format to be used for WebM/MP4 encoding 420 Is the most compatible pixel format that will work in most browsers 444, 422, 420
SCREENSHOT_PIXEL_FORMAT
-k CRF parameter for WebM/MP4 encoding (The higher the value, the lower the quality and file size) 27 0-51
SCREENSHOT_VIDEO_QUALITY
-l Sets how long the screenshot will stay on the server for in days (Note: Their is no guarantees that the screenshot will actually stay on the server for as long as you specify including the default) 30 Any amount in days
SCREENSHOT_TTD
-n Disables opening up the previewer Off N/A
SCREENSHOT_NO_PREVIEW
-o Turns on auto selecting the best encoder for smallest file by trying both PNG and JPEG (will be slower but can make a big difference on file size) Off N/A
SCREENSHOT_OPTIMIZE
N/A Media previewer to use for resulting output xdg-open Any program you want
SCREENSHOT_PREVIEWER
-q Quality parameter for JPEG encoding 95 1-100
SCREENSHOT_QUALITY
-s Delay to take a screenshot N/A Any amount in seconds
SCREENSHOT_DELAY
-t Upload screenshots through Tor (requires torsocks) Off N/A
SCREENSHOT_TOR
-u Sets the uid and exits 0 'a-z,A-Z,0-9' String of your choice
N/A
-v Sets the video encoder to be used webm webm, mp4, apng
SCREENSHOT_VIDEO_ENCODER
N/A Options to be passed to torsocks "-u screenshot -p screenshot" torsocks stuff.
SCREENSHOT_TORSOCKS_OPTS
N/A Directory to store screenshots in $HOME/Pictures/Screenshots Wherever you want. Personally I don't care to keep mine so I just use /tmp
SCREENSHOT_DIRECTORY
-i External file to encode and upload N/A png, jpg for image uploads or any supported video/audio codecs by ffmpeg for video uploads
N/A
-y Upload external file without encoding (For wizards only!) N/A N/A
N/A