image-video-optimizer 2.0.0 → 2.0.3

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.
package/package.json CHANGED
@@ -1,37 +1,43 @@
1
1
  {
2
2
  "name": "image-video-optimizer",
3
- "version": "2.0.0",
4
- "description": "CLI tool to optimize and compress images and videos with configurable settings",
3
+ "version": "2.0.3",
4
+ "description": "A CLI tool to optimize images and videos by resizing and converting them according to configuration",
5
5
  "main": "src/index.js",
6
6
  "bin": {
7
7
  "image-video-optimizer": "./bin/cli.js"
8
8
  },
9
9
  "scripts": {
10
- "start": "node bin/cli.js",
11
- "test": "echo \"Error: no test specified\" && exit 1"
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "start": "node bin/cli.js"
12
12
  },
13
13
  "keywords": [
14
14
  "image",
15
15
  "video",
16
16
  "optimizer",
17
- "compress",
18
- "ffmpeg",
17
+ "resize",
18
+ "convert",
19
+ "batch",
19
20
  "cli"
20
21
  ],
21
22
  "author": "",
22
23
  "license": "MIT",
23
24
  "dependencies": {
24
- "commander": "^11.0.0",
25
+ "sharp": "^0.33.0",
26
+ "fluent-ffmpeg": "^2.1.3",
27
+ "commander": "^11.1.0",
25
28
  "chalk": "^5.3.0",
26
- "sharp": "^0.32.0",
27
- "fluent-ffmpeg": "^2.1.2"
29
+ "ora": "^8.0.1"
30
+ },
31
+ "devDependencies": {
32
+ "ffmpeg-static": "^5.2.0",
33
+ "ffprobe-static": "^3.1.0"
28
34
  },
29
- "devDependencies": {},
30
35
  "engines": {
31
36
  "node": ">=14.0.0"
32
37
  },
38
+ "preferGlobal": true,
33
39
  "repository": {
34
40
  "type": "git",
35
- "url": ""
41
+ "url": "https://github.com/yourusername/image-video-optimizer.git"
36
42
  }
37
43
  }
@@ -44,11 +44,10 @@ async function processVideo(videoPath, config) {
44
44
  const command = ffmpeg(videoPath)
45
45
  .videoCodec(outputCodec)
46
46
  .size(`${config.video_max_width}x?`)
47
- .aspect('16:9')
48
- .autopad()
49
47
  .outputOptions([
50
48
  '-preset fast',
51
- '-crf 28'
49
+ '-crf 28',
50
+ '-c:a aac' // Use AAC for audio (widely compatible)
52
51
  ])
53
52
  .output(tmpPath);
54
53
 
@@ -110,6 +109,8 @@ async function processVideo(videoPath, config) {
110
109
  errorMsg = `Codec not available. Verify FFmpeg installation: ffmpeg -version`;
111
110
  } else if (err.message.includes('ENOENT') || err.message.includes('ffmpeg')) {
112
111
  errorMsg = `FFmpeg not found. Install with: brew install ffmpeg (macOS) or apt-get install ffmpeg (Linux)`;
112
+ } else if (err.message.includes('Conversion failed') || err.message.includes('exited with code')) {
113
+ errorMsg = `Video encoding failed. Try a different codec in config: video_encode=h265 or video_encode=vp8`;
113
114
  }
114
115
 
115
116
  resolve({