I can see a lot of solutions for trimming videos using ffmpeg but all of them either drop a few frames, audio is out of sync or video is a few seconds longer than specified. I have tried pretty much everything I could find and nothing worked. Only one solution worked and it was re-encoding but if the video was longer than 5sec it took too long.
A few combinations I have tried:
ffmpeg -y -i test.mp4 -ss 00:00:15.000 -t 00:00:10.000 -c:v copy -c:a copy -avoid_negative_ts make_zero test-1.mp4 //drops starting frames
ffmpeg -ss 00:00:15.000 -t 00:00:10.000 -i test.mp4 -c copy -avoid_negative_ts make_zero test-1.mp4 //additional few seconds to the specified video length
If you can share any other libraries or APIs I could use to achieve my goal it would be much appreciated. As far as I researched ffmpeg was the most popular solution but in this case it doesn't work because I need the trimming to be precise.