Video upload for non Blackvue possible?

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 :wink:
Here is the help

1 Like

@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.

1 Like

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.

1 Like

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?

Perhaps;

–video_start_time VIDEO_START_TIME
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.

Thanks bob3bob3

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.

[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=Main
codec_type=video
codec_time_base=1001/60000
codec_tag_string=avc1
codec_tag=0x31637661
width=2704
height=1520
coded_width=2704
coded_height=1520
closed_captions=0
has_b_frames=2
sample_aspect_ratio=N/A
display_aspect_ratio=N/A
pix_fmt=yuvj420p
level=51
color_range=pc
color_space=bt709
color_transfer=bt709
color_primaries=bt709
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=30000/1001
avg_frame_rate=30000/1001
time_base=1/30000
start_pts=0
start_time=0.000000
duration_ts=1952951
duration=65.098367
bit_rate=60274985
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=1951
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2020-06-06T10:34:45.000000Z
TAG:language=eng
XiaoYi AVC ame=
TAG:encoder=Ambarella AVC encoder
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/48000
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=0
start_time=0.000000
duration_ts=3124224
duration=65.088000
bit_rate=128014
max_bit_rate=48000
bits_per_raw_sample=N/A
nb_frames=3051
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2020-06-06T10:34:45.000000Z
TAG:language=eng
XiaoYi AAC ame=
[/STREAM]

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.