mediasnacks 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,8 @@ _mediasnacks_commands=(
15
15
  'dlvideo: yt-dlp best video',
16
16
  'unemoji:Removes emojis from filenames'
17
17
  'rmcover:Removes cover art'
18
- 'curltime:Measures request response timings'
18
+ 'curltime:Measures request response timings',
19
+ 'gif:Video to GIF'
19
20
  )
20
21
 
21
22
  _mediasnacks() {
@@ -26,7 +27,7 @@ _mediasnacks() {
26
27
 
27
28
  local cmd="$words[2]"
28
29
  case "$cmd" in
29
- avif|resize|moov2front|dropdups|seqcheck|hev1tohvc1|framediff|videodiff|vconcat|dlaudio|dlvideo|unemoji|rmcover|curltime)
30
+ avif|resize|moov2front|dropdups|seqcheck|hev1tohvc1|framediff|videodiff|vconcat|dlaudio|dlvideo|unemoji|rmcover|curltime|gif)
30
31
  _files
31
32
  ;;
32
33
  qdir)
package/README.md CHANGED
@@ -30,6 +30,7 @@ Commands:
30
30
  - `rmcover`: Removes cover art
31
31
 
32
32
  - `curltime`: Measures request response timings
33
+ - `gif`: Video to GIF
33
34
  <br/>
34
35
 
35
36
  ### Converting Images to AVIF
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasnacks",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Utilities for preparing videos, images, and audio for the web",
5
5
  "license": "MIT",
6
6
  "author": "Eric Fortis",
package/src/cli.js CHANGED
@@ -27,6 +27,7 @@ const COMMANDS = {
27
27
  rmcover: ['rmcover.sh', 'Removes cover art'],
28
28
 
29
29
  curltime: ['curltime.sh', 'Measures request response timings'],
30
+ gif: ['gif.sh', 'Video to GIF'],
30
31
  }
31
32
 
32
33
  const USAGE = `
package/src/gif.sh ADDED
@@ -0,0 +1,35 @@
1
+ #!/bin/zsh
2
+
3
+ # Convert to GIF
4
+
5
+ FPS=10
6
+ WIDTH=600
7
+
8
+ usage() {
9
+ echo "Usage: mediasnacks gif [--fps <number>] [--width <pixels>] <file>"
10
+ exit 1
11
+ }
12
+
13
+ while [[ $# -gt 0 ]]; do
14
+ case "$1" in
15
+ --fps)
16
+ FPS="$2";
17
+ shift 2 ;;
18
+ --width)
19
+ WIDTH="$2"
20
+ shift 2 ;;
21
+ --help|-h)
22
+ usage ;;
23
+ *)
24
+ file="$1"
25
+ shift ;;
26
+ esac
27
+ done
28
+
29
+ [[ -z "$file" ]] && usage
30
+
31
+ outfile="${file:r}.gif"
32
+
33
+ ffmpeg -v error -i "$file" \
34
+ -vf "fps=${FPS},scale=${WIDTH}:-1" \
35
+ "$outfile"