Dashcam video script

  • Our merch store is back! Check out our line of quality apparel and accessories featuring the TOO logo. Let us know if you'd like something specific you don't see 👍https://teespring.com/stores/tesla-owners-online-store
  • It's OK to discuss software issues here but please report bugs to Tesla directly at servicehelpna@teslamotors.com if you want things fixed.

japhule

Active Member
Joined
Apr 14, 2018
Messages
45
Location
Dallas, TX
Country
Country
New release available: Release v0.1.10

Following are the updates:

Fixed:
- Issue where sometimes encoding with GPU would fail by also allowing software based encoding
- Traceback when unable to retrieve latest release from GitHub
- Running tesla_dashcam when installed using pip. Issue #23 and Issue #31
- Folder clip would be removed if only 1 set in folder with same name as folder name if keep_intermediate not specified
- Font issue in Windows (hopefully final fix) Issue #29
- Python version has to be 3.7 or higher due to use of capture_output Issue #19

New:
- Added scale option to set the scale of the clips and thus resulting video. (--scale)
- Added option to specify a parameter file using @<filename> where parameters can be located in. (@<filename>)
- One can now specify multiple sources instead of just 1.
- Individual file(s) can now be provided as a source as well (only 1 camera filename has to be provided to get all 3)
- Source is now optional, if not provided then it will be same as --monitor_once with as source SavedClips.

Changed:
- Timestamp within video will now be used for concatenation of the clips at folder level and all (--merge option) instead of filename. This will ensure that even when crossing timezones the order of the video is still accurate.
- --delete_source will delete source files when specified even when --monitor or --monitor_once is not specified Issue #28
- Output will default to Videos\Tesla_Dashcam (Windows) Movies/Tesla_Dashcam (MacOS), or Videos\Tesla_Dashcam (Linux) if not output folder specified.
- Filename for the folder video files will not have start and end timestamp in local timezone instead of just folder name. Issue #30 and Issue #33
- Updated release notes for each release better identifying what is new, changed, and fixed.
The Windows application from your link appears to be v0.1.10b0 so I keep getting notifications that a newer release is available.
 

MelindaV

☰ > 3
Moderator
Joined
Apr 2, 2016
Messages
9,033
Location
Vancouver, WA
Tesla Owner
Model 3
Country
Country
@ehendrix23 - since the 5/30 release, I've been getting the alert that it is not running the latest update (after downloading and running the latest)
Code:
New release v0.1.10 is available for download (https://github.com/ehendrix23/tesla_dashcam/releases/tag/v0.1.10). You are currently on v0.1.10b0. Use --check-for-update to get latest release notes.
and a lengthly error with each video clip
Code:
    Processing 10 clips in folder /Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56 (15/27)
        Processing clip 1/10 from 06/17/19 19:12:54 and 59 seconds long.
            Error trying to create clip for /Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55. RC: 1
            Command: ['/var/folders/cd/ss342dfs6h103gqy1tv5q9280000gp/T/_MEIBvklCR/ffmpeg', '-i', '/Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55-left_repeater.mp4', '-i', '/Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55-front.mp4', '-i', '/Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55-right_repeater.mp4', '-filter_complex', "color=duration=59.8:s=1280x960:c=black [base];[0:v] setpts=PTS-STARTPTS, scale=640x480 , hflip [left];[1:v] setpts=PTS-STARTPTS, scale=640x480  [front];[2:v] setpts=PTS-STARTPTS, scale=640x480 , hflip [right];[base][left] overlay=eof_action=pass:repeatlast=0:x=0:y=480 [left1];[left1][front] overlay=eof_action=pass:repeatlast=0:x=320:y=0 [front1];[front1][right] overlay=eof_action=pass:repeatlast=0:x=640:y=480[tmp0];[tmp0] drawtext=fontfile=/Library/Fonts/Arial.ttf:fontcolor=white:fontsize=16.0:borderw=2:bordercolor=black@1.0:x=(w/2-text_w/2):y=(h-(text_h*2)):text='%{pts\\:localtime\\:1560823974\\:%x %X}'[tmp1];[tmp1]  setpts=0.2*PTS", '-preset', 'medium', '-crf', '28', '-allow_sw', '1', '-b:v', '5000K', '-c:v', 'h264_videotoolbox', '-y', '/volumes/2019-06-17_19-13-55.mp4']
            Error: b"ffmpeg version N-93225-g37e4c226c0-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers\n  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)\n  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay\n  libavutil      56. 26.100 / 56. 26.100\n  libavcodec     58. 47.102 / 58. 47.102\n  libavformat    58. 26.101 / 58. 26.101\n  libavdevice    58.  6.101 / 58.  6.101\n  libavfilter     7. 48.100 /  7. 48.100\n  libswscale      5.  4.100 /  5.  4.100\n  libswresample   3.  4.100 /  3.  4.100\n  libpostproc    55.  4.100 / 55.  4.100\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55-left_repeater.mp4':\n  Metadata:\n    major_brand     : mp42\n    minor_version   : 0\n    compatible_brands: mp42mp41isomiso2\n    creation_time   : 2019-06-18T02:12:54.000000Z\n  Duration: 00:00:59.77, start: 0.000000, bitrate: 4025 kb/s\n    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4022 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\n    Metadata:\n      creation_time   : 2019-06-18T02:12:54.000000Z\n      handler_name    : VideoHandler\nInput #1, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55-front.mp4':\n  Metadata:\n    major_brand     : mp42\n    minor_version   : 0\n    compatible_brands: mp42mp41isomiso2\n    creation_time   : 2019-06-18T02:12:54.000000Z\n  Duration: 00:00:59.80, start: 0.000000, bitrate: 4043 kb/s\n    Stream #1:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4039 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\n    Metadata:\n      creation_time   : 2019-06-18T02:12:54.000000Z\n      handler_name    : VideoHandler\nInput #2, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55-right_repeater.mp4':\n  Metadata:\n    major_brand     : mp42\n    minor_version   : 0\n    compatible_brands: mp42mp41isomiso2\n    creation_time   : 2019-06-18T02:12:54.000000Z\n  Duration: 00:00:59.77, start: 0.000000, bitrate: 4031 kb/s\n    Stream #2:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4027 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\n    Metadata:\n      creation_time   : 2019-06-18T02:12:54.000000Z\n      handler_name    : VideoHandler\nCodec AVOption preset (Configuration preset) specified for output file #0 (/volumes/2019-06-17_19-13-55.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.\nCodec AVOption crf (Select the quality for constant quality mode) specified for output file #0 (/volumes/2019-06-17_19-13-55.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.\n/volumes/2019-06-17_19-13-55.mp4: Operation not permitted\n"
are you able to see what the issue is from this? because prior to this breaking, it has totally spoiled me in looking at the Sentry clips :)
 
