react-native-video-trim 8.1.3 → 8.1.4
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/ios/VideoTrim.swift +10 -19
- package/package.json +1 -1
package/ios/VideoTrim.swift
CHANGED
|
@@ -382,22 +382,13 @@ public class VideoTrim: RCTEventEmitter, AssetLoaderDelegate, UIDocumentPickerDe
|
|
|
382
382
|
let needsReEncode = hasUserTransform || cropNorm != nil || enablePreciseTrimming || needsSpeed
|
|
383
383
|
|
|
384
384
|
if needsReEncode, let vc = vc {
|
|
385
|
-
//
|
|
386
|
-
//
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
videoFilters.append("transpose=1")
|
|
393
|
-
} else if abs(sourceAngle + .pi / 2) < 0.1 {
|
|
394
|
-
videoFilters.append("transpose=2")
|
|
395
|
-
} else if abs(abs(sourceAngle) - .pi) < 0.1 {
|
|
396
|
-
videoFilters.append("transpose=1")
|
|
397
|
-
videoFilters.append("transpose=1")
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
385
|
+
// Let FFmpeg autorotate the source (note: NO -noautorotate below). Autorotate bakes
|
|
386
|
+
// the source rotation matrix into upright, display-orientation pixels AND strips the
|
|
387
|
+
// matrix from the output. The previous approach (-noautorotate + a manual source-
|
|
388
|
+
// compensation transpose) baked the pixels but left the source rotation matrix on the
|
|
389
|
+
// output, so on ffmpeg-kit 6 every rotation-tagged portrait clip came out
|
|
390
|
+
// double-rotated (sideways). User rotate/flip and crop below operate on the already-
|
|
391
|
+
// upright autorotated frame, so their math is unchanged.
|
|
401
392
|
switch vc.rotationCount {
|
|
402
393
|
case 1: videoFilters.append("transpose=2")
|
|
403
394
|
case 2:
|
|
@@ -464,9 +455,9 @@ public class VideoTrim: RCTEventEmitter, AssetLoaderDelegate, UIDocumentPickerDe
|
|
|
464
455
|
}
|
|
465
456
|
}
|
|
466
457
|
|
|
467
|
-
// -noautorotate
|
|
468
|
-
//
|
|
469
|
-
|
|
458
|
+
// NOTE: intentionally NO -noautorotate. FFmpeg autorotates the input so the source
|
|
459
|
+
// rotation is baked into the pixels and the output carries no stale rotation matrix
|
|
460
|
+
// (otherwise rotation-tagged portrait clips are double-rotated -> sideways on ffmpeg-kit 6).
|
|
470
461
|
cmds.append(contentsOf: ["-i", inputFile.path])
|
|
471
462
|
// When enablePreciseTrimming is the only reason for re-encode (no transforms),
|
|
472
463
|
// videoFilters is empty — skip -vf entirely to avoid FFmpeg error on empty filter.
|