After Mapillary killing the very much appreciated dummy proof video uploader it now seems that uploading video with Mapillary tools is also impossible. If I go to the section “videos” and click “Video sampling and Upload” I get a 404 (page not found). What is the best way to upload when you have a video and a corresponding GPX file. Or is all this killed?
You can do it with mapillary tools and command lines.
It is not easy to figure out how to do it. but it is not hard after you figure out
Here is the help
@peewee32 This might be a more specific link
Basically the video is broken down into individual jpgs on your local computer, then georeferenced with the gpx data. The jpgs are then uploaded, not the original video, The line;
mapillary_tools video_process_and_upload --video_import_path “path/to/videos” --user_name “mapillary_user” --advanced --geotag_source “gpx” --geotag_source_path “path/to/gpx_file” --overwrite_all_EXIF_tags
is probably the easiest to use. It may however require time/start syncing.
Thanks all for the reply. I will have to dive into this. Especially syncing because video/photo timestamps always differ from my GPX recording device.I am affrad syncing will never be as intuitive as the old legacy video uploader. Still a shame it is gone. I guess it is just my frustration that they break something that works without replacing it for a better substitute.
I’ve come a bit further with the mapillary tools. I tried the sample_video.
sample_video --import_path “path/to/images” --video_import_path “path/to/videos” --video_sample_interval 0.5 --advanced
It extracts images from the MP4 file. The problem is that the time of the image is incorrect. The first image starts with 1970:01:01 00:00:00.000. The next is 0.5 seconds later and so on. The message I get is this:
Extracting video frames: 0%| | 0/1 [00:00<?, ?it/s]Video sampling path set to C:\Mapillary_tools\images\mapillary_sampled_video_frames\myvideo
could not extract duration from video C:\Mapillary_tools\video\myvideo.MP4 due to list index out of range
Warning, video start time not provided and could not be extracted from the video file, default video start time set to 0 milliseconds since UNIX epoch.
Press any key to continue . . .
So I guess my mp4 file does not meet requierements. Any idea how to solve this?
And next step will be adding location and direction but for this I will need a little time offsett. (usually a few seconds) Any Idea on this?
Video start time in epochs (milliseconds)
will help. To verify though it is probably worth probing (ffprobe) the video to ascertain exactly what date/time data is embedded in it.
This site may help to calculate the number to input. (I haven’t used, just searched)
Pointing the camera at a GPS accurate clock when starting capture is also a handy way to reference.
Thanks. Setting the VIDEO_START_TIME with EPOCH works. The problem is that I have to do this for every video. I have checked my video file for meta data using this site: https://www.metadata2go.com/
I then see several attributes showing the right time /duration such as :
Create Date , Track Duration, Creation Time. Is there any solution to convert this to Epoch and then pass it on to the sample_video script ?
NB I am on Windows
I don’t suggest you use a website to calculate for every video. All the videos would have to be uploaded to the site to check.
ffmpeg and ffprobe should be on your Windows machine as part of the tools install. I suggest that ffprobe be run manually on a test movie to see what it is doing. I don’t know if it is in the search path or not so just do a search first so you know where to run it from. (in a cmd box) It takes the video filename as an argument.
The idea here is to verify ffprobe is working properly. Also have a close look at the date/time data. I am wondering of the GPS data might be suffering from the April 2019 roll-over problem. (giving an invalid date)
I think the tools also have the capability to establish a start date/time from the filename but I have never seen it in use. That is however a lot of extra work.
ffprobe says my file has an attribute “creation_time” . This is the value: 2020-06-06T10:34:45.000000Z
My video comes from a device that does not have GPS.
I also see that next info is available
Duration: 00:01:05.10, start: 0.000000, bitrate: 60855 kb/s
Can I use FFMpeg to use this info and write something to the mp4 so that de “sample_video” can pick up the right time? Just an idea. I also do not know what the name of the meta data is that script needs.
Okay all the info seems to be there. It kind of defies logic at this point. I assume the video you tested was only an hour or two old? By default the tools work in UTC time and that can sometimes get you into trouble if it is in the future. Since that time is now past please try the sample_video command again.
The tool use the command “ffprobe -show_streams myvideo.mp4” in case you want to recheck.
Yes ffmpeg can be used to copy metadata to another file. -map_metadata is an option to check or as part of a conversion or codec copy;
ffmpeg -i input.mp4 -codec copy -metadata creation_time=‘2020-06-06 12:12:22’ output.mp4
I guess the ffprobe -show_streams output could be parsed for the creation time tag and submitted as above but that all seems counter-intuituve…
OBTW, --local_time is tools option if the date stamp is in local, not UTC
Thanks again Bob3bob3
Running the sample_video again on the same file did not change anything. I tried the -show_streams. It gave me the next info. I will hae to dive into this later o when I have time. I will also see if ffmpeg can help creating the right files in order to have these processedby the sample_video script.
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
XiaoYi AVC ame=
TAG:encoder=Ambarella AVC encoder
codec_long_name=AAC (Advanced Audio Coding)
XiaoYi AAC ame=
I started hunting around in the python code to see how it works.
I have a BlackVue and that has a date/time extraction specific to that type of video file. ie ffprobing not needed for creation time.
It seems that process_video subroutine “get_video_duration(video_file)” tries to launch ffprobe.py but I have been unable to find in that the relevant section that extracts the needed date/time. I am guessing that since it isnt there it just returns with an error. My code version is however a few months old. I also remember seeing some patch warnings about ffprobe.py but I don’t remember the details.
What I am getting at here is that an ffmpeg metadata rewrite probably wont help. I might try the tools process on one of my non BlackVue videos over the next few days.