image-video-optimizer 2.0.0 → 2.0.2
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 +1 -1
- package/src/videoProcessor.js +4 -3
package/package.json
CHANGED
package/src/videoProcessor.js
CHANGED
|
@@ -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({
|