-
Notifications
You must be signed in to change notification settings - Fork 15
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
Seeking can produce different video frames in Firefox and Chrome #391
Comments
Filed a bug for Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1739125 |
This issue was confirmed to be a Firefox bug. Maybe we should show a warning for users who use Firefox in a version that is affected by this. |
I've now found an example for an annotation that might be shown incorrectly in Chrome. It's this annotation. The Largo thumbnail is below, which should be the correct time and position from Ffmpeg. Firefox seems to show the same frame than the thumbnail but Chrome does not.
We should do an experiment with the video and extract the frame at the time of the annotation with Ffmpeg and also build a minimal HTML document that seeks the video to the same time. Then check the document with Firefox and Chrome. If Chrome is wrong, look for a filed bug or else file a bug similar to the one for Firefox (see above). |
I now confirmed that indeed Chrome shows a different frame than Firefox and FFmpeg ( <video id="video" src="original.mp4"></video>
<script type="text/javascript">
let video = document.getElementById('video');
video.currentTime = 397.0060;
</script> It turned out that this time an incorrect position of the "moov atom" was the problem. The atom should be placed at the start of the file but here it apparently was at the end:
The atom van be moved to the beginning with:
Now Chrome displays the correct frame at the time. All MP4 videos should have their moov atom at the start. Should we display a warning message if this is not the case? |
This will be resolved with: https://bugzilla.mozilla.org/show_bug.cgi?id=1735300 |
I've been investigating a similar issue and ran across an interesting case that seems unrelated to the moov atom. The timestamp in question (extracted from the query-param) is t=1931415 (or 193.1415s) I've noticed that "next/prev" frame navigation increments the ts query param in steps of 0.0100 s. So what frame should be extracted? I did a bit of poking and I think FFMPG always rounds up to the next frame, whereas HTML (at least on Chrome) and OpenCV rounds down to the previous frame. The first column has t=1930929 (or 193.0929s), which falls exactly on a frame. All frame extractions are identical. I think this could be addressed by using a frame number as a query-parameter. EDITE: I am starting to think that supporting framerates of 29.97 is going to be super annoying in the context of adding temporal annotations. I think it needs to be discouraged. perhaps in a best-practices guide. Showing a fps warning similar to the moov atom warning could be the best route. |
Hi, thanks for making the effort to investigate this! This is really one of the hardest issues in BIIGLE right now and I still don't see a viable solution. Using a frame number as query parameter would be correct. However, the HTML video API does not expose this. Also, it does not expose exact timestamps for security reasons. To work around this, BIIGLE seeks the video to the current (inexact) timestamp whenever the video is paused in the hope that this will reliably produce the same video frame the next time the inexact timestamp is used again. We also can't get information on the framerate or the moov atom in the frontend (although this could be done once in the backend). The only (for us, currently) non-viable solution I see would be to let BIIGLE re-encode all uploaded videos to a very specific and well-defined format. With this, we could implement video playback with the WebCodecs API, which gives us access to individual video frames etc. Other than that, I don't see a way to improve the status quo if what you say is true and annotations/thumbnails are still off with a correct moov atom... |
I created a series of reference videos that shows the frame number, time, frame rate and status of the -faststart flag. as a test, I chose the 5fps video and placed a laser point when the moving circle touches a gridline First thing I noticed was that the experimental next/prev frame navigation works well, but the ts query param is off (does not represent the time of the frame). The largo thumbnails shows a different frame both both variants: Feel free to reproduce and validate the moov flag in the reference videos. |
I did play around with updating annotation by snapping/quantizing annotation timestamps to frames. It's possible that I updated these without realizing. |
We had another user report this issue just now. I see two different cases:
|
Seeking to the time of a video annotation can produce different vieo frames in Firefox and Chrome (e.g. video 6018). This can result in erroneously displayed annotation locations in the video.
This seems to be a problem caused by the video encoding (presumably through conversion with VLC). Judging by the Largo patches generated by ffmpeg with the same annotation timestamp, Firefox seems to show the wrong video frame.
The text was updated successfully, but these errors were encountered: