Open khattab93 opened 4 years ago
@shahen94 Could you help me with my issue?
I had the same issue. Did you solve this problem @khattab93 ?
@khattab93 @tiennm16 @santiagovazquez This seems to have been broken by #264. Since the time range is set on the AVMutableComposition, it no longer needs to be set on the AVAssetExportSession. Setting it in both cases results in startTime being doubled (e.g. you want trim a 10 seconds video with startTime: 1 and endTime: 10. You expect a 9 second video in result, but the resulting video is 8 seconds long. The real startTime is 2) I did not encounter varying resulting lengths as mentioned by @khattab93, so there might be something else at play as well.
This is fixed by simply removing this line from RNVideoTrimmer.swift
:
exportSession.timeRange = timeRange
An alternative way is to halve your startTime when invoking ProcessingManager.trim()
in iOS, if you want to avoid changing module files.
Keeping a track for when it is fixed in the library and code can be returned to normal.
@IlyaPyatkin Thanks. halving start time is working.
Current Behavior
ProcessingManager.trim() doesn't trim video correctly on IOS.
When I pass a startTime which isn't equal zero, the video is trimmed incorrectly. The trimmed video was always less than expected. The end time of the trimmed video was the same as what I passed but the start time was larger.
If I tried to trim the video with the same startTime and endTime multiple times, I got different videos of different durations.
Example:
After saving the trimmed video, I found that the saved video was 3 seconds long. I tried to trim again with the same values and I got a video of 4 seconds long.
Expected Behavior
I expect the trimmed video to be as what I define in the options.
Your Environment