Joined
Jan 24, 2019
Messages
1
Location
Lewes, DE
Tesla Owner
Model 3
Country
Country
I have been trying out your script and think it's FANTASTIC. So far my favorite "view" is --quality HIGH --layout WIDESCREEN --rear.

I have found that if I edit my commands in a textfile, then copy and paste them onto the CMD line, it's a whole lot easier to manage. I am not the first to figure THAT out I guess (!)

I have a request: Is it possible to set a parameter for a full-res (4k) version of the video? This would allow the three images to stay at their native resolution and will maintain all the detail. Each video is 1280 wide by 960 high - all three in a widescreen mode would be 3840 wide - exactly a 4k video width. I don't know how this will impact the rendering time... The video is bigger but the elements don't need to be resized. In my example the side screens still need to be flipped though.
 

ehendrix23

Active Member
TOO Supporting Member
Joined
Jan 30, 2019
Messages
112
Location
Colorado
Tesla Owner
Model 3
Country
Country
I have been trying out your script and think it's FANTASTIC. So far my favorite "view" is --quality HIGH --layout WIDESCREEN --rear.

I have found that if I edit my commands in a textfile, then copy and paste them onto the CMD line, it's a whole lot easier to manage. I am not the first to figure THAT out I guess (!)

I have a request: Is it possible to set a parameter for a full-res (4k) version of the video? This would allow the three images to stay at their native resolution and will maintain all the detail. Each video is 1280 wide by 960 high - all three in a widescreen mode would be 3840 wide - exactly a 4k video width. I don't know how this will impact the rendering time... The video is bigger but the elements don't need to be resized. In my example the side screens still need to be flipped though.
See the --scale option which I if I understand your request should do exactly what you ask. :)
 

ehendrix23

Active Member
TOO Supporting Member
Joined
Jan 30, 2019
Messages
112
Location
Colorado
Tesla Owner
Model 3
Country
Country
@ehendrix23 - since the 5/30 release, I've been getting the alert that it is not running the latest update (after downloading and running the latest)
Code:
New release v0.1.10 is available for download (https://github.com/ehendrix23/tesla_dashcam/releases/tag/v0.1.10). You are currently on v0.1.10b0. Use --check-for-update to get latest release notes.
and a lengthly error with each video clip
Code:
    Processing 10 clips in folder /Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56 (15/27)
        Processing clip 1/10 from 06/17/19 19:12:54 and 59 seconds long.
            Error trying to create clip for /Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55. RC: 1
            Command: ['/var/folders/cd/ss342dfs6h103gqy1tv5q9280000gp/T/_MEIBvklCR/ffmpeg', '-i', '/Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55-left_repeater.mp4', '-i', '/Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55-front.mp4', '-i', '/Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55-right_repeater.mp4', '-filter_complex', "color=duration=59.8:s=1280x960:c=black [base];[0:v] setpts=PTS-STARTPTS, scale=640x480 , hflip [left];[1:v] setpts=PTS-STARTPTS, scale=640x480  [front];[2:v] setpts=PTS-STARTPTS, scale=640x480 , hflip [right];[base][left] overlay=eof_action=pass:repeatlast=0:x=0:y=480 [left1];[left1][front] overlay=eof_action=pass:repeatlast=0:x=320:y=0 [front1];[front1][right] overlay=eof_action=pass:repeatlast=0:x=640:y=480[tmp0];[tmp0] drawtext=fontfile=/Library/Fonts/Arial.ttf:fontcolor=white:fontsize=16.0:borderw=2:bordercolor=black@1.0:x=(w/2-text_w/2):y=(h-(text_h*2)):text='%{pts\\:localtime\\:1560823974\\:%x %X}'[tmp1];[tmp1]  setpts=0.2*PTS", '-preset', 'medium', '-crf', '28', '-allow_sw', '1', '-b:v', '5000K', '-c:v', 'h264_videotoolbox', '-y', '/volumes/2019-06-17_19-13-55.mp4']
            Error: b"ffmpeg version N-93225-g37e4c226c0-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers\n  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)\n  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay\n  libavutil      56. 26.100 / 56. 26.100\n  libavcodec     58. 47.102 / 58. 47.102\n  libavformat    58. 26.101 / 58. 26.101\n  libavdevice    58.  6.101 / 58.  6.101\n  libavfilter     7. 48.100 /  7. 48.100\n  libswscale      5.  4.100 /  5.  4.100\n  libswresample   3.  4.100 /  3.  4.100\n  libpostproc    55.  4.100 / 55.  4.100\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55-left_repeater.mp4':\n  Metadata:\n    major_brand     : mp42\n    minor_version   : 0\n    compatible_brands: mp42mp41isomiso2\n    creation_time   : 2019-06-18T02:12:54.000000Z\n  Duration: 00:00:59.77, start: 0.000000, bitrate: 4025 kb/s\n    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4022 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\n    Metadata:\n      creation_time   : 2019-06-18T02:12:54.000000Z\n      handler_name    : VideoHandler\nInput #1, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55-front.mp4':\n  Metadata:\n    major_brand     : mp42\n    minor_version   : 0\n    compatible_brands: mp42mp41isomiso2\n    creation_time   : 2019-06-18T02:12:54.000000Z\n  Duration: 00:00:59.80, start: 0.000000, bitrate: 4043 kb/s\n    Stream #1:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4039 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\n    Metadata:\n      creation_time   : 2019-06-18T02:12:54.000000Z\n      handler_name    : VideoHandler\nInput #2, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/TESLACAM/TeslaCam/SavedClips/2019-06-17_19-22-56/2019-06-17_19-13-55-right_repeater.mp4':\n  Metadata:\n    major_brand     : mp42\n    minor_version   : 0\n    compatible_brands: mp42mp41isomiso2\n    creation_time   : 2019-06-18T02:12:54.000000Z\n  Duration: 00:00:59.77, start: 0.000000, bitrate: 4031 kb/s\n    Stream #2:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4027 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\n    Metadata:\n      creation_time   : 2019-06-18T02:12:54.000000Z\n      handler_name    : VideoHandler\nCodec AVOption preset (Configuration preset) specified for output file #0 (/volumes/2019-06-17_19-13-55.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.\nCodec AVOption crf (Select the quality for constant quality mode) specified for output file #0 (/volumes/2019-06-17_19-13-55.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.\n/volumes/2019-06-17_19-13-55.mp4: Operation not permitted\n"
are you able to see what the issue is from this? because prior to this breaking, it has totally spoiled me in looking at the Sentry clips :)
Can you provide me the complete command you use? From what I can see it is trying to put the resulting video clip in folder /volumes. Do you indeed have a folder /volumes? I might be wrong but right now my 1st impression is that you might have provided the wrong --output value?
Check that and if not provide me the parameters you use so that hopefully I can replicate the issue. :)
 

MelindaV

☰ > 3
Moderator
Joined
Apr 2, 2016
Messages
9,033
Location
Vancouver, WA
Tesla Owner
Model 3
Country
Country
Can you provide me the complete command you use? From what I can see it is trying to put the resulting video clip in folder /volumes. Do you indeed have a folder /volumes? I might be wrong but right now my 1st impression is that you might have provided the wrong --output value?
Check that and if not provide me the parameters you use so that hopefully I can replicate the issue. :)
I have a couple different ones, but this is the one I use most, and yes, have an 'etc' volume.
/Applications/tesla_dashcam --monitor_once --speedup 2 --output /volumes/etc SavedClips

I was using this before the problem started showing up though too
 

ehendrix23

Active Member
TOO Supporting Member
Joined
Jan 30, 2019
Messages
112
Location
Colorado
Tesla Owner
Model 3
Country
Country
I have a couple different ones, but this is the one I use most, and yes, have an 'etc' volume.
/Applications/tesla_dashcam --monitor_once --speedup 2 --output /volumes/etc SavedClips

I was using this before the problem started showing up though too
K, I believe I found the issue.

Will be releasing 0.1.11 shortly (should be this weekend) just with a few fixes in it as 0.1.10 was not as clean as I had hoped. Had tried to push it before going on vacation as it contained some other fixes for people but resulting clearly having done it a bit too fast.
 

James M

Active Member
Joined
May 31, 2018
Messages
29
Location
Seattle
Country
Country
Love the merge feature, thank you! Dumb question: Is there a way to add a datetime stamp to the output filename (either the earliest/latest from the merged video, or simply the current datetime). Right now it appears the merged video filename will be named the same as the folder it is saved in unless the name is explicitly defined in the command.