-
Notifications
You must be signed in to change notification settings - Fork 93
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
frame to SMPTE conversion oddity #2
Comments
I found what that bug is: Otherwise, toFixed rounds up to the next hour whenever you pass the 30 minutes mark in a video. |
Thanks @philippede this fixes the bug! |
More frame to SMPTE math problems. The burned-in timecode in the screenshot starts at 00:59:59:00, so it should be off by a -24 from the frame count of the player. The VideoFrame library's get() function seems to be grabbing the proper frame count, but video.listen('SMPTE') is off by quite a number of seconds. The video in question is 23.98, and I get the same bad SMPTE values if I set the frameRate to '23.976' or to FrameRates.NTSC_Film. My code:
|
I managed to get this working for 23.976 video by changing VideoFrame.prototype.toTime to use the actual frame rate to calculate the frame number from milliseconds, and then (if the real frame rate is specified as 23.98 or 23.976) to use 24 as the number for calculating SMPTE timecode from the number of frames. I also added the ability to use an offset to affect displayed timecode values, because my video has a burn-in that reflects its embedded timecode rather than the html5 player's running timecode counter. I don't know if the changes I made futz things up for frame rates other than a 23.98 variant. This code is working for me, for the moment, but I don't claim to really know what I'm doing as regards either coding or javascript.
And for the offset -- up near the top of the code:
Less important info, but just to be a completist, here's some other info. In the html I've got a video and a couple of
And down in the javascript, the call to the VideoFrame library to link it up with the inline video and to set the display offset to match the burn-in:
|
Credit to philippede: allensarkisyan#2 (comment)
My pull request fixes the original bug in this issue. Thanks @philippede for providing the correct solution. |
At 30fps, converting from frames to SMPTE makes a large jump of one hour with a change of one frame:
53999 frames --> 00:29:59:29
54000 frames --> 01:30:00:00
The text was updated successfully, but these errors were encountered: