Display time in video

Given a video,I need to calculate the time at which an event occurs and then store it.
For eg: given a video of 25 seconds,the output may look like this
Event_YES 00:03
Event_No 00:25
and so on
A similar question was posted on opencv forum (https://answers.opencv.org/question/9955/i-want-to-display-time-in-my-video-using-opencv/)where one of the users had recommended using CV_CAP_PROP_POS_MSEC, and CV_CAP_PROP_POS_AVI_RATIO.
However i am still a bit unclear on how we can use these flags to get the result
for eg I referred to the following link that illustrates usage of PROP_POS_MSEC
refer to answer by nkhendry
Issue here is that if i use the idea suggested in above link my output is of the form
frame no 1 timestamp 480
But I am looking for an output of the following form

00:15 I know I can use a trackbar GUI but if someone can give me suggestions on how to use the flags to get the output in desired form as explained above,it will be nice. Enclosed is sample code which I used to get timestamps
import cv2

cap = cv2.VideoCapture('path_to_video/video_filename.avi')

frame_no = 0
while(cap.isOpened()):
    frame_exists, curr_frame = cap.read()
    if frame_exists:
        print("for frame : " + str(frame_no) + "   timestamp is: ", str(cap.get(cv2.CAP_PROP_POS_MSEC)))
    else:
        break
    frame_no += 1

cap.release()

related:

Actually i was the one who posted the question on stack overflow,and yes I understand the answer is in milliseconds.On executing the code,this is the output

for frame : 0   timestamp is:  0.0
for frame : 1   timestamp is:  40.0
for frame : 2   timestamp is:  80.0
for frame : 3   timestamp is:  120.0
for frame : 4   timestamp is:  160.0
for frame : 5   timestamp is:  200.0
for frame : 6   timestamp is:  240.0
for frame : 7   timestamp is:  280.0
for frame : 8   timestamp is:  320.0
for frame : 9   timestamp is:  360.0
for frame : 10   timestamp is:  400.0
for frame : 11   timestamp is:  440.0
for frame : 12   timestamp is:  480.0
for frame : 13   timestamp is:  520.0
for frame : 14   timestamp is:  560.0
for frame : 15   timestamp is:  600.0
for frame : 16   timestamp is:  640.0
for frame : 17   timestamp is:  680.0
for frame : 18   timestamp is:  720.0
for frame : 19   timestamp is:  760.0
for frame : 20   timestamp is:  800.0
for frame : 21   timestamp is:  840.0
for frame : 22   timestamp is:  880.0
for frame : 23   timestamp is:  920.0
for frame : 24   timestamp is:  960.0
for frame : 25   timestamp is:  1000.0
for frame : 26   timestamp is:  1040.0
for frame : 27   timestamp is:  1080.0
for frame : 28   timestamp is:  1120.0
for frame : 29   timestamp is:  1160.0
for frame : 30   timestamp is:  1200.0
for frame : 31   timestamp is:  1240.0
for frame : 32   timestamp is:  1280.0
for frame : 33   timestamp is:  1320.0
for frame : 34   timestamp is:  1360.0
for frame : 35   timestamp is:  1400.0000000000002
for frame : 36   timestamp is:  1440.0
for frame : 37   timestamp is:  1480.0
for frame : 38   timestamp is:  1520.0
for frame : 39   timestamp is:  1560.0
for frame : 40   timestamp is:  1600.0
for frame : 41   timestamp is:  1640.0000000000002
for frame : 42   timestamp is:  1680.0
for frame : 43   timestamp is:  1720.0
for frame : 44   timestamp is:  1760.0
for frame : 45   timestamp is:  1800.0
for frame : 46   timestamp is:  1840.0
for frame : 47   timestamp is:  1880.0000000000002
for frame : 48   timestamp is:  1920.0
for frame : 49   timestamp is:  1960.0
for frame : 50   timestamp is:  2000.0
for frame : 51   timestamp is:  2040.0
for frame : 52   timestamp is:  2080.0
for frame : 53   timestamp is:  2120.0
for frame : 54   timestamp is:  2160.0
for frame : 55   timestamp is:  2200.0
for frame : 56   timestamp is:  2240.0
for frame : 57   timestamp is:  2280.0000000000005
for frame : 58   timestamp is:  2320.0
for frame : 59   timestamp is:  2360.0
for frame : 60   timestamp is:  2400.0
for frame : 61   timestamp is:  2440.0
for frame : 62   timestamp is:  2480.0
for frame : 63   timestamp is:  2520.0
for frame : 64   timestamp is:  2560.0
for frame : 65   timestamp is:  2600.0
for frame : 66   timestamp is:  2640.0
for frame : 67   timestamp is:  2680.0
for frame : 68   timestamp is:  2720.0
for frame : 69   timestamp is:  2760.0000000000005
for frame : 70   timestamp is:  2800.0000000000005
for frame : 71   timestamp is:  2840.0
for frame : 72   timestamp is:  2880.0
for frame : 73   timestamp is:  2920.0
for frame : 74   timestamp is:  2960.0
for frame : 75   timestamp is:  3000.0
for frame : 76   timestamp is:  3040.0
for frame : 77   timestamp is:  3080.0
for frame : 78   timestamp is:  3120.0
for frame : 79   timestamp is:  3160.0
for frame : 80   timestamp is:  3200.0
for frame : 81   timestamp is:  3240.0
for frame : 82   timestamp is:  3280.0000000000005
for frame : 83   timestamp is:  3320.0000000000005
for frame : 84   timestamp is:  3360.0
for frame : 85   timestamp is:  3400.0
for frame : 86   timestamp is:  3440.0
for frame : 87   timestamp is:  3480.0
for frame : 88   timestamp is:  3520.0
for frame : 89   timestamp is:  3560.0
for frame : 90   timestamp is:  3600.0
for frame : 91   timestamp is:  3640.0
for frame : 92   timestamp is:  3680.0
for frame : 93   timestamp is:  3720.0
for frame : 94   timestamp is:  3760.0000000000005
for frame : 95   timestamp is:  3800.0000000000005
for frame : 96   timestamp is:  3840.0
for frame : 97   timestamp is:  3880.0
for frame : 98   timestamp is:  3920.0
for frame : 99   timestamp is:  3960.0
for frame : 100   timestamp is:  4000.0
for frame : 101   timestamp is:  4040.0
for frame : 102   timestamp is:  4080.0
for frame : 103   timestamp is:  4120.0
for frame : 104   timestamp is:  4160.0
for frame : 105   timestamp is:  4200.0
for frame : 106   timestamp is:  4240.0
for frame : 107   timestamp is:  4280.0
for frame : 108   timestamp is:  4320.0
for frame : 109   timestamp is:  4360.0
for frame : 110   timestamp is:  4400.0
for frame : 111   timestamp is:  4440.0
for frame : 112   timestamp is:  4480.0
for frame : 113   timestamp is:  4520.000000000001
for frame : 114   timestamp is:  4560.000000000001
for frame : 115   timestamp is:  4600.000000000001
for frame : 116   timestamp is:  4640.0
for frame : 117   timestamp is:  4680.0
for frame : 118   timestamp is:  4720.0
for frame : 119   timestamp is:  4760.0
for frame : 120   timestamp is:  4800.0
for frame : 121   timestamp is:  4840.0
for frame : 122   timestamp is:  4880.0
for frame : 123   timestamp is:  4920.0
for frame : 124   timestamp is:  4960.0
for frame : 125   timestamp is:  5000.0
for frame : 126   timestamp is:  5040.0
for frame : 127   timestamp is:  5080.0
for frame : 128   timestamp is:  5120.0
for frame : 129   timestamp is:  5160.0
for frame : 130   timestamp is:  5200.0
for frame : 131   timestamp is:  5240.0
for frame : 132   timestamp is:  5280.0
for frame : 133   timestamp is:  5320.0
for frame : 134   timestamp is:  5360.0
for frame : 135   timestamp is:  5400.0
for frame : 136   timestamp is:  5440.0
for frame : 137   timestamp is:  5480.0
for frame : 138   timestamp is:  5520.000000000001
for frame : 139   timestamp is:  5560.000000000001
for frame : 140   timestamp is:  5600.000000000001
for frame : 141   timestamp is:  5640.0
for frame : 142   timestamp is:  5680.0
for frame : 143   timestamp is:  5720.0
for frame : 144   timestamp is:  5760.0
for frame : 145   timestamp is:  5800.0
for frame : 146   timestamp is:  5840.0
for frame : 147   timestamp is:  5880.0
for frame : 148   timestamp is:  5920.0
for frame : 149   timestamp is:  5960.0
for frame : 150   timestamp is:  6000.0
for frame : 151   timestamp is:  6040.0
for frame : 152   timestamp is:  6080.0
for frame : 153   timestamp is:  6120.0
for frame : 154   timestamp is:  6160.0
for frame : 155   timestamp is:  6200.0
for frame : 156   timestamp is:  6240.0
for frame : 157   timestamp is:  6280.0
for frame : 158   timestamp is:  6320.0
for frame : 159   timestamp is:  6360.0
for frame : 160   timestamp is:  6400.0
for frame : 161   timestamp is:  6440.0
for frame : 162   timestamp is:  6480.0
for frame : 163   timestamp is:  6520.000000000001
for frame : 164   timestamp is:  6560.000000000001
for frame : 165   timestamp is:  6600.000000000001
for frame : 166   timestamp is:  6640.000000000001
for frame : 167   timestamp is:  6680.0
for frame : 168   timestamp is:  6720.0
for frame : 169   timestamp is:  6760.0
for frame : 170   timestamp is:  6800.0
for frame : 171   timestamp is:  6840.0
for frame : 172   timestamp is:  6880.0
for frame : 173   timestamp is:  6920.0
for frame : 174   timestamp is:  6960.0
for frame : 175   timestamp is:  7000.0
for frame : 176   timestamp is:  7040.0
for frame : 177   timestamp is:  7080.0
for frame : 178   timestamp is:  7120.0
for frame : 179   timestamp is:  7160.0
for frame : 180   timestamp is:  7200.0
for frame : 181   timestamp is:  7240.0
for frame : 182   timestamp is:  7280.0
for frame : 183   timestamp is:  7320.0
for frame : 184   timestamp is:  7360.0
for frame : 185   timestamp is:  7400.0
for frame : 186   timestamp is:  7440.0
for frame : 187   timestamp is:  7480.0
for frame : 188   timestamp is:  7520.000000000001
for frame : 189   timestamp is:  7560.000000000001
for frame : 190   timestamp is:  7600.000000000001
for frame : 191   timestamp is:  7640.000000000001
for frame : 192   timestamp is:  7680.0
for frame : 193   timestamp is:  7720.0
for frame : 194   timestamp is:  7760.0
for frame : 195   timestamp is:  7800.0
for frame : 196   timestamp is:  7840.0
for frame : 197   timestamp is:  7880.0
for frame : 198   timestamp is:  7920.0
for frame : 199   timestamp is:  7960.0
for frame : 200   timestamp is:  8000.0
for frame : 201   timestamp is:  8040.000000000001
for frame : 202   timestamp is:  8080.0
for frame : 203   timestamp is:  8120.000000000001
for frame : 204   timestamp is:  8160.0
for frame : 205   timestamp is:  8200.0
for frame : 206   timestamp is:  8240.0
for frame : 207   timestamp is:  8280.0
for frame : 208   timestamp is:  8320.0
for frame : 209   timestamp is:  8360.0
for frame : 210   timestamp is:  8400.0
for frame : 211   timestamp is:  8440.0
for frame : 212   timestamp is:  8480.0
for frame : 213   timestamp is:  8520.0
for frame : 214   timestamp is:  8560.0
for frame : 215   timestamp is:  8600.0
for frame : 216   timestamp is:  8640.0
for frame : 217   timestamp is:  8680.0
for frame : 218   timestamp is:  8720.0
for frame : 219   timestamp is:  8760.0
for frame : 220   timestamp is:  8800.0
for frame : 221   timestamp is:  8840.0
for frame : 222   timestamp is:  8880.0
for frame : 223   timestamp is:  8920.0
for frame : 224   timestamp is:  8960.0
for frame : 225   timestamp is:  9000.0
for frame : 226   timestamp is:  9040.000000000002
for frame : 227   timestamp is:  9080.0
for frame : 228   timestamp is:  9120.000000000002
for frame : 229   timestamp is:  9160.0
for frame : 230   timestamp is:  9200.000000000002
for frame : 231   timestamp is:  9240.0
for frame : 232   timestamp is:  9280.0
for frame : 233   timestamp is:  9320.0
for frame : 234   timestamp is:  9360.0
for frame : 235   timestamp is:  9400.0
for frame : 236   timestamp is:  9440.0
for frame : 237   timestamp is:  9480.0
for frame : 238   timestamp is:  9520.0
for frame : 239   timestamp is:  9560.0
for frame : 240   timestamp is:  9600.0
for frame : 241   timestamp is:  9640.0
for frame : 242   timestamp is:  9680.0
for frame : 243   timestamp is:  9720.0
for frame : 244   timestamp is:  9760.0
for frame : 245   timestamp is:  9800.0
for frame : 246   timestamp is:  9840.0
for frame : 247   timestamp is:  9880.0
for frame : 248   timestamp is:  9920.0
for frame : 249   timestamp is:  9960.0
for frame : 250   timestamp is:  10000.0
for frame : 251   timestamp is:  10040.000000000002
for frame : 252   timestamp is:  10080.0
for frame : 253   timestamp is:  10120.000000000002
for frame : 254   timestamp is:  10160.0
for frame : 255   timestamp is:  10200.000000000002
for frame : 256   timestamp is:  10240.0
for frame : 257   timestamp is:  10280.0
for frame : 258   timestamp is:  10320.0
for frame : 259   timestamp is:  10360.0
for frame : 260   timestamp is:  10400.0
for frame : 261   timestamp is:  10440.0
for frame : 262   timestamp is:  10480.0
for frame : 263   timestamp is:  10520.0
for frame : 264   timestamp is:  10560.0
for frame : 265   timestamp is:  10600.0
for frame : 266   timestamp is:  10640.0
for frame : 267   timestamp is:  10680.0
for frame : 268   timestamp is:  10720.0
for frame : 269   timestamp is:  10760.0
for frame : 270   timestamp is:  10800.0
for frame : 271   timestamp is:  10840.0
for frame : 272   timestamp is:  0.0
for frame : 273   timestamp is:  0.0
for frame : 274   timestamp is:  0.0
for frame : 275   timestamp is:  0.0

And as suggested by the person in the link (after performign the conversion)
the output is

for frame : 0   timestamp is:  0.0
for frame : 1   timestamp is:  0.04
for frame : 2   timestamp is:  0.08
for frame : 3   timestamp is:  0.12
for frame : 4   timestamp is:  0.16
for frame : 5   timestamp is:  0.2
for frame : 6   timestamp is:  0.24
for frame : 7   timestamp is:  0.28
for frame : 8   timestamp is:  0.32
for frame : 9   timestamp is:  0.36
for frame : 10   timestamp is:  0.4
for frame : 11   timestamp is:  0.44
for frame : 12   timestamp is:  0.48
for frame : 13   timestamp is:  0.52
for frame : 14   timestamp is:  0.56
for frame : 15   timestamp is:  0.6
for frame : 16   timestamp is:  0.64
for frame : 17   timestamp is:  0.68
for frame : 18   timestamp is:  0.72
for frame : 19   timestamp is:  0.76
for frame : 20   timestamp is:  0.8
for frame : 21   timestamp is:  0.84
for frame : 22   timestamp is:  0.88
for frame : 23   timestamp is:  0.92
for frame : 24   timestamp is:  0.96
for frame : 25   timestamp is:  1.0
for frame : 26   timestamp is:  1.04
for frame : 27   timestamp is:  1.08
for frame : 28   timestamp is:  1.12
for frame : 29   timestamp is:  1.16
for frame : 30   timestamp is:  1.2
for frame : 31   timestamp is:  1.24
for frame : 32   timestamp is:  1.28
for frame : 33   timestamp is:  1.32
for frame : 34   timestamp is:  1.36
for frame : 35   timestamp is:  1.4000000000000001
for frame : 36   timestamp is:  1.44
for frame : 37   timestamp is:  1.48
for frame : 38   timestamp is:  1.52
for frame : 39   timestamp is:  1.56
for frame : 40   timestamp is:  1.6
for frame : 41   timestamp is:  1.6400000000000001
for frame : 42   timestamp is:  1.68
for frame : 43   timestamp is:  1.72
for frame : 44   timestamp is:  1.76
for frame : 45   timestamp is:  1.8
for frame : 46   timestamp is:  1.84
for frame : 47   timestamp is:  1.8800000000000003
for frame : 48   timestamp is:  1.92
for frame : 49   timestamp is:  1.96
for frame : 50   timestamp is:  2.0
for frame : 51   timestamp is:  2.04
for frame : 52   timestamp is:  2.08
for frame : 53   timestamp is:  2.12
for frame : 54   timestamp is:  2.16
for frame : 55   timestamp is:  2.2
for frame : 56   timestamp is:  2.24
for frame : 57   timestamp is:  2.2800000000000002
for frame : 58   timestamp is:  2.32
for frame : 59   timestamp is:  2.36
for frame : 60   timestamp is:  2.4
for frame : 61   timestamp is:  2.44
for frame : 62   timestamp is:  2.48
for frame : 63   timestamp is:  2.52
for frame : 64   timestamp is:  2.56
for frame : 65   timestamp is:  2.6
for frame : 66   timestamp is:  2.64
for frame : 67   timestamp is:  2.68
for frame : 68   timestamp is:  2.72
for frame : 69   timestamp is:  2.7600000000000007
for frame : 70   timestamp is:  2.8000000000000003
for frame : 71   timestamp is:  2.84
for frame : 72   timestamp is:  2.88
for frame : 73   timestamp is:  2.92
for frame : 74   timestamp is:  2.96
for frame : 75   timestamp is:  3.0
for frame : 76   timestamp is:  3.04
for frame : 77   timestamp is:  3.08
for frame : 78   timestamp is:  3.12
for frame : 79   timestamp is:  3.16
for frame : 80   timestamp is:  3.2
for frame : 81   timestamp is:  3.24
for frame : 82   timestamp is:  3.2800000000000002
for frame : 83   timestamp is:  3.3200000000000003
for frame : 84   timestamp is:  3.36
for frame : 85   timestamp is:  3.4
for frame : 86   timestamp is:  3.44
for frame : 87   timestamp is:  3.48
for frame : 88   timestamp is:  3.52
for frame : 89   timestamp is:  3.56
for frame : 90   timestamp is:  3.6
for frame : 91   timestamp is:  3.64
for frame : 92   timestamp is:  3.68
for frame : 93   timestamp is:  3.72
for frame : 94   timestamp is:  3.7600000000000007
for frame : 95   timestamp is:  3.8000000000000003
for frame : 96   timestamp is:  3.84
for frame : 97   timestamp is:  3.88
for frame : 98   timestamp is:  3.92
for frame : 99   timestamp is:  3.96
for frame : 100   timestamp is:  4.0
for frame : 101   timestamp is:  4.04
for frame : 102   timestamp is:  4.08
for frame : 103   timestamp is:  4.12
for frame : 104   timestamp is:  4.16
for frame : 105   timestamp is:  4.2
for frame : 106   timestamp is:  4.24
for frame : 107   timestamp is:  4.28
for frame : 108   timestamp is:  4.32
for frame : 109   timestamp is:  4.36
for frame : 110   timestamp is:  4.4
for frame : 111   timestamp is:  4.44
for frame : 112   timestamp is:  4.48
for frame : 113   timestamp is:  4.520000000000001
for frame : 114   timestamp is:  4.5600000000000005
for frame : 115   timestamp is:  4.6000000000000005
for frame : 116   timestamp is:  4.64
for frame : 117   timestamp is:  4.68
for frame : 118   timestamp is:  4.72
for frame : 119   timestamp is:  4.76
for frame : 120   timestamp is:  4.8
for frame : 121   timestamp is:  4.84
for frame : 122   timestamp is:  4.88
for frame : 123   timestamp is:  4.92
for frame : 124   timestamp is:  4.96
for frame : 125   timestamp is:  5.0
for frame : 126   timestamp is:  5.04
for frame : 127   timestamp is:  5.08
for frame : 128   timestamp is:  5.12
for frame : 129   timestamp is:  5.16
for frame : 130   timestamp is:  5.2
for frame : 131   timestamp is:  5.24
for frame : 132   timestamp is:  5.28
for frame : 133   timestamp is:  5.32
for frame : 134   timestamp is:  5.36
for frame : 135   timestamp is:  5.4
for frame : 136   timestamp is:  5.44
for frame : 137   timestamp is:  5.48
for frame : 138   timestamp is:  5.520000000000001
for frame : 139   timestamp is:  5.5600000000000005
for frame : 140   timestamp is:  5.6000000000000005
for frame : 141   timestamp is:  5.64
for frame : 142   timestamp is:  5.68
for frame : 143   timestamp is:  5.72
for frame : 144   timestamp is:  5.76
for frame : 145   timestamp is:  5.8
for frame : 146   timestamp is:  5.84
for frame : 147   timestamp is:  5.88
for frame : 148   timestamp is:  5.92
for frame : 149   timestamp is:  5.96
for frame : 150   timestamp is:  6.0
for frame : 151   timestamp is:  6.04
for frame : 152   timestamp is:  6.08
for frame : 153   timestamp is:  6.12
for frame : 154   timestamp is:  6.16
for frame : 155   timestamp is:  6.2
for frame : 156   timestamp is:  6.24
for frame : 157   timestamp is:  6.28
for frame : 158   timestamp is:  6.32
for frame : 159   timestamp is:  6.36
for frame : 160   timestamp is:  6.4
for frame : 161   timestamp is:  6.44
for frame : 162   timestamp is:  6.48
for frame : 163   timestamp is:  6.520000000000001
for frame : 164   timestamp is:  6.5600000000000005
for frame : 165   timestamp is:  6.6000000000000005
for frame : 166   timestamp is:  6.640000000000001
for frame : 167   timestamp is:  6.68
for frame : 168   timestamp is:  6.72
for frame : 169   timestamp is:  6.76
for frame : 170   timestamp is:  6.8
for frame : 171   timestamp is:  6.84
for frame : 172   timestamp is:  6.88
for frame : 173   timestamp is:  6.92
for frame : 174   timestamp is:  6.96
for frame : 175   timestamp is:  7.0
for frame : 176   timestamp is:  7.04
for frame : 177   timestamp is:  7.08
for frame : 178   timestamp is:  7.12
for frame : 179   timestamp is:  7.16
for frame : 180   timestamp is:  7.2
for frame : 181   timestamp is:  7.24
for frame : 182   timestamp is:  7.28
for frame : 183   timestamp is:  7.32
for frame : 184   timestamp is:  7.36
for frame : 185   timestamp is:  7.4
for frame : 186   timestamp is:  7.44
for frame : 187   timestamp is:  7.48
for frame : 188   timestamp is:  7.520000000000001
for frame : 189   timestamp is:  7.5600000000000005
for frame : 190   timestamp is:  7.6000000000000005
for frame : 191   timestamp is:  7.640000000000001
for frame : 192   timestamp is:  7.68
for frame : 193   timestamp is:  7.72
for frame : 194   timestamp is:  7.76
for frame : 195   timestamp is:  7.8
for frame : 196   timestamp is:  7.84
for frame : 197   timestamp is:  7.88
for frame : 198   timestamp is:  7.92
for frame : 199   timestamp is:  7.96
for frame : 200   timestamp is:  8.0
for frame : 201   timestamp is:  8.040000000000001
for frame : 202   timestamp is:  8.08
for frame : 203   timestamp is:  8.120000000000001
for frame : 204   timestamp is:  8.16
for frame : 205   timestamp is:  8.2
for frame : 206   timestamp is:  8.24
for frame : 207   timestamp is:  8.28
for frame : 208   timestamp is:  8.32
for frame : 209   timestamp is:  8.36
for frame : 210   timestamp is:  8.4
for frame : 211   timestamp is:  8.44
for frame : 212   timestamp is:  8.48
for frame : 213   timestamp is:  8.52
for frame : 214   timestamp is:  8.56
for frame : 215   timestamp is:  8.6
for frame : 216   timestamp is:  8.64
for frame : 217   timestamp is:  8.68
for frame : 218   timestamp is:  8.72
for frame : 219   timestamp is:  8.76
for frame : 220   timestamp is:  8.8
for frame : 221   timestamp is:  8.84
for frame : 222   timestamp is:  8.88
for frame : 223   timestamp is:  8.92
for frame : 224   timestamp is:  8.96
for frame : 225   timestamp is:  9.0
for frame : 226   timestamp is:  9.040000000000003
for frame : 227   timestamp is:  9.08
for frame : 228   timestamp is:  9.120000000000001
for frame : 229   timestamp is:  9.16
for frame : 230   timestamp is:  9.200000000000001
for frame : 231   timestamp is:  9.24
for frame : 232   timestamp is:  9.28
for frame : 233   timestamp is:  9.32
for frame : 234   timestamp is:  9.36
for frame : 235   timestamp is:  9.4
for frame : 236   timestamp is:  9.44
for frame : 237   timestamp is:  9.48
for frame : 238   timestamp is:  9.52
for frame : 239   timestamp is:  9.56
for frame : 240   timestamp is:  9.6
for frame : 241   timestamp is:  9.64
for frame : 242   timestamp is:  9.68
for frame : 243   timestamp is:  9.72
for frame : 244   timestamp is:  9.76
for frame : 245   timestamp is:  9.8
for frame : 246   timestamp is:  9.84
for frame : 247   timestamp is:  9.88
for frame : 248   timestamp is:  9.92
for frame : 249   timestamp is:  9.96
for frame : 250   timestamp is:  10.0
for frame : 251   timestamp is:  10.040000000000003
for frame : 252   timestamp is:  10.08
for frame : 253   timestamp is:  10.120000000000001
for frame : 254   timestamp is:  10.16
for frame : 255   timestamp is:  10.200000000000001
for frame : 256   timestamp is:  10.24
for frame : 257   timestamp is:  10.28
for frame : 258   timestamp is:  10.32
for frame : 259   timestamp is:  10.36
for frame : 260   timestamp is:  10.4
for frame : 261   timestamp is:  10.44
for frame : 262   timestamp is:  10.48
for frame : 263   timestamp is:  10.52
for frame : 264   timestamp is:  10.56
for frame : 265   timestamp is:  10.6
for frame : 266   timestamp is:  10.64
for frame : 267   timestamp is:  10.68
for frame : 268   timestamp is:  10.72
for frame : 269   timestamp is:  10.76
for frame : 270   timestamp is:  10.8
for frame : 271   timestamp is:  10.84
for frame : 272   timestamp is:  0.0
for frame : 273   timestamp is:  0.0
for frame : 274   timestamp is:  0.0
for frame : 275   timestamp is:  0.0

However this leads to more questions at the time the video ends the time is 11 seconds but in this case for frame 275 timestamp is 0 ,why is that.

Secondly I can round these timestamps to get the result I want,but I feel that rounding is not the solution to the problem

Also I was looking for an answer that will help me use the flags mentioned in the above post.

miscalculations inside of OpenCV or ffmpeg. that code is not well maintained. it assumes that “a frame rate” exists and is correct (often it’s not), and ignores the reality of Presentation Timestamps (PTS). frames could be spaced nearly arbitrarily, and sometimes they are.

assuming your file is 25 fps and generally well-behaved, you can use the frame numbers instead. that’ll be equal to what was calculated there (OpenCV does the same), but doesn’t evaluate to0.0 in the end. I have no idea why that happens.

if you want whole seconds, you’ll need to round in some way. I don’t know why you have an issue with fractions of seconds.

what about those flags? they’re flags for accessing (setting/getting) properties.

I’d recommend against using AVI_RATIO because that indicates outdated technology and is probably maintained even worse than everything else.

Ok thanks .Is there a way to know if a video is well behaved or not.(for eg,if all frames are spaced equally is that a way of saying it’s well behaved)
also,if possible can you please recommend me some other sources that will give me a better understanding of basic video processing in opencv (looking for something other than opencv docs)