-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
The condition to fallback to system time in the CVSource class is the following:
Lines 162 to 165 in 9ac055e
| LOG_DBG("Frame captured %dx%d%d @ %f (t_sys: %f ms, t_day: %f ms)", _frame_cap.cols, _frame_cap.rows, _frame_cap.channels(), _timestamp, ts, _ms_since_midnight); | |
| if (_timestamp <= 0) { | |
| _timestamp = ts; | |
| } |
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 the sample.mp4:
| frame_counter | sequence_counter | movement_direction | movement_speed | timestamp | alt_timestamp | delta_timestamp | |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | -0 | 0 | 1.69019e+12 | 4.14554e+07 | 0 |
| 1 | 1 | 1 | 5.79849 | 0.0246007 | 33.3333 | 4.14554e+07 | -1.69019e+12 |
| 2 | 2 | 2 | 3.5273 | 0.0211707 | 66.6667 | 4.14554e+07 | 33.3333 |
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.033333Metadata
Metadata
Assignees
Labels
No labels