-
-
Notifications
You must be signed in to change notification settings - Fork 965
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
Fast frame-perfect seeking [Help needed] #200
Comments
@jonnyburger has funded $150.00 to this issue.
|
Added a bounty tho whoever can provide a solution for this problem! Requirements: Remove the need for a timeout in But as a warning, this is very hard and might even be impossible. |
Using canvas is a great idea in browser scenario. |
Created a Chrome issue to see what's up: also the bug is fixed on linux and windows, only remains on macos (!!). See #624 |
@jonnyburger has cancelled funding for this issue.(Cancelled amount: $150.00) See it on IssueHunt |
Fixed by introducing a new component: |
Problem: During render, we want to precisely capture each frame of a
<Video>
. Meaning frame 10 in the source video is frame 10 in the rendered video as well. This works, but the browser might not immediately show the correct frame after seeking to that position and emitting theseeked
event. There is always some delay until the frame is actually displayed. This led to some frame jumping in Remotion and is currently fixed in the Audio PR by just setting a 300ms timeout after theseeked
event was emitted. This seems to work, but of course slows down render time.This is my command with which I tested it:
npx remotion render src/index.tsx video-testing video-testing.mp4 && ffmpeg -i video-testing.mp4 -f image2 out%02d.jpg
The screenshot below shows the desired output: Frames numbered 0 - n in the correct order.
The wrong output is if some frame numbers are duplicated. Sometimes one has to run a command multiple times to get a buggy output.
What I've tried:
videoRef.current.requestVideoFrameCallback
: This is a new Web API (doesn't have TypeScript support yet) which should tell you when the frame is expected to be rendered. Unfortunately it wasn't accurate enough to be perfect. https://web.dev/requestvideoframecallback-rvfc/Web Codec API
: Allows you to decode a video in Javascript. Needs a flag enabled but we can do that in Puppeteer. Unfortunately there is very little information on the internet out yet on how to do decode for example the example framer.mp4 video. I am struggling to pass the correctdescription
parameter and don't know how to figure it out:Of course it could also be done using FFMPEG commands, but it would be more complicated. Remote videos would have to be downloaded first.
Another technique is rendering the video on a canvas and using some algorithm to determine if the video has already jumped to the right place. But also for remote videos, they need to have CORS enabled which would introduce another requirement.
Anybody has knowledge in any of these areas and can help out with code or advice?
IssueHunt Summary
Backers (Total: $0.00)
Become a backer now!
Or submit a pull request to get the deposits!
Tips
The text was updated successfully, but these errors were encountered: