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

Discrepancy between time stamps in beaverdam player and ffmpeg/vlc player #160

Open
bkmultimedia opened this issue Jan 17, 2019 · 2 comments

Comments

@bkmultimedia
Copy link

Hi,

I have labelled the videos every 1 second, and am trying to extract annotations every every 1 second along with the associated frame in the video using ffmpeg. I have uploaded 60fps videos. For some videos, the frame I extract using ffmpeg aligns with the 1 second intervals in the beaverdam player exactly as expected (i.e. 1s in beaverdam player = 60th frame using ffmpeg, 2s = 120th frame).

However, for many videos, there is a discrepancy between the 1,2,3...s mark in the beaverdam player, and the frame extracted via ffmpeg/vlc at that time stamp. It seems 1s = ~22nd frame, 2s = ~84th frame, 3s = 140th frame, but no clear relationship exists.

Could you please shed some light as to why this may be happening? My annotations rely on being able to extract the exact frame where the labels were created (1 second intervals). Thanks greatly for your help.

@antingshen
Copy link
Owner

antingshen commented Jan 17, 2019

The player in BeaverDam is just the standard HTML5 video player. I think it has some weirder behavior on the timestamps between frames? If it has a discrepancy with ffmpeg frames and it's important to you, consider using image lists instead, or look into HTML5 video players

@torresalyssa
Copy link

The discrepancy you're seeing might be due to the videos having either a constant frame rate (CFR) or variable frame rate (VFR). If this theory is correct, the videos that align correctly are with CFR and the ones that don't are with VFR.

You can check this by running the following command (tested with ffmpeg v4.2.1):

ffmpeg -i input.mp4 -vf vfrdet -f null -

The output should tell you whether or not the video has a variable frame rate. For example, an output of:

[Parsed_vfrdet_0 @ 000001648d06eec0] VFR:0.000000 (0/542)

indicates that the video has a constant frame rate. On the other hand, an output of:

[Parsed_vfrdet_0 @ 0x56518fa3f380] VFR:0.400005 (15185/22777) min: 1801 max: 3604)

means that 15818 frames have variable frame rate and 22777 have constant bitrate.

Note: I also rely on being able to extract exact frames for my workflow and have been playing around to see how this can be done with this tool. I found that creating a test video that has the frame number overlaid on each frame has been helpful. You can do this with ffmpeg very easily:

ffmpeg -i input,mp4 -vf "drawtext=fontfile=Arial.ttf: text='%{frame_num}': start_number=1: x=(w-tw)/2: y=h-(2*lh): fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=5" -c:a copy output

This will overlay the frame number onto each frame, with the first frame being frame 1 (given by start_number=1).

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

3 participants