-
Notifications
You must be signed in to change notification settings - Fork 28
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
Timestamp discontinuity with CVSource
class
#29
Comments
The problem is that opencv get() returns 0 if the device doesn't support the property (POS_MSECS). See here. So fictrac's _timestamp would just be zero for ever in that case. Hence if the get() function returns 0 I use backup time instead. Agree that it's a bit annoying to have very large timestamp jumps at the beginning of output though. Perhaps I could change the code to only default to backup when retrieved timestamp is zero for two or more frames in a row - assuming video files will only ever have first frame zero. |
Thanks for your quick response and thanks for all your work in this project. What a terrible decision by open CV to use a valid value to mark a null: My two cents is that it would be easier to just have two columns in the output data that then users can use as they wish:
I think that it is easier if the fallback is transparent like that and way less maintenance burden for you. Trying to hammer these two concepts into the single I think you are proviidng similar value with the |
Btw, why is Lines 236 to 244 in 9ac055e
but not for Lines 292 to 300 in 9ac055e
? |
I also use a timestamp in the program and have to decide which source to use anyway. I will have a closer look at your suggestion though. At least printing some indication of source for tinestamp would be sensible. |
This looks suspiciously like a bug. Will take a look! |
Thanks again. Btw, I edited my comment above to:
Just in case you read it differently. That was my original intention. I think that your decision of not trying to second guess Open CV is very sensible. |
The condition to fallback to system time in the
CVSource
class is the following:fictrac/src/CVSource.cpp
Lines 162 to 165 in 9ac055e
But I think the condition should be strict, that is, I think the condition should be
_timestamp < 0
. Otherwise, timestamps which are 0 are ignored and the fallback of the system time is used instead which creates a time discontinuity. As an example, this is the data that I got by running the algorithm in thesample.mp4
:See the large discontinuity caused by the first timestamp being 0.
To confirm that the first timestamp is indeed 0 we can run ffprobe:
ffprobe -i sample.mp4 -select_streams v:0 -show_entries frame=best_effort_timestamp_time,pkt_pts_time,pkt_dts_time,pkt_duration_time -of default=noprint_wrappers=1 -v quiet | head -n 20 pkt_pts_time=0.000000 pkt_dts_time=0.000000 best_effort_timestamp_time=0.000000 pkt_duration_time=0.033333 pkt_pts_time=0.033333 pkt_dts_time=0.033333 best_effort_timestamp_time=0.033333 pkt_duration_time=0.033333 pkt_pts_time=0.066667 pkt_dts_time=0.066667 best_effort_timestamp_time=0.066667 pkt_duration_time=0.033333 pkt_pts_time=0.100000 pkt_dts_time=0.100000 best_effort_timestamp_time=0.100000 pkt_duration_time=0.033333 pkt_pts_time=0.133333 pkt_dts_time=0.133333 best_effort_timestamp_time=0.133333 pkt_duration_time=0.033333
The text was updated successfully, but these errors were encountered: