Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mapillary_tools/sample_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def sample_video(
video_list = utils.find_videos(
[video_import_path], skip_subfolders=skip_subfolders
)
video_dir = video_import_path
video_dir = video_import_path.resolve()
LOG.debug(f"Found %d videos in %s", len(video_list), video_dir)
elif video_import_path.is_file():
video_list = [video_import_path]
Expand All @@ -36,6 +36,7 @@ def sample_video(
raise exceptions.MapillaryFileNotFoundError(
f"Video file or directory not found: {video_import_path}"
)
assert video_dir.is_absolute(), f"video_dir must be absolute here: {str(video_dir)}"

video_start_time_dt: T.Optional[datetime.datetime] = None
if video_start_time is not None:
Expand Down
29 changes: 27 additions & 2 deletions tests/integration/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import os
import subprocess
import tempfile
import zipfile
from pathlib import Path

Expand Down Expand Up @@ -647,6 +648,30 @@ def ffmpeg_installed():
is_ffmpeg_installed = ffmpeg_installed()


def test_sample_video_relpath():
if not is_ffmpeg_installed:
pytest.skip("skip because ffmpeg not installed")

with tempfile.TemporaryDirectory() as dir:
x = subprocess.run(
f"{EXECUTABLE} sample_video --rerun tests/integration/mapillary_tools_process_images_provider/gopro_data/hero8.mp4 {dir}",
shell=True,
)
assert x.returncode == 0, x.stderr


def test_sample_video_relpath_dir():
if not is_ffmpeg_installed:
pytest.skip("skip because ffmpeg not installed")

with tempfile.TemporaryDirectory() as dir:
x = subprocess.run(
f"{EXECUTABLE} sample_video --rerun --video_start_time 2021_10_10_10_10_10_123 tests/integration {dir}",
shell=True,
)
assert x.returncode == 0, x.stderr


def test_sample_video(setup_data: py.path.local):
if not is_ffmpeg_installed:
pytest.skip("skip because ffmpeg not installed")
Expand Down Expand Up @@ -699,10 +724,10 @@ def test_video_process(setup_data: py.path.local):
with gpx_file.open("w") as fp:
fp.write(GPX_CONTENT)
x = subprocess.run(
f"{EXECUTABLE} video_process {PROCESS_FLAGS} --video_start_time 2018_06_08_13_23_34_123 --geotag_source gpx --geotag_source_path {gpx_file} {setup_data} {setup_data.join('my_samples')}",
f"{EXECUTABLE} video_process {PROCESS_FLAGS} --skip_process_errors --video_start_time 2018_06_08_13_23_34_123 --geotag_source gpx --geotag_source_path {gpx_file} {setup_data} {setup_data.join('my_samples')}",
shell=True,
)
assert x.returncode != 0, x.stderr
assert x.returncode == 0, x.stderr
with open(desc_path) as fp:
descs = json.load(fp)
assert 1 == len(find_desc_errors(descs))
Expand Down