@vitom If you want to process the files you have, it might be worth trying the --advanced
–offset_time 31622367 (or negative)
or
–video_start_time (epoch time in milliseconds)
@vitom If you want to process the files you have, it might be worth trying the --advanced
–offset_time 31622367 (or negative)
or
–video_start_time (epoch time in milliseconds)
@bob3bob3, thanks for the support, in the end I was able to get the geotagged images, even if all the timestamps were off.
I simply re-timestamped the images with the first GPS timestamp (exiftool.exe -GPSDateTime -ee video.mp4), it worked good enough.
I haven’t tried fancy stuff like extracting only key frames, but I am somewhat disappointed by the quality (especially given the price), there is a lot of motion blur, I suppose both because I was driving a bit too fast (50km/h) and because it’s just a sampled video.
The much cheaper Aukey did not seem to give worse results. Timelapse mode is not useful, as you suggest, as it is still a video with a GPS track completely out-of-sync. Let’s see what mapillary will be able to extract from them.
Really too bad it is not possible to make them just take a photo each second!
@GITNE, you removed all of your posts?
Then tools don’t directly allow keyframe extraction, only specifying a FPS rate. With ffmpeg the (linux) command is;
ffmpeg -i input.mp4 -vf “select=eq(pict_type,I)” -vsync vfr -qscale:v 2 frame_%3d.jpg
In the past I have modified the called command line in process_video.py. Look for;
command = [
'ffmpeg',
'-i', video_file,
'-loglevel', 'quiet',
and modify accordingly. Be careful of the frame rate argument though as it is used elsewhere.
I was also not very impressed by the jpg extraction. The biggest improvement was the Mapillary firmware as the bit rate didn’t drop proportionally with the frame rate, yielding a much better non-key frame. The tools frame rate argument though also often chose non-key frames from the standard 30FPS video as well.
@vitom just found a geo error in my setup.
The filename is not that accurate a start date/time. It’s variable and up to 5 seconds out.
I did however find that the gps (file) data is frame synchronous. Mine always starts with a GGA (timestamp only, no date stamp) but I used the next RMC. The file touch, jhead and gpscorrelate then worked fine. I am still tuning and think I have to drop back to the first GGA timestamp.
I use the geoencoded images for OSM editing, not uploading. Small errors are thus not so significant.
The recorded OSD time display is also out. That may be from using the modified firmware and 2FPS…
Hello @bob3bob3,
my approach, so far it seems to work fine:
I extract start video timestamp with:
exiftool.exe -GPSDateTime -ee file.mp4
And then I feed that timestamp (converted in epoch) to the --video_start_time
parameter of mapillary_tools sample video
That works even if all timestamps are off. I was not able to tag the images with correct jhead though, they all “look” in the same direction.
According to Blackvue support the meaning of such strings is:
[1612359856197]$GNRMC,124227.98,V,N*62[1612359857225]
GPS is saving in timestamp + NMEA (without transformation) format.Here, the timestamp is synchronized with the Video timestamp of the MP4 file, and the time information of the NMEA (standard) information is recorded in UTC.
my python script (it assumes you have exiftool and mapillary tools reachable):
for entry in os.listdir(blackvue_video_path):
if entry[-3:] == 'mp4' or entry[-3:] == 'MP4':
print("elaborating: " + entry)
filename = entry[:-7]
cmd = 'exiftool.exe -GPSDateTime -ee "' + blackvue_video_path + '\\' + entry + '"'
output = subprocess.check_output(cmd, shell=True)
if len(output) != 0: #we have GPSDateTime
fields = output.decode().split()
date = fields[3]
hours = fields[4]
timestamp = int(time.mktime(datetime.datetime.strptime(date+hours,"%Y:%m:%d%H:%M:%S.00Z").timetuple())*1000)
cmd = 'mapillary_tools sample_video --import_path "' + blackvue_img_path + '" --video_import_path ' \
'"' + blackvue_video_path + '\\'+ entry +'" --video_sample_interval 0.5 --advanced --video_start_time ' + str(timestamp)
os.system(cmd)
cmd = 'exiftool.exe -ee -p gpx_wpt.fmt "' + blackvue_video_path + '\\' + entry +'" > "' + blackvue_video_path + '\\'+ entry[:-4] +'.gpx"'
os.system(cmd)
cmd = 'exiftool.exe -geotag "' + blackvue_video_path + '\\' + entry[:-3] + 'gpx" "-geotime<${DateTimeOriginal}-01:00" "' + blackvue_img_path + '\\mapillary_sampled_video_frames\\' + entry[:-4] + '"'
os.system(cmd)`
Does anyone have recent videos from Blackvue’s new 900x model they’re willing to share?
I’d like to see whether we can add compatibility in Mapillary tools and whether the firmware for the 900x has changed significantly since it was released.
@eneerhut - I would happily share if you are still looking for videos!
Hey @vitom - Thank you for posting this, it is super helpful. Question though, when looking through the python there is a reference to a ‘blackvue_img_path’. Are you converting the video to images somewhere? Sorry if this is obvious, I’m new to the mapillary tools!
Hello, that was 2 full years ago but I think this part is what samples the video into images and “blackvue_img_path” is where image gets saved.
cmd = 'mapillary_tools sample_video --import_path "' + blackvue_img_path + '" --video_import_path ' \
'"' + blackvue_video_path + '\\'+ entry +'" --video_sample_interval 0.5 --advanced --video_start_time ' + str(timestamp)
os.system(cmd)