Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output video is very laggy/choppy #82

Open
GustasBr opened this issue Jan 26, 2021 · 1 comment
Open

Output video is very laggy/choppy #82

GustasBr opened this issue Jan 26, 2021 · 1 comment

Comments

@GustasBr
Copy link

So, basically I was playing with BBMetalImageDemo on my iPhone. I changed VideoFilterVC2 video path to my own video which is basically a 15sec iPhone screen recording. Then I added let lookupFilter = BBMetalLookupFilter(lookupTable: UIImage(named: "lookup_6")!.bb_metalTexture!) - basically just changed the filter to be a LookupFilter.

And I saw that now the video is very laggy/choppy. I think because the video is not the default demo video. But it's also very low quality video. Also, I tried to save the video from outputUrl to camera roll but it's still laggy and choppy.

Is there anything I can do to make my output video don't be choppy and laggy? If you want I can somehow upload the test video link here but as I said the video is nothing special just a simple screen recording.

This framework works great with photos but I don't know if I can use it with videos. Thank you!

@GustasBr
Copy link
Author

I found out where the problem is - Asset writer or video input is not ready for writing this frame.

What actually works for me is usleep:
videoSource.start(progress: { (frameTime) in usleep(4000) print(frameTime) }

So, I'm thinking that for video saving into photo library some short delay is not a problem for user. Now the question is how to solve the problem if user wants to preview filters when trying to edit the video? I'm going to try testing if videoWriter works better with lower resolution videos. Maybe that's an option for live editing. I'm going to keep this issue open in case anyone have a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant