Open chai86 opened 4 years ago
Have you used this method?
ProcessingManager.getPreviewForSecond()
The images I get here are not accurate,Can you help me
I have used that function, my images are also not accurate for the selected second
我已经使用了该功能,因此我的图像在选定的秒内也不准确 What a pity, but thank you anyway
我已经使用了该功能,因此我的图像在选定的秒内也不准确 What a pity, but thank you anyway
Idk if this fit your need. I write a swift function and expose it to JS:
@objc func getVideoOrientationFromAsset(asset : AVAsset) -> UIImage.Orientation {
let videoTrack: AVAssetTrack? = asset.tracks(withMediaType: AVMediaType.video)[0]
let size = videoTrack!.naturalSize
let txf: CGAffineTransform = videoTrack!.preferredTransform
if (size.width == txf.tx && size.height == txf.ty) {
return UIImage.Orientation.left;
} else if (txf.tx == 0 && txf.ty == 0) {
return UIImage.Orientation.right;
} else if (txf.tx == 0 && txf.ty == size.width) {
return UIImage.Orientation.down;
} else {
return UIImage.Orientation.up;
}
}
Pass in the local path of the video.
Since I can't find a lib to detect the video orientation, and the react-native-video-processing
does actually sometimes treat vertical/horizontal as the same.
How do i know the selected video's orientation as it comes in to be trimmed? I want to know whether to load the video portrait or landscape in VideoPlayer