gorastudio-git / SCNRecorder

The best way to record your AR experience!
MIT License
201 stars 51 forks source link

Using SCNRecorder to record a video of a specific number of seconds. #64

Open giomurru opened 11 months ago

giomurru commented 11 months ago

Hi there and thank you for this awesome library, I am trying to record a video of a 3D scene with a specific duration of a specific number of seconds, but I am not able to achieve a precise timing to the order of 10 millisecond. In some cases there's difference of 10 millisecond in the output video. My approach is to observe the duration property of the VideoRecording object and call the finishVideoRecording when the specific amount of frames has been recorded. This seems to be working for short videos (3s, 5s, 15s). However when duration of video is set to 60 s I get an output of 60.01 s or even 60.03 s depending on the device. Can you please help me to understand what I am doing wrong. Is there another way to achieve this kind of precision and make independent from the device? I have pushed in my repo an example app that's using the logic I described in this issue. The repo uses the latest SCNRecorder library but you are free to use a local development version of the library by changing the Podfile and running pod install again. This is the link to the repo. https://github.com/giomurru/SCNRecorder-SampleApp Thank you.

v-grigoriev commented 8 months ago

This is a really late reply 😄 .

I think it is impossible to get accurate precision with the current implementation. The buffers processing and the pause action happen on its own thread. When you pause you can't predict how many frames left in the queue.

So, the implementation should be changed to achieve high precision, I just didn't design the processing for this purpose.