mediasnacks 0.1.0 → 0.1.1

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.
@@ -9,7 +9,7 @@ _mediasnacks_commands=(
9
9
  'qdir:Sequentially runs all *.sh files in a folder'
10
10
  'hev1tohvc1:Fixes video thumbnails not rendering in macOS Finder'
11
11
  'framediff:ffplay with a filter for diffing adjacent frames'
12
- 'videodiff:Plays a video of the difference of two videos'
12
+ 'videodiff:Plays a video with the difference of two videos'
13
13
  )
14
14
 
15
15
  _mediasnacks() {
package/README.md CHANGED
@@ -18,7 +18,9 @@ Commands:
18
18
  - `seqcheck` Finds missing sequence number
19
19
  - `qdir` Sequentially runs all *.sh files in a folder
20
20
  - `hev1tohvc1`: Fixes video thumbnails not rendering in macOS Finder
21
-
21
+
22
+ - `framediff`: Plays a video of adjacent frames diff
23
+ - `videodiff`: Plays a video with the difference of two videos
22
24
  <br/>
23
25
 
24
26
  ### Converting Images to AVIF
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasnacks",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Utilities for preparing videos, images, and audio for the web",
5
5
  "license": "MIT",
6
6
  "author": "Eric Fortis",
package/src/avif.js CHANGED
@@ -55,7 +55,6 @@ async function toAvif({ file, outFile, overwrite }) {
55
55
  return
56
56
  }
57
57
 
58
- // TODO test on linux
59
58
  console.log(file)
60
59
  await ffmpeg([
61
60
  '-y', // overwrites
package/src/cli.js CHANGED
@@ -33,7 +33,7 @@ Commands:
33
33
  hev1tohvc1: Fixes video thumbnails not rendering in macOS Finder
34
34
 
35
35
  framediff: Plays a video of adjacent frames diff
36
- videodiff: Plays a video of the difference of two videos
36
+ videodiff: Plays a video with the difference of two videos
37
37
  `.trim()
38
38
 
39
39
 
package/src/dropdups.js CHANGED
@@ -14,6 +14,8 @@ const PRORES_PROFILES = {
14
14
  '4444': 4,
15
15
  '4444xq': 5,
16
16
  }
17
+ const PROFILE = PRORES_PROFILES.hq
18
+
17
19
 
18
20
  const USAGE = `
19
21
  Usage: npx mediasnacks dropdups [-n <bad-frame-number>] <video>
@@ -22,8 +24,9 @@ Removes duplicate frames and outputs ProRes 422 HQ.
22
24
 
23
25
  Options:
24
26
  -n, --bad-frame-number <n> Known frame interval to drop.
25
- Example A: Use n=2 when every other frame is repeated.
26
- Example B: Use n=6 if e.g., a 25 fps got upped to 30 fps without interpolation.
27
+ (default: n=0) auto-detects repeated frames (slower)
28
+ Ex.A: Use n=2 when every other frame is repeated.
29
+ Ex.B: Use n=6 if e.g., a 25 fps got upped to 30 fps without interpolation.
27
30
  -h, --help
28
31
  `.trim()
29
32
 
@@ -31,7 +34,7 @@ Options:
31
34
  async function main() {
32
35
  const { values, positionals } = parseArgs({
33
36
  options: {
34
- 'bad-frame-number': { short: 'n', type: 'string' },
37
+ 'bad-frame-number': { short: 'n', type: 'string', default: '' },
35
38
  help: { short: 'h', type: 'boolean', default: false },
36
39
  },
37
40
  allowPositionals: true
@@ -45,13 +48,9 @@ async function main() {
45
48
  if (!positionals.length)
46
49
  throw new Error('No video specified. See npx mediasnacks dropdups --help')
47
50
 
48
- let nBadFrame = null
49
- if (values['bad-frame-number'] !== null) {
50
- const n = Number(values['bad-frame-number'])
51
- if (!Number.isFinite(n) || n <= 0)
52
- throw new Error('Invalid --bad-frame-number. It must be a positive integer.')
53
- nBadFrame = n
54
- }
51
+ let nBadFrame = values['bad-frame-number']
52
+ if (nBadFrame && /^\d+$/.test(nBadFrame))
53
+ throw new Error('Invalid --bad-frame-number. It must be a positive integer.')
55
54
 
56
55
  await assertUserHasFFmpeg()
57
56
 
@@ -72,7 +71,7 @@ async function drop(video, nBadFrame) {
72
71
  : 'mpdecimate,setpts=N/FRAME_RATE/TB',
73
72
  '-fps_mode', 'cfr',
74
73
  '-c:v', 'prores_ks',
75
- '-profile:v', PRORES_PROFILES['hq'],
74
+ '-profile:v', PROFILE,
76
75
  '-pix_fmt', 'yuv422p10le',
77
76
  makeOutputPath(video)
78
77
  ])