Skip to content

Commit f28fd09

Browse files
authored
Release 0.1.15 (#80)
* Release 0.1.13 (#72) (#73) * Temp exe * Updated temporary exe file * Delete tesla_dashcam_190b3.exe * Fix check release * Updated README with initial 0.1.10 and additional TODO Updated README with items already in progress for 0.1.10 Added items to TODO list * Fix running tesla_dashcam when installed with pip * Updated README with additional items done for next release * Initial set of updates for 0.1.10. * Timestamp sorting fix * Added Chapter Markers in To-Do list * Made behaviour for single folder same as multiple Made behaviour for single folder discovered same as multiple. * --delete_souce now also for execution without --monitor * Updated README and reorged 0.1.10 items a bit * Fix deleting foldr file if name same as clip name * Exclude ffmpeg.exe * Default output folder, change in folder filename Added default output folder Changed folder filename to <Start_Timestamp>_<End_Timestamp> Source is optional now * Set Python version to 3.7 only * Updated readme for 0.1.10 Finished updating readme * Set version to 0.1.10 * Fixed metadata issue Fixed if all 3 files of a timestamp are corrupt Ensured that video_timestamp is dateformat if timestamp was retrieved from filename instead of clip. * Fixed issue if camera file was missing Fixed an issue if a camera file was missing. Removed now unused MOVIE_LAYOUT dictionary * Release 0.1.10 * Fixed traceback issue for ffmpeg (#39) * Added option to test distribution with TestPyPi * Version change to 0.1.11 * Updated README Added 2 fixes for 0.1.11 Added option to crop videos in TODO section * Fixed output folder issues * Missing piece for PyPi Figured out missing piece allowing easy execution from PyPi. * Updated links to executables * Removed DIAGONAL as it is not implemented * Formatting update with Black Formatting update with Black * Fix for folder deletion with empty files Fix for issue #40 where folders would not be deleted if there are 0-byte or corrupt files within the folder * Fixed --output with filename issue Fixed issue #52 with --output when providing a filename * Changed concat for movie creation Changed how to concatenate the clips in create_movie resulting in massive performance improvement. * Updated README for create_movie Updated readme for create_movie performance improvement * Add chapter markers Concatenated video files now will have chapter markers. Folder level will have chapters for each clip, merged will have chapters for each folder * removed single clip exception Removed single clip exception for creating movie as we now add chapters in it as well hence need to process. * Add flags -movstart and +faststart Added flags -movstart and +faststart to movies (not clips) created * Updated README * Version change to 0.1.12 beta 0 * Further fix for output argument Further fix for output argument to determine what was provided. * Fix chapter settings when video speed is adjusted Chapter settings were not taking into consideration that clips were sped-up or slowed-down. * Fix issue 54 (win10toast notifier) Potential fix for issue 54 * Missed something * Fix traceback with invalid output path * Trigger file or folder and few fixes Option to provide a trigger file or folder for monitoring. Fix for sub-dir scanning Fix for nothing being processed if . was provided as source. * Cosmetic fixes * Added chapter offset & movie filename fix Added optional chapter offset for merged video file. Fix for moviefile when output filename is provided on monitor * Beta version 0.1.12.2 * Fix typo in new version check output (#56) * Update README * Final prep of README for 0.1.12 * Cleanup * Fixes for chapter and deletion with corruptio files Fix for chapter of 1st clip Fix for deletion of files & folders with corrupt files. * Fix oopsie * Fix if file does not have timestamp Fix if fiel does not have timestamp for issue introduced with fixing deletion of corrupt/empty files * Added durations of resulting movie to print out * Version to 0.1.12 for release * Updates from Black * Check if font file exist Check if font file (provided or default) exist and if not return error. This to prevent errors during ffmpeg execution. * Merged movie filename default to current date/time Set the default filename for merged video to current date/time instead of just the folder name * Check ffmpeg exist Check that executable ffmpeg exist and can be called before executing. * Check Python version Check to make sure Python version is minimum required * Fix merge video using relative path Fix error for merging videos when providing a relative path for --output. * New option --gpu_type New option --gpu_type to identify GPU in system (NVIDIA or Intel). * Add ability to exclude cameras New options to exclude certain cameras from the output * Option --no-faststart New option --no-faststart to not set faststart flag as it can result in issues on network shares * --start_timestamp, --end_timestamp, --start_offset, --end_offset New parameters --start_timestamp, --end_timestamp, --start_offset, --end_offset to restrict based on timestamps and do offsets. * Fixed issue with --gpu_type Fixed issue with --gpu_type * Raspberry Pi H.264 encoding support Add support for H.264 GPU encoding for Raspberry Pi. * Metadata fix for missing files Fix issue in collecting metadata when some of the camera files are missing * Ignore hidden files in folder Ignore any potential hidden files (Linux/Mac) within folder. For example hidden file created by already opening some of the video files in another program. * Update README.rst * Fix for timestamps Logic for filtering on the timestamps was incorrect * Rear camera, new layouts, temp_dir Support for rear camera in V10 New layouts CROSS and DIAMOND --perspective option to allow perspective in every layout temp_dir option Add SentryClips folder to source if none provided * solving #69 - shorten video (#70) * Commenting lines out that cause Issue #68 * Added support for `--shorten` command to resolve Issue #69 * Update Readme for --shorten Formatting updates. * Update to --motion_only and --skip_existing Update to --motion_only New skip_existing * Small change to metadata * Version 0.1.13 Version 0.1.13 * Provide more clarity with font file and ffmpeg * Cleanup * Release 0.1.13 (#72) (#75) * Temp exe * Updated temporary exe file * Delete tesla_dashcam_190b3.exe * Fix check release * Updated README with initial 0.1.10 and additional TODO Updated README with items already in progress for 0.1.10 Added items to TODO list * Fix running tesla_dashcam when installed with pip * Updated README with additional items done for next release * Initial set of updates for 0.1.10. * Timestamp sorting fix * Added Chapter Markers in To-Do list * Made behaviour for single folder same as multiple Made behaviour for single folder discovered same as multiple. * --delete_souce now also for execution without --monitor * Updated README and reorged 0.1.10 items a bit * Fix deleting foldr file if name same as clip name * Exclude ffmpeg.exe * Default output folder, change in folder filename Added default output folder Changed folder filename to <Start_Timestamp>_<End_Timestamp> Source is optional now * Set Python version to 3.7 only * Updated readme for 0.1.10 Finished updating readme * Set version to 0.1.10 * Fixed metadata issue Fixed if all 3 files of a timestamp are corrupt Ensured that video_timestamp is dateformat if timestamp was retrieved from filename instead of clip. * Fixed issue if camera file was missing Fixed an issue if a camera file was missing. Removed now unused MOVIE_LAYOUT dictionary * Release 0.1.10 * Fixed traceback issue for ffmpeg (#39) * Added option to test distribution with TestPyPi * Version change to 0.1.11 * Updated README Added 2 fixes for 0.1.11 Added option to crop videos in TODO section * Fixed output folder issues * Missing piece for PyPi Figured out missing piece allowing easy execution from PyPi. * Updated links to executables * Removed DIAGONAL as it is not implemented * Formatting update with Black Formatting update with Black * Fix for folder deletion with empty files Fix for issue #40 where folders would not be deleted if there are 0-byte or corrupt files within the folder * Fixed --output with filename issue Fixed issue #52 with --output when providing a filename * Changed concat for movie creation Changed how to concatenate the clips in create_movie resulting in massive performance improvement. * Updated README for create_movie Updated readme for create_movie performance improvement * Add chapter markers Concatenated video files now will have chapter markers. Folder level will have chapters for each clip, merged will have chapters for each folder * removed single clip exception Removed single clip exception for creating movie as we now add chapters in it as well hence need to process. * Add flags -movstart and +faststart Added flags -movstart and +faststart to movies (not clips) created * Updated README * Version change to 0.1.12 beta 0 * Further fix for output argument Further fix for output argument to determine what was provided. * Fix chapter settings when video speed is adjusted Chapter settings were not taking into consideration that clips were sped-up or slowed-down. * Fix issue 54 (win10toast notifier) Potential fix for issue 54 * Missed something * Fix traceback with invalid output path * Trigger file or folder and few fixes Option to provide a trigger file or folder for monitoring. Fix for sub-dir scanning Fix for nothing being processed if . was provided as source. * Cosmetic fixes * Added chapter offset & movie filename fix Added optional chapter offset for merged video file. Fix for moviefile when output filename is provided on monitor * Beta version 0.1.12.2 * Fix typo in new version check output (#56) * Update README * Final prep of README for 0.1.12 * Cleanup * Fixes for chapter and deletion with corruptio files Fix for chapter of 1st clip Fix for deletion of files & folders with corrupt files. * Fix oopsie * Fix if file does not have timestamp Fix if fiel does not have timestamp for issue introduced with fixing deletion of corrupt/empty files * Added durations of resulting movie to print out * Version to 0.1.12 for release * Updates from Black * Check if font file exist Check if font file (provided or default) exist and if not return error. This to prevent errors during ffmpeg execution. * Merged movie filename default to current date/time Set the default filename for merged video to current date/time instead of just the folder name * Check ffmpeg exist Check that executable ffmpeg exist and can be called before executing. * Check Python version Check to make sure Python version is minimum required * Fix merge video using relative path Fix error for merging videos when providing a relative path for --output. * New option --gpu_type New option --gpu_type to identify GPU in system (NVIDIA or Intel). * Add ability to exclude cameras New options to exclude certain cameras from the output * Option --no-faststart New option --no-faststart to not set faststart flag as it can result in issues on network shares * --start_timestamp, --end_timestamp, --start_offset, --end_offset New parameters --start_timestamp, --end_timestamp, --start_offset, --end_offset to restrict based on timestamps and do offsets. * Fixed issue with --gpu_type Fixed issue with --gpu_type * Raspberry Pi H.264 encoding support Add support for H.264 GPU encoding for Raspberry Pi. * Metadata fix for missing files Fix issue in collecting metadata when some of the camera files are missing * Ignore hidden files in folder Ignore any potential hidden files (Linux/Mac) within folder. For example hidden file created by already opening some of the video files in another program. * Update README.rst * Fix for timestamps Logic for filtering on the timestamps was incorrect * Rear camera, new layouts, temp_dir Support for rear camera in V10 New layouts CROSS and DIAMOND --perspective option to allow perspective in every layout temp_dir option Add SentryClips folder to source if none provided * solving #69 - shorten video (#70) * Commenting lines out that cause Issue #68 * Added support for `--shorten` command to resolve Issue #69 * Update Readme for --shorten Formatting updates. * Update to --motion_only and --skip_existing Update to --motion_only New skip_existing * Small change to metadata * Version 0.1.13 Version 0.1.13 * Updates for fixing if font file exist * rear cam filename fix (#76) * Fix missing python-dateutil with PIP install * Fix missing fonts in Docker image (#79) * Add tzdata package to allow for specifying the timezone used for the timestamps * Add fonts-freefont-ttf package so the required font is available for the timestamps * Set version to 0.1.15 * Fix for multiple source with MONITOR or MONITOR_ONCE * Reduce motion sensitivity
1 parent bca1cf0 commit f28fd09

File tree

5 files changed

+61
-48
lines changed

5 files changed

+61
-48
lines changed

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
FROM python:3
22

33
ARG DEBIAN_FRONTEND=noninteractive
4-
RUN apt-get update && apt-get install -y ffmpeg && apt-get autoremove && apt-get clean
4+
RUN apt-get update && apt-get install -y ffmpeg tzdata fonts-freefont-ttf && apt-get autoremove && apt-get clean
55

66

77
WORKDIR /usr/src/app/tesla_dashcam
88
ADD . .
99
RUN pip install -r requirements.txt
1010
ENV PYTHONUNBUFFERED=true
1111

12-
ENTRYPOINT [ "python", "tesla_dashcam/tesla_dashcam.py" ]
12+
ENTRYPOINT [ "python", "tesla_dashcam/tesla_dashcam.py" ]

README.rst

+8-1
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ Release Notes
848848
- New: Support for hardware encoding on Raspberry Pi (RPi) (H.264 only) `Issue #66 <https://github.com/ehendrix23/tesla_dashcam/issues/66>`_
849849
- New: Layout CROSS with front camera top centered, side camera underneath it, and rear camera then underneath side cameras centered.
850850
- New: Layout DIAMOND with front camera top centered, rear camera under front and side camera centered at the left and right of front&rear.
851-
- New: Option --motion_only to fast-forward through the portions in the video that does not have anything motion (done through removal of duplicate frames).
851+
- New: Option --motion_only to fast-forward through the portions in the video that does not have anything motion (done through removal of duplicate frames). Thanks to supRy for providing this
852852
- New: Option --skip_existing to skip creation of video files that already exist. Existence only is checked, not if layout etc are the same.
853853
- New: Option --perspective for showing side cameras to be displayed in perspective mode irrespective of layout. Layout PERSPECTIVE is thus same as layout FULLSCREEN with --perspective option.
854854
- New: Options --start_offset and --end_offset can be used to provide starting and ending offset in seconds for resulting video (at folder level).
@@ -869,6 +869,13 @@ Release Notes
869869
- Fixed: Hidden files (files starting with period) on Mac/Linux were not ignored. This could cause issues as some programs might create these files when viewing the video.
870870
0.1.14:
871871
- Fixed: Checking if font path exist in Windows failed.
872+
0.1.15:
873+
- Changed: Reduced sensitivity for motion detection
874+
- Changed: Minor improvement for font path checking, mainly message provided.
875+
- Fixed: Rear view camera filename was changed from -rear_view to -back in TeslaCam folders. `Issue #78 <https://github.com/ehendrix23/tesla_dashcam/issues/78>`_
876+
- Fixed: Missing python-dateutil package when installing from PIP `Issue #77 <https://github.com/ehendrix23/tesla_dashcam/issues/77>`_
877+
- Fixed: Missing fonts in Docker Image (thanks to moorecp for providing fix)
878+
- Fixed: Only the 1st source was processed When using MONITOR or MONITOR_ONCE, or with V10 only SavedClips was processed when not providing a source
872879
873880
TODO
874881
----

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"tzlocal",
2828
"requests",
2929
"psutil",
30+
"python-dateutil",
3031
]
3132

3233
# The rest you shouldn't have to touch too much :)

tesla_dashcam/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.14"
1+
__version__ = "0.1.15"

tesla_dashcam/tesla_dashcam.py

+49-44
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# different ones to be created based on where it should go to (stdout,
3030
# log file, ...).
3131

32-
VERSION = {"major": 0, "minor": 1, "patch": 14, "beta": -1}
32+
VERSION = {"major": 0, "minor": 1, "patch": 15, "beta": -1}
3333
VERSION_STR = "v{major}.{minor}.{patch}".format(
3434
major=VERSION["major"], minor=VERSION["minor"], patch=VERSION["patch"]
3535
)
@@ -1080,7 +1080,7 @@ def get_movie_files(source_folder, exclude_subdirs, video_settings):
10801080
for filename in glob(search_path)
10811081
if not os.path.basename(filename).startswith(".")
10821082
]
1083-
print("Discovered {} files, retrieving clip data.".format(len(files)))
1083+
print(f"Discovered {len(files)} files in {pathname}")
10841084
else:
10851085
# Search all sub folder.
10861086
files = []
@@ -1095,9 +1095,7 @@ def get_movie_files(source_folder, exclude_subdirs, video_settings):
10951095
files.append(os.path.join(folder, filename))
10961096

10971097
print(
1098-
"Discovered {} folders containing total of {} files, retrieving clip data.".format(
1099-
total_folders, len(files)
1100-
)
1098+
f"Discovered {total_folders} folders containing total of {len(files)} files in {pathname}"
11011099
)
11021100
else:
11031101
files = [pathname]
@@ -1154,7 +1152,7 @@ def get_movie_files(source_folder, exclude_subdirs, video_settings):
11541152
right_filename = str(filename_timestamp) + "-right_repeater.mp4"
11551153
right_path = os.path.join(movie_folder, right_filename)
11561154

1157-
rear_filename = str(filename_timestamp) + "-rear_view.mp4"
1155+
rear_filename = str(filename_timestamp) + "-back.mp4"
11581156
rear_path = os.path.join(movie_folder, rear_filename)
11591157

11601158
# Get meta data for each video to determine creation time and duration.
@@ -1602,7 +1600,7 @@ def create_intermediate_movie(
16021600
)
16031601

16041602
ffmpeg_command = ffmpeg_command + ["-y", temp_movie_name]
1605-
# print(ffmpeg_command)
1603+
print(ffmpeg_command)
16061604
# Run the command.
16071605
try:
16081606
run(ffmpeg_command, capture_output=True, check=True)
@@ -2849,7 +2847,7 @@ def main() -> None:
28492847
if which(ffmpeg) is None:
28502848
print(
28512849
f"ffmpeg is a requirement, unable to find {ffmpeg} executable. Please ensure it exist and is located"
2852-
f"within PATH environment."
2850+
f"within PATH environment or provide full path using parameter --ffmpeg."
28532851
)
28542852

28552853
mirror_sides = ""
@@ -3014,26 +3012,21 @@ def main() -> None:
30143012
filter_string = ";[{input_clip}] {filter} [tmp{filter_counter}]"
30153013
ffmpeg_timestamp = ""
30163014
if not args.no_timestamp:
3017-
if args.font is not None and args.font != "":
3018-
temp_font_file = f"c:\{args.font}" if sys.platform == "win32" else args.font
3019-
if not os.path.isfile(temp_font_file):
3020-
print(
3021-
f"Provided font file {args.font} does exist, please provide a valid font file."
3022-
)
3023-
return
3024-
font_file = args.font
3025-
else:
3026-
font_file = DEFAULT_FONT.get(sys.platform, None)
3027-
if font_file is None:
3028-
print("Unable to get a font file. Please provide valid font file.")
3029-
return
3015+
if args.font is None:
3016+
print(
3017+
f"Unable to get a font file for platform {sys.platform}. Please provide valid font file using "
3018+
f"--font or disable timestamp using --no-timestamp."
3019+
)
3020+
return
30303021

3031-
temp_font_file = f"c:\{font_file}" if sys.platform == "win32" else font_file
3032-
if not os.path.isfile(temp_font_file):
3033-
print(
3034-
f"Seems default font file {font_file} does exist, please provide a font file."
3035-
)
3036-
return
3022+
temp_font_file = f"c:\{args.font}" if sys.platform == "win32" else args.font
3023+
if not os.path.isfile(temp_font_file):
3024+
print(
3025+
f"Font file {temp_font_file} does not exist. Provide a valid font file using --font or"
3026+
f" disable timestamp using --no-timestamp"
3027+
)
3028+
return
3029+
font_file = args.font
30373030

