image-video-optimizer 3.3.3 → 3.3.33

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.
Files changed (3) hide show
  1. package/README.md +59 -15
  2. package/bin/cli.js +1 -1
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -1,11 +1,14 @@
1
1
  # Image Video Optimizer
2
2
 
3
- A powerful CLI tool to optimize images and videos with configurable resize and compression settings.
3
+ A powerful CLI tool to optimize images, videos, audio, and PDFs with configurable resize and compression settings.
4
4
 
5
5
  ## Features
6
6
 
7
7
  - **Image Optimization**: Resize and convert images to specified formats
8
8
  - **Video Optimization**: Resize videos and encode to specified formats
9
+ - **Audio Optimization**: Convert and compress audio files to MP3
10
+ - **PDF Compression**: Compress PDF files using Ghostscript
11
+ - **Resume Support**: Track processed files and resume interrupted sessions
9
12
  - **Configurable Settings**: Use `.image-video-optimizer.conf` files for custom settings
10
13
  - **Smart Compression**: Only keeps optimized files if compression is effective (>1%)
11
14
  - **Recursive Search**: Finds all media files in subdirectories
@@ -32,7 +35,7 @@ image-video-optimizer /path/to/directory [options]
32
35
  ```
33
36
 
34
37
  - `<directory>`: Target directory to optimize (required)
35
- - `-d, --dry-run`: Show what would be processed without making changes
38
+ - `-r, --reset`: Reset status file and start fresh
36
39
  - `-v, --verbose`: Enable verbose logging
37
40
  - `-V, --version`: Show version number
38
41
  - `-h, --help`: Show help
@@ -49,6 +52,12 @@ img_format=jpg # Target format for image conversion
49
52
  # Video settings
50
53
  video_max_width=720 # Maximum width for videos (pixels)
51
54
  video_encode=h264 # Video encoding format
55
+
56
+ # Audio settings
57
+ audio_ext=mp3 # Audio extension for audio files
58
+
59
+ # PDF settings
60
+ pdf_compress=true # Enable/disable PDF compression
52
61
  ```
53
62
 
54
63
  ### Default Configuration
@@ -58,6 +67,8 @@ If no configuration file is found, these defaults are used:
58
67
  - `img_format`: jpg
59
68
  - `video_max_width`: 720
60
69
  - `video_encode`: h264
70
+ - `audio_ext`: mp3
71
+ - `pdf_compress`: true
61
72
 
62
73
  ## Supported Formats
63
74
 
@@ -69,6 +80,14 @@ If no configuration file is found, these defaults are used:
69
80
  - Input: avi, mov, wmv, flv, webm, mkv, m4v, mp4
70
81
  - Output: mp4 (with configurable encoding)
71
82
 
83
+ ### Audio
84
+ - Input: mp3, wav, flac, aac, ogg, m4a
85
+ - Output: mp3 (configurable)
86
+
87
+ ### Documents
88
+ - Input: pdf
89
+ - Output: pdf (compressed)
90
+
72
91
  ## Processing Logic
73
92
 
74
93
  ### Image Processing
@@ -86,6 +105,24 @@ If no configuration file is found, these defaults are used:
86
105
  5. Converts to MP4 format
87
106
  6. Compares file sizes and keeps optimized version only if compression > 1%
88
107
 
108
+ ### Audio Processing
109
+ 1. Searches for audio files recursively
110
+ 2. Converts to target format (default: MP3)
111
+ 3. Applies aggressive compression (single channel, 16kHz, 32k bitrate)
112
+ 4. Replaces original with compressed version
113
+
114
+ ### PDF Processing
115
+ 1. Searches for PDF files recursively
116
+ 2. Uses Ghostscript to compress PDFs
117
+ 3. Falls back to copy if Ghostscript is not available
118
+ 4. Replaces original with compressed version
119
+
120
+ ### Resume Logic
121
+ 1. Creates `.image-video-optimizer-status.json` to track processed files
122
+ 2. Skips already processed files on subsequent runs
123
+ 3. Updates status file after each file is processed
124
+ 4. Use `--reset` to clear status and start fresh
125
+
89
126
  ## Examples
