image-video-optimizer 1.1.2 → 1.1.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 +1 -1
- package/src/videoProcessor.js +12 -9
package/package.json
CHANGED
package/src/videoProcessor.js
CHANGED
|
@@ -75,11 +75,13 @@ class VideoProcessor {
|
|
|
75
75
|
ffmpegCommand = ffmpegCommand.videoCodec('libx264').audioCodec('aac');
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
// Add input/output options with proper quoting
|
|
79
|
+
ffmpegCommand = ffmpegCommand.inputOptions(['-fflags', '+genpts']);
|
|
80
|
+
ffmpegCommand = ffmpegCommand.outputOptions(['-crf', '23', '-preset', 'medium']);
|
|
81
|
+
ffmpegCommand = ffmpegCommand.format('mp4');
|
|
82
|
+
ffmpegCommand = ffmpegCommand.output(tempPath);
|
|
83
|
+
|
|
78
84
|
ffmpegCommand
|
|
79
|
-
.outputOptions('-crf 23')
|
|
80
|
-
.outputOptions('-preset medium')
|
|
81
|
-
.format('mp4')
|
|
82
|
-
.output(tempPath)
|
|
83
85
|
.on('start', (commandLine) => {
|
|
84
86
|
console.log(`FFmpeg command: ${commandLine}`);
|
|
85
87
|
})
|
|
@@ -117,7 +119,7 @@ class VideoProcessor {
|
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
let ffmpegCommand = ffmpeg(inputPath);
|
|
120
|
-
|
|
122
|
+
|
|
121
123
|
if (needsResize) {
|
|
122
124
|
const newHeight = Math.round((maxWidth / videoStream.width) * videoStream.height);
|
|
123
125
|
ffmpegCommand = ffmpegCommand.videoFilters(`scale=${maxWidth}:${newHeight}`);
|
|
@@ -138,11 +140,12 @@ class VideoProcessor {
|
|
|
138
140
|
ffmpegCommand = ffmpegCommand.videoCodec('libx264').audioCodec('aac');
|
|
139
141
|
}
|
|
140
142
|
|
|
143
|
+
ffmpegCommand = ffmpegCommand.inputOptions(['-fflags', '+genpts']);
|
|
144
|
+
ffmpegCommand = ffmpegCommand.outputOptions(['-crf', '23', '-preset', 'medium']);
|
|
145
|
+
ffmpegCommand = ffmpegCommand.format('mp4');
|
|
146
|
+
ffmpegCommand = ffmpegCommand.output(outputPath);
|
|
147
|
+
|
|
141
148
|
ffmpegCommand
|
|
142
|
-
.outputOptions('-crf 23')
|
|
143
|
-
.outputOptions('-preset medium')
|
|
144
|
-
.format('mp4')
|
|
145
|
-
.output(outputPath)
|
|
146
149
|
.on('start', (commandLine) => {
|
|
147
150
|
console.log(`FFmpeg command: ${commandLine}`);
|
|
148
151
|
})
|