@editframe/assets 0.15.0-beta.13 → 0.15.0-beta.14

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/dist/Probe.d.ts CHANGED
@@ -693,10 +693,13 @@ export declare class Probe {
693
693
  get hasAudio(): boolean;
694
694
  get hasVideo(): boolean;
695
695
  get isAudioOnly(): boolean;
696
+ get isLowSampleMp3(): boolean;
696
697
  get isVideoOnly(): boolean;
697
698
  get mustProcess(): boolean;
698
- get ffmpegAudioOptions(): string[];
699
- get ffmpegVideoOptions(): string[];
699
+ get ffmpegAudioInputOptions(): string[];
700
+ get ffmpegVideoInputOptions(): never[];
701
+ get ffmpegAudioOutputOptions(): string[];
702
+ get ffmpegVideoOutputOptions(): string[];
700
703
  createConformingReadstream(): Readable;
701
704
  }
702
705
  export {};
package/dist/Probe.js CHANGED
@@ -188,13 +188,30 @@ class Probe {
188
188
  get isAudioOnly() {
189
189
  return this.audioStreams.length > 0 && this.videoStreams.length === 0;
190
190
  }
191
+ get isLowSampleMp3() {
192
+ return this.audioStreams.some(
193
+ (stream) => stream.codec_name === "mp3" && Number.parseInt(stream.sample_rate, 10) < 44100
194
+ );
195
+ }
191
196
  get isVideoOnly() {
192
197
  return this.audioStreams.length === 0 && this.videoStreams.length > 0;
193
198
  }
194
199
  get mustProcess() {
195
200
  return this.mustReencodeAudio || this.mustReencodeVideo || this.mustRemux;
196
201
  }
197
- get ffmpegAudioOptions() {
202
+ get ffmpegAudioInputOptions() {
203
+ if (!this.hasAudio) {
204
+ return [];
205
+ }
206
+ if (this.isLowSampleMp3) {
207
+ return ["-c:a", "mp3"];
208
+ }
209
+ return [];
210
+ }
211
+ get ffmpegVideoInputOptions() {
212
+ return [];
213
+ }
214
+ get ffmpegAudioOutputOptions() {
198
215
  if (!this.hasAudio) {
199
216
  return [];
200
217
  }
@@ -203,12 +220,14 @@ class Probe {
203
220
  "-c:a",
204
221
  "aac",
205
222
  "-b:a",
206
- "192k"
223
+ "192k",
224
+ "-ar",
225
+ "48000"
207
226
  ];
208
227
  }
209
228
  return ["-c:a", "copy"];
210
229
  }
211
- get ffmpegVideoOptions() {
230
+ get ffmpegVideoOutputOptions() {
212
231
  if (!this.hasVideo) {
213
232
  return [];
214
233
  }
@@ -239,10 +258,12 @@ class Probe {
239
258
  return createReadStream(this.absolutePath);
240
259
  }
241
260
  const ffmpegConformanceArgs = [
261
+ ...this.ffmpegAudioInputOptions,
262
+ ...this.ffmpegVideoInputOptions,
242
263
  "-i",
243
264
  this.absolutePath,
244
- ...this.ffmpegAudioOptions,
245
- ...this.ffmpegVideoOptions,
265
+ ...this.ffmpegAudioOutputOptions,
266
+ ...this.ffmpegVideoOutputOptions,
246
267
  "-f",
247
268
  "mp4",
248
269
  "-movflags",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editframe/assets",
3
- "version": "0.15.0-beta.13",
3
+ "version": "0.15.0-beta.14",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {