New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

datamosh-cli

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datamosh-cli

A CLI tool to datamosh videos

2.1.0
latest
Source
npm
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

datamosh-cli

A command-line tool to break files.

What the hell is datamoshing?

Long story short, it’s the act of modifying digital files in such a way that they create artifacts for aesthetic pleasure. See Compression Artifact on Wikipedia.

Installation

If you want to use datamosh-cli in a project, you can install it as a project dependency:

npm install datamosh-cli

If you want to use it on your computer instead, you can either install the package globally:

npm install -g datamosh-cli

Or use npx to download the package automatically and run it:

npx -p datamosh-cli datamosh [command] [options]

Usage

datamosh [command] <source> <destination> [options] [-- ffmpeg arguments]

ffmpeg-static is used to convert various formats to corruptable formats. Consequently, <source> and <destination> can be whatever format ffmpeg gets. You can pass additional settings (like encoding, compression, etc) after the -- argument:

datamosh all stickers.mp4 stickers-destroyed.mp4 -- -c:v libx264

Additional parameters to ffmpeg might clash with what datamosh tries to do, so use with caution.

datamosh all <source> <destination> [options]

OptionDefault valueDescription
--overwrite-Skips overwrite prompt and overwrites <destination> if it exists

The all command runs all commands in the following order:

  • remove-keyframes
  • shuffle-frames
Example
datamosh all examples/stickers.mp4 examples/stickers-all.gif -- -filter_complex 'fps=15'

datamosh remove-keyframes <source> <destination> [options]

OptionDefault valueDescription
--frame-offset-1Offset to start looking for neighbouring frames
--overwrite-Skips overwrite prompt and overwrites <destination> if it exists

The remove-keyframes command replaces keyframes (I-frames) with delta frames (B/P-frames), resulting in the pixel of one scene leaking into to next, similar to the music video of A$AP Mob - Yamborghini High. The first keyframe is preserved. When replacing keyframe n, datamosh-cli starts at frame n + frameOffset and loops back in time until it finds a delta frame. This means that a positive frame offset can be used to cause (intentional) stuttering.

Example
datamosh remove-keyframes examples/stickers.mp4 examples/stickers-remove-keyframes.gif --frame-offset 4 -- -filter_complex 'fps=15'

datamosh shuffle-frames <source> <destination> [options]

OptionDefault valueDescription
--overwrite-Skips overwrite prompt and overwrites <destination> if it exists
-p, --probability0.1 (=10%)Probability of swapping a frame
-r, --range2Range of neighbouring frames to swap

The shuffle-frames command shuffles B/P-frames around. Each B/P-frame has a probability of probability of being swapped. A greater probability will cause more distortion. If frame n is being swapped, it will swap with one of the neighbouring frames, based on range. A greater range will cause more stuttering, depending on probability.

Example
datamosh shuffle-frames examples/stickers.mp4 examples/stickers-shuffle-frames.gif --probability 0.25 --range 4 -- -filter_complex 'fps=15'

What are these stickers from?

Disclaimer

This project is not affiliated with the logos/brands shown in the examples. I’m just a sticker-owning fan. Don’t sue me. Send me a message if you’re angry.

Keywords

datamosh

FAQs

Package last updated on 05 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts