shahen94 / react-native-video-processing

Native Video editing/trimming/compressing :movie_camera: library for React-Native
https://shahen94.github.io/react-native-video-processing/
MIT License
1.24k stars 323 forks source link

Video Trimming not correct on Android #344

Open daithinh2401 opened 3 years ago

daithinh2401 commented 3 years ago

Current Behavior

The trim function on Android seem have a bit inaccuracy, this is the option that I used for trim: {startTime: 0.4, endTime: 47}

The ffmpeg command is: ffmpeg -y -i movie.mp4 -ss 00:00:00.400 -to 00:00:47 -preset ultrafast -c:v copy -c:a copy cut.mp4

But the result always have the duration 46s, that mean it always cut 1s instead of 400ms as the params above. If I use {startTime: 1.2} it also cut 2s, seem it can not cut by milliseconds, just the seconds only.

On iOS it can work perfectly, maybe it's a bug come from ffmpeg, or we need to change some params for more accurate.

Expected Behavior

The trim function can work correctly, the video output should have the duration 46.6s

Your Environment

Android OS: 8.1 / 9.0 Samsung J7 Prime / Samsung S9+

software version
react-native-video-processing ^2.0.0
react-native 0.60.5
node v14.17.3
shahen94 commented 3 years ago

@daithinh2401 Not sure about this. Seems everything is correct in the command. Could be something related to FFMPEG