new FPS calculation approach is buggy.
https://github.com/taneljairus/random-mapillary-stuff/blob/53896f8bfe8d3c93f584a050d6b10bb94fb1dca6/ts_processor.py#L562
In MP4 Novatek files you could expect 1-2 additional GPS location packets which are carried over between the files.
So it's typical to have 61 or 181 gps packets ('freeGPS') for 60 or 180 sec video
As a result, fps is calculated incorrectly and image sampling gets broken.
For 180 sec video with 1 sec sampling interval you will get 187 frames
20210426103432_001156.MP4
Novatek MP4 T
FPS : 30.0; LEN: 5400
GPS data analysis ended, no of points 181
Frames per point: 29.834254143646408
Video extraction started
20210426103432_001156.MP4 processed, 187 images extracted
Novatek MP4 detection not working https://github.com/taneljairus/random-mapillary-stuff/blob/53896f8bfe8d3c93f584a050d6b10bb94fb1dca6/ts_processor.py#L259 this will not work with MP4 novatek (gps box is not detected, as it is a subatom under moov) Quick workaround: change "gps" to "moov"
if box.type.decode("utf-8") == "moov": #has Novatek-specific stuff
new FPS calculation approach is buggy. https://github.com/taneljairus/random-mapillary-stuff/blob/53896f8bfe8d3c93f584a050d6b10bb94fb1dca6/ts_processor.py#L562 In MP4 Novatek files you could expect 1-2 additional GPS location packets which are carried over between the files. So it's typical to have 61 or 181 gps packets ('freeGPS') for 60 or 180 sec video As a result, fps is calculated incorrectly and image sampling gets broken. For 180 sec video with 1 sec sampling interval you will get 187 frames
How to reproduce: Sample video: https://drive.google.com/file/d/14AXSVYlToIxUmoGPPmq-lGHsb2S8PWTH/view?usp=sharing Script parameters:
ts_processor.py --input 20210426103432_001156.MP4 --sampling_interval 1
Output:
So, at first FPS is detected properly by cv2 https://github.com/taneljairus/random-mapillary-stuff/blob/53896f8bfe8d3c93f584a050d6b10bb94fb1dca6/ts_processor.py#L541 but later it get's overwritten by https://github.com/taneljairus/random-mapillary-stuff/blob/53896f8bfe8d3c93f584a050d6b10bb94fb1dca6/ts_processor.py#L562 and while packetno=181 (contains one extra gps packet), resulting FPS is not correct and this breaks the sampling Frames per point: 29.834254143646408 Extra images are produced (not @ 1fps interval defined) and coordinates are assigned incorrectly. Similar issue will occur if some of there will be a temp gpsfix loss. (i.e. in the tunnel) Packet will not be captured and counted and fps calculation will be completely erroneous
IMO, original approach works excellent (fps extracted by cv2) and there is no need to redefine it. Quick workaround: delete or comment lines 559-561