90
127
 
91
128
  ### Optimize a directory with default settings
@@ -93,9 +130,14 @@ If no configuration file is found, these defaults are used:
93
130
  image-video-optimizer ./photos
94
131
  ```
95
132
 
96
- ### Dry run to see what would be processed
133
+ ### Reset status and start fresh
134
+ ```bash
135
+ image-video-optimizer ./photos --reset
136
+ ```
137
+
138
+ ### Verbose output
97
139
  ```bash
98
- image-video-optimizer ./photos --dry-run
140
+ image-video-optimizer ./photos --verbose
99
141
  ```
100
142
 
101
143
  ### Custom configuration
@@ -105,11 +147,14 @@ img_max_width=1920
105
147
  img_format=webp
106
148
  video_max_width=1080
107
149
  video_encode=h265
150
+ audio_ext=mp3
151
+ pdf_compress=true
108
152
  ```
109
153
 
110
154
  Then run:
111
155
  ```bash
112
- image-video-optimizer ./media
156
+ image-video-optimizer . # and image-video-optimizer the same as it will proceed the current directory
157
+ image-video-optimizer ./media/path/to/directory # will proceed the specified directory
113
158
  ```
114
159
 
115
160
  ## Dependencies
@@ -117,30 +162,29 @@ image-video-optimizer ./media
117
162
  - [sharp](https://sharp.pixelplumbing.com/) - Image processing
118
163
  - [fluent-ffmpeg](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg) - Video processing
119
164
  - [commander](https://github.com/tj/commander.js) - CLI framework
120
- - [chalk](https://github.com/chalk/chalk) - Terminal styling
121
165
 
122
166
  ## System Requirements
123
167
 
124
168
  - Node.js >= 14.0.0
125
- - FFmpeg (for video processing)
169
+ - FFmpeg (for video and audio processing)
170
+ - Ghostscript (for PDF compression, optional)
126
171
 
127
- ### Installing FFmpeg
128
-
129
- **Ubuntu/Debian:**
172
+ ### Installing Requirements
173
+ **Arch/GopiOS:**
130
174
  ```bash
131
175
  sudo pacman -Syu ffmpeg x264
176
+ ```
132
177
 
133
- sudo apt update && sudo apt install ffmpeg
178
+ **Ubuntu/Debian:**
179
+ ```bash
180
+ sudo apt install ffmpeg ghostscript
134
181
  ```
135
182
 
136
183
  **macOS:**
137
184
  ```bash
138
- brew install ffmpeg
185
+ brew install ffmpeg ghostscript
139
186
  ```
140
187
 
141
- **Windows:**
142
- Download from [ffmpeg.org](https://ffmpeg.org/download.html) and add to PATH
143
-
144
188
  ## License
145
189
 
146
190
  nirvána
package/bin/cli.js CHANGED
@@ -9,7 +9,7 @@ const program = new Command();
9
9
  program
10
10
  .name('image-video-optimizer')
11
11
  .description('CLI tool to optimize and compress images, videos, audio, and PDFs')
12
- .version('3.2.0');
12
+ .version('3.3.33');
13
13
 
14
14
  program
15
15
  .argument('[directory]', 'Target directory to optimize', process.cwd())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "image-video-optimizer",
3
- "version": "3.3.3",
3
+ "version": "3.3.33",
4
4
  "description": "CLI tool to optimize and compress images and videos with configurable settings",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -18,8 +18,8 @@
18
18
  "ffmpeg",
19
19
  "cli"
20
20
  ],
21
- "author": "",
22
- "license": "MIT",
21
+ "author": "Kar",
22
+ "license": "nirvána",
23
23
  "dependencies": {
24
24
  "commander": "^11.0.0",
25
25
  "sharp": "^0.32.0",