30383031
ffmpeg_timestamp = f"drawtext=fontfile={font_file}:"
30393032

@@ -3083,7 +3076,7 @@ def main() -> None:
30833076
if args.motion_only:
30843077
ffmpeg_motiononly = filter_string.format(
30853078
input_clip=input_clip,
3086-
filter=f"mpdecimate, setpts=N/FRAME_RATE/TB",
3079+
filter=f"mpdecimate=hi=64*48, setpts=N/FRAME_RATE/TB",
30873080
filter_counter=filter_counter,
30883081
)
30893082
input_clip = f"tmp{filter_counter}"
@@ -3271,10 +3264,14 @@ def main() -> None:
32713264

32723265
# Got a folder, append what was provided as source unless
32733266
# . was provided in which case everything is done.
3274-
if video_settings["source_folder"][0] != ".":
3275-
source_folder = os.path.join(
3276-
source_folder, video_settings["source_folder"][0]
3277-
)
3267+
source_folder_list = []
3268+
for folder in video_settings["source_folder"]:
3269+
if folder == ".":
3270+
source_folder_list.append(folder)
3271+
else:
3272+
source_folder_list.append(
3273+
os.path.join(source_folder, folder)
3274+
)
32783275

32793276
message = "TeslaCam folder found on {partition}.".format(
32803277
partition=source_partition
@@ -3299,25 +3296,33 @@ def main() -> None:
32993296
monitor_path, _ = os.path.split(monitor_file)
33003297

33013298
# If . is provided then source folder is path where monitor file exist.
3302-
if video_settings["source_folder"][0] == ".":
3303-
source_folder = monitor_path
3304-
else:
3305-
# If source path provided is absolute then use that for source path
3306-
if os.path.isabs(video_settings["source_folder"][0]):
3307-
source_folder = video_settings["source_folder"][0]
3299+
source_folder_list = []
3300+
for folder in video_settings["source_folder"]:
3301+
if folder == ".":
3302+
source_folder_list.append(monitor_path)
33083303
else:
3309-
# Path provided is relative, hence based on path of trigger file.
3310-
source_folder = os.path.join(
3311-
monitor_path, video_settings["source_folder"][0]
3312-
)
3304+
# If source path provided is absolute then use that for source path
3305+
if os.path.isabs(folder):
3306+
source_folder_list.append(folder)
3307+
else:
3308+
# Path provided is relative, hence based on path of trigger file.
3309+
source_folder_list.append(
3310+
os.path.join(monitor_path, folder)
3311+
)
33133312

33143313
print(message)
33153314
if args.system_notification:
33163315
notify("TeslaCam", "Started", message)
33173316

3318-
print("Retrieving all files from {}".format(source_folder))
3317+
if len(source_folder_list) == 1:
3318+
print(f"Retrieving all files from {source_folder_list[0]}")
3319+
else:
3320+
print(f"Retrieving all files from: ")
3321+
for folder in source_folder_list:
3322+
print(f" {folder}")
3323+
33193324
folders = get_movie_files(
3320-
[source_folder], args.exclude_subdirs, video_settings
3325+
source_folder_list, args.exclude_subdirs, video_settings
33213326
)
33223327

33233328
if video_settings["run_type"] == "MONITOR":

0 commit comments

Comments
 (0)