# Dashcam video script



## ehendrix23

All,

Just wanted to share that I created a Python script that combines the footage from the Tesla dash cam cameras and puts it into 1 video.

Perspective video (all 3 cameras next to each other):





Widescreen video (all 3 cameras next to each other):





Fullscreen video (front top center, left and right under front):





Further information is available in the description.

New releases (including binary for Windows and MacOS) can be found here: https://github.com/ehendrix23/tesla_dashcam/releases
Readme: https://github.com/ehendrix23/tesla_dashcam/blob/master/README.rst

Python Package can be found: https://pypi.org/project/tesla-dashcam/
Source: https://github.com/ehendrix23/tesla_dashcam

Enjoy.


----------



## Shogun

You lost my at Python. Sounds cool though.


----------



## JWardell

Awesome! Joining clips can be done easily in a video editor but combining the multiple cameras would be a lot more work. 
Would love to see this compiled into a drag and drop app of some sort.


----------



## BluestarE3

Thanks. I'll have to try this out on one of my Linux laptops since they have Python and ffmpeg already installed.


----------



## ehendrix23

JWardell said:


> Awesome! Joining clips can be done easily in a video editor but combining the multiple cameras would be a lot more work.
> Would love to see this compiled into a drag and drop app of some sort.


Relying on ffmpeg to do all the video work. Script is just taking all the files and creating the ffmpeg options. Can see to make it somewhat drag&drop in the future.


----------



## Tesla4Me!

Awesome! Thank you!!!


----------



## Achooo

JWardell said:


> Awesome! Joining clips can be done easily in a video editor but combining the multiple cameras would be a lot more work.
> Would love to see this compiled into a drag and drop app of some sort.


Yes, agree!  A drag and drop option would be amazing for us layman.


----------



## Niki-and-I

Thanks!


----------



## TheHairyOne

Read the description which stated 3 angles are stored via dash cam. But when I look in my folder Inonly see forward angle, does this change in a newer fw that I don’t yet have?


----------



## Kizzy

TheHairyOne said:


> Read the description which stated 3 angles are stored via dash cam. But when I look in my folder Inonly see forward angle, does this change in a newer fw that I don't yet have?


You need 2019.5 or later firmware (the versions with Sentry Mode) to enable the side cameras.


----------



## Artdept

This is aweso


ehendrix23 said:


> All,
> 
> Just wanted to share that I created a Python script that combines the footage from the Tesla dash cam cameras and puts it into 1 video.
> 
> Widescreen video (all 3 cameras next to each other):
> 
> 
> 
> 
> 
> Fullscreen video (front top center, left and right under front):
> 
> 
> 
> 
> 
> Further information is available in the description.
> 
> Package can be found: https://pypi.org/project/tesla-dashcam/
> Source: https://github.com/ehendrix23/tesla_dashcam
> 
> Enjoy.


This is awesome! Maybe to awesome for most of us here on this forum to comprehend. I commend your efforts.

Do you program Robots by chance?


----------



## ehendrix23

Artdept said:


> This is aweso
> 
> This is awesome! Maybe to awesome for most of us here on this forum to comprehend. I commend your efforts.
> 
> Do you program Robots by chance?


No, IT architect by trade ... developing some stuff as a hobby.


----------



## gadgetboy

ehendrix23 said:


> Just wanted to share that I created a Python script that combines the footage from the Tesla dash cam cameras and puts it into 1 video.


This is great! Thanks, @ehendrix23.



JWardell said:


> Joining clips can be done easily in a video editor but combining the multiple cameras would be a lot more work.


@JWardell While not as streamlined as the Python script, I find it's much easier to sync and display this type of multi-stream video in something like Camtasia or Screenflow. Different workflows than, say, Final Cut Pro, iMovie, etc.


----------



## lairdb

I've been working on the same thing using Powershell (and ffmpeg) and am at about the 90% 70% (revised progress mark after seeing all of @ehendrix23's nice options.)

Unfortunately, I'm still on 2018.50 so I don't really have good video with which to test.


----------



## Cwoolum

I'm gonna put together a Windows App tonight. I'll get Drag and Drop in there


----------



## Cwoolum

Cwoolum said:


> I'm gonna put together a Windows App tonight. I'll get Drag and Drop in there


QUICK UPDATE: This has actually been don'e since last monday. I'm just waiting to get through the Microsoft certification process so it can be in the app store.

Sorry @ehendrix23 for hijacking your thread. I'll move to my own once the app is live!


----------



## OakTree

Cool, @ehendrix23, I was just going to create a script to combine the footage when I bumped into your script. 
I did some experiment with ffmpeg myself and had come up with the following to combine the 2 side cameras:


Code:


 ffmpeg -i 2019-03-12_18-57-right_repeater.mp4 -vf "[in] pad=2*iw:ih [left]; movie=2019-03-12_18-57-left_repeater.mp4 [right]; [left][right] overlay=main_w/2:0 [out]" -b:v 3000k Combined.mp4

BTW, I noticed that if you put the rigth camera on the left side and the left camera on the right side, you have a complete view of the sides and the back.

Thanks


----------



## garsh

OakTree said:


> Sorry, the format got messed up on my last post. Here it is as an image.


Surround your command with CODE tags. Then the formatting won't get messed up.


Code:


like this


----------



## tsj

Nice, flipping that cameras makes it much easier to watch, too!


----------



## lairdb

Try this (Windows command line, though the ffmpeg syntax should work crossplatform):



Code:


set stem=2019-03-11_08-28

ffmpeg.exe -y -i %stem%-left_repeater.mp4 -i %stem%-front.mp4 -i %stem%-right_repeater.mp4  -filter_complex "color=size=980x250:[email protected] [base];[0:v] setpts=PTS-STARTPTS, scale=320x240, hflip [LLL];[1:v] setpts=PTS-STARTPTS, scale=320x240 [CCC];[2:v] setpts=PTS-STARTPTS, scale=320x240, hflip [RRR]; [base][LLL] overlay=shortest=1::x=5:y=5 [tmp1]; [tmp1][CCC] overlay=shortest=1:x=330:y=5 [tmp2]; [tmp2][RRR] overlay=shortest=1:x=655:y=5" -c:v libx264 -map_metadata 1 %stem%-combined.mp4
ffplay %stem%-combined.mp4 -autoexit

(Note that this does not presently copy the timestamp metadata into the combined file.) Fixed; copies metadata from the -front file.


----------



## lairdb

OK, fun with Windows Command substitution and escaping.

Assuming you have ffmpeg installed and working (test with ffplay -f lavfi -i "smptehdbars=size=320x240:d=2" -autoexit -hide_banner -loglevel quiet), the following should give you a mini panorama video of all three with embedded timestamp.

Yes, it's one giant command. (Not counting the "set".)



Code:


set _stem=2019-03-11_08-33

((@echo off&echo.&echo Processing "%_stem%" starting at %time%)&&(for /f "tokens=* USEBACKQ" %f in (`"ffprobe -v error -show_entries format_tags=creation_time -of default=noprint_wrappers=1:nk=1 "%_stem%-front.mp4""`) do (set _ts=%f)) && (for /f "tokens=* USEBACKQ" %f in (`powershell -executionpolicy unrestricted -command "&{([datetime]\"%_ts%\"-[datetime]\"1970-01-01T00:00:00\").totalseconds}"`) do (set _secs=%f)) && (call ffmpeg.exe -y -nostdin -hide_banner -loglevel warning -i "%_stem%-left_repeater.mp4" -i "%_stem%-front.mp4" -i "%_stem%-right_repeater.mp4"  -filter_complex "color=size=980x250:[email protected] [base];[0:v] setpts=PTS-STARTPTS, scale=320x240, hflip [LLL];[1:v] setpts=PTS-STARTPTS, scale=320x240 [CCC];[2:v] setpts=PTS-STARTPTS, scale=320x240, hflip [RRR]; [base][LLL] overlay=shortest=1::x=5:y=5 [tmp1]; [tmp1][CCC] overlay=shortest=1:x=330:y=5 [tmp2]; [tmp2][RRR] overlay=shortest=1:x=655:y=5 [tmp3]; [tmp3] drawtext="fontfile='c\:\\windows\\fonts\\consola.ttf':text='%{pts\:gmtime\:%^_secs%}':x=^(w-text_w^)/2:y=10:fontsize=16:[email protected]:borderw=2:[email protected]"" -c:v libx264 "%_stem%-pano.mp4") && (set _ts=&set _secs=) &&call echo Processing "%_stem%" complete at %^time%.&&echo Output is "%_stem%-pano.mp4".&&echo on&&@echo Video will autoplay in 5 seconds, or ^^C/BREAK to skip...&&timeout 5&&ffplay -autoexit -hide_banner -loglevel panic %_stem%-pano.mp4)

Sample output:


----------



## dburkland

This is awesome, thanks for sharing!


----------



## OakTree

garsh said:


> Surround your command with CODE tags. Then the formatting won't get messed up.
> 
> 
> Code:
> 
> 
> like this


Thanks, my bad, there are so many different forums that sometimes I don't know if they support BBcode or not.
I could have just edited my post, which I didn't know you could do either. 
I've just done that.


----------



## OakTree

tsj said:


> Nice, flipping that cameras makes it much easier to watch, too!


Yeah, it's amazing how they give you a complete view of the back.


----------



## lairdb

What do you all think of this? (Unflopped the repeaters and added perspective to align the image flow.)


----------



## dburkland

lairdb said:


> What do you all think of this? (Unflopped the repeaters and added perspective to align the image flow.)


Did you use the script that was posted to do that or just a ffmpeg 1-liner?


----------



## lairdb

dburkland said:


> Did you use the script that was posted to do that or just a ffmpeg 1-liner?


If it weren't for the need to pull out and convert the timestamp data, it would be a one-liner from the beginning. Here's the ffmpeg 1-liner that produces the perspective pano without the timestamp:



Code:


set stem=2019-03-13_18-00

ffmpeg.exe -y -nostdin -hide_banner -loglevel warning -i "%_stem%-left_repeater.mp4" -i "%_stem%-front.mp4" -i "%_stem%-right_repeater.mp4" -map_metadata 0:s:0 -filter_complex "color=size=980x380:[email protected] [base];[0:v] setpts=PTS-STARTPTS, scale=320x240, drawtext="fontfile='c\:\\windows\\fonts\\consola.ttf':text=^"^(artificial perspective^)^":x=^(w-text_w^)/2:y=240-text_h:fontsize=12:[email protected]:borderw=2:[email protected]", pad=iw+4:11/6*ih:-1:30:0x00000000,perspective=x0=0:y0=1*H/5:x1=W:y1=-3/44*H:x2=0:y2=6*H/5:x3=7/8*W:y3=5*H/6:sense=destination [LLL];[1:v] setpts=PTS-STARTPTS, scale=320x240 [CCC];[2:v] setpts=PTS-STARTPTS, scale=320x240, drawtext="fontfile='c\:\\windows\\fonts\\consola.ttf':text=^"^(artificial perspective^)^":x=^(w-text_w^)/2:y=240-text_h:fontsize=12:[email protected]:borderw=2:[email protected]", pad=iw+4:11/6*ih:-1:30:0x00000000,perspective=x0=0:y1=1*H/5:x1=W:y0=-3/44*H:x2=1/8*W:y3=6*H/5:x3=W:y2=5*H/6:sense=destination  [RRR]; [base][LLL] overlay=shortest=1::x=5:y=5 [tmp1]; [tmp1][CCC] overlay=shortest=1:x=330:y=5 [tmp2]; [tmp2][RRR] overlay=shortest=1:x=655:y=5, drawtext="fontfile='c\:\\windows\\fonts\\consola.ttf':text='%{pts\:gmtime\:%^_secs%}':x=^(w-text_w^)/2:y=10:fontsize=16:[email protected]:borderw=2:[email protected]"" -c:v libx264 "%_stem%-panoz.mp4"


----------



## dburkland

lairdb said:


> If it weren't for the need to pull out and convert the timestamp data, it would be a one-liner from the beginning. Here's the ffmpeg 1-liner that produces the perspective pano without the timestamp:
> 
> 
> 
> Code:
> 
> 
> set stem=2019-03-13_18-00
> 
> ffmpeg.exe -y -nostdin -hide_banner -loglevel warning -i "%_stem%-left_repeater.mp4" -i "%_stem%-front.mp4" -i "%_stem%-right_repeater.mp4" -map_metadata 0:s:0 -filter_complex "color=size=980x380:[email protected] [base];[0:v] setpts=PTS-STARTPTS, scale=320x240, drawtext="fontfile='c\:\\windows\\fonts\\consola.ttf':text=^"^(artificial perspective^)^":x=^(w-text_w^)/2:y=240-text_h:fontsize=12:[email protected]:borderw=2:[email protected]", pad=iw+4:11/6*ih:-1:30:0x00000000,perspective=x0=0:y0=1*H/5:x1=W:y1=-3/44*H:x2=0:y2=6*H/5:x3=7/8*W:y3=5*H/6:sense=destination [LLL];[1:v] setpts=PTS-STARTPTS, scale=320x240 [CCC];[2:v] setpts=PTS-STARTPTS, scale=320x240, drawtext="fontfile='c\:\\windows\\fonts\\consola.ttf':text=^"^(artificial perspective^)^":x=^(w-text_w^)/2:y=240-text_h:fontsize=12:[email protected]:borderw=2:[email protected]", pad=iw+4:11/6*ih:-1:30:0x00000000,perspective=x0=0:y1=1*H/5:x1=W:y0=-3/44*H:x2=1/8*W:y3=6*H/5:x3=W:y2=5*H/6:sense=destination  [RRR]; [base][LLL] overlay=shortest=1::x=5:y=5 [tmp1]; [tmp1][CCC] overlay=shortest=1:x=330:y=5 [tmp2]; [tmp2][RRR] overlay=shortest=1:x=655:y=5, drawtext="fontfile='c\:\\windows\\fonts\\consola.ttf':text='%{pts\:gmtime\:%^_secs%}':x=^(w-text_w^)/2:y=10:fontsize=16:[email protected]:borderw=2:[email protected]"" -c:v libx264 "%_stem%-panoz.mp4"


Thanks!


----------



## ehendrix23

lairdb said:


> If it weren't for the need to pull out and convert the timestamp data, it would be a one-liner from the beginning. Here's the ffmpeg 1-liner that produces the perspective pano without the timestamp:
> 
> 
> 
> Code:
> 
> 
> set stem=2019-03-13_18-00
> 
> ffmpeg.exe -y -nostdin -hide_banner -loglevel warning -i "%_stem%-left_repeater.mp4" -i "%_stem%-front.mp4" -i "%_stem%-right_repeater.mp4" -map_metadata 0:s:0 -filter_complex "color=size=980x380:[email protected] [base];[0:v] setpts=PTS-STARTPTS, scale=320x240, drawtext="fontfile='c\:\\windows\\fonts\\consola.ttf':text=^"^(artificial perspective^)^":x=^(w-text_w^)/2:y=240-text_h:fontsize=12:[email protected]:borderw=2:[email protected]", pad=iw+4:11/6*ih:-1:30:0x00000000,perspective=x0=0:y0=1*H/5:x1=W:y1=-3/44*H:x2=0:y2=6*H/5:x3=7/8*W:y3=5*H/6:sense=destination [LLL];[1:v] setpts=PTS-STARTPTS, scale=320x240 [CCC];[2:v] setpts=PTS-STARTPTS, scale=320x240, drawtext="fontfile='c\:\\windows\\fonts\\consola.ttf':text=^"^(artificial perspective^)^":x=^(w-text_w^)/2:y=240-text_h:fontsize=12:[email protected]:borderw=2:[email protected]", pad=iw+4:11/6*ih:-1:30:0x00000000,perspective=x0=0:y1=1*H/5:x1=W:y0=-3/44*H:x2=1/8*W:y3=6*H/5:x3=W:y2=5*H/6:sense=destination  [RRR]; [base][LLL] overlay=shortest=1::x=5:y=5 [tmp1]; [tmp1][CCC] overlay=shortest=1:x=330:y=5 [tmp2]; [tmp2][RRR] overlay=shortest=1:x=655:y=5, drawtext="fontfile='c\:\\windows\\fonts\\consola.ttf':text='%{pts\:gmtime\:%^_secs%}':x=^(w-text_w^)/2:y=10:fontsize=16:[email protected]:borderw=2:[email protected]"" -c:v libx264 "%_stem%-panoz.mp4"





lairdb said:


> What do you all think of this? (Unflopped the repeaters and added perspective to align the image flow.)


Mind if I add this as an option in my script?


----------



## lairdb

ehendrix23 said:


> Mind if I add this as an option in my script?


Feel free! CC0 in reality; CC-BY if you feel like tucking a note into your readme. With what you an @Cwoolum have been doing, I'm not going to bother finishing refining my script to be releasable, but if there's ideas to draw from -- feel free.

(Speaking of which, you might want ":borderw=2:[email protected]" or something like it on your timestamp text; it can help if the background happens to be close to the text color.)


----------



## ehendrix23

Updated script, including stand-alone binaries for Windows and MacOS now available (note, ffmpeg still needs to be downloaded and installed).

New releases (including binary for Windows and MacOS) can be found here: https://github.com/ehendrix23/tesla_dashcam/releases
Readme: https://github.com/ehendrix23/tesla_dashcam/blob/master/README.rst

This includes perspective (thanks @lairdb).


----------



## JWardell

ehendrix23 said:


> Updated script, including stand-alone binaries for Windows and MacOS now available (note, ffmpeg still needs to be downloaded and installed).
> 
> New releases (including binary for Windows and MacOS) can be found here: https://github.com/ehendrix23/tesla_dashcam/releases
> Readme: https://github.com/ehendrix23/tesla_dashcam/blob/master/README.rst
> 
> This includes perspective (thanks @lairdb).


Awesome! Thank you for the work to do this!
Now if only I could get a firmware update so I can try it out 
Can probably make an automator droplet to automate everything.


----------



## dburkland

ehendrix23 said:


> Updated script, including stand-alone binaries for Windows and MacOS now available (note, ffmpeg still needs to be downloaded and installed).
> 
> New releases (including binary for Windows and MacOS) can be found here: https://github.com/ehendrix23/tesla_dashcam/releases
> Readme: https://github.com/ehendrix23/tesla_dashcam/blob/master/README.rst
> 
> This includes perspective (thanks @lairdb).


Awesome work, I love how many smart folks are in this community


----------



## ehendrix23

OakTree said:


> Cool, @ehendrix23, I was just going to create a script to combine the footage when I bumped into your script.
> I did some experiment with ffmpeg myself and had come up with the following to combine the 2 side cameras:
> 
> 
> Code:
> 
> 
> ffmpeg -i 2019-03-12_18-57-right_repeater.mp4 -vf "[in] pad=2*iw:ih [left]; movie=2019-03-12_18-57-left_repeater.mp4 [right]; [left][right] overlay=main_w/2:0 [out]" -b:v 3000k Combined.mp4
> 
> BTW, I noticed that if you put the rigth camera on the left side and the left camera on the right side, you have a complete view of the sides and the back.
> 
> Thanks


Thanks for that ... love all the different ways to combine the cameras. 

Used this combined look with swapping left/right and then added the front at the top. I think that made most sense.
I was first thinking on making the front one wider, but that is going to stretch out the image. Similar if I reduce width for the rear one.
Personally, I think this would look a LOT better if Tesla were to include the 2 pillar cameras and the back camera. Then on top we could have combined for all 3 front pointing cameras and bottom all 3 rear ones. 
Maybe if inside one as well to show in the middle for those "oh crap" moments in the car. <g>.

Would like to get input on how this looks before I push it out as another update to the script: 



But, if I could get some input on this one before I provide it as the next "release". This will be the "COMBINED" layout option then <g> 

FYI, for those who haven't checked yet, Sentry Mode saves the clips exactly same way as dashcam does. And those clips can thus also be stitched together with the script.


----------



## ehendrix23

JWardell said:


> Awesome! Thank you for the work to do this!
> Now if only I could get a firmware update so I can try it out
> Can probably make an automator droplet to automate everything.


And on Windows you should be able to just drag&drop the folder onto the executable. Do recommend to copy the folder 1st to local harddrive as video files are then created within the same folder.


----------



## lairdb

ehendrix23 said:


> [...]
> Personally, I think this would look a LOT better if Tesla were to include the 2 pillar cameras and the back camera. Then on top we could have combined for all 3 front pointing cameras and bottom all 3 rear ones.


Nah -- if we can get them all, we stitch them together into a VR panorama.

(If your'e not already on a VR headset, once it starts playing, grab the image and drag it


----------



## MelindaV

ehendrix23 said:


> Thanks for that ... love all the different ways to combine the cameras.
> 
> Used this combined look with swapping left/right and then added the front at the top. I think that made most sense.
> I was first thinking on making the front one wider, but that is going to stretch out the image. Similar if I reduce width for the rear one.
> Personally, I think this would look a LOT better if Tesla were to include the 2 pillar cameras and the back camera. Then on top we could have combined for all 3 front pointing cameras and bottom all 3 rear ones.
> Maybe if inside one as well to show in the middle for those "oh crap" moments in the car. <g>.
> 
> Would like to get input on how this looks before I push it out as another update to the script:
> 
> 
> 
> But, if I could get some input on this one before I provide it as the next "release". This will be the "COMBINED" layout option then <g>
> 
> FYI, for those who haven't checked yet, Sentry Mode saves the clips exactly same way as dashcam does. And those clips can thus also be stitched together with the script.


i like this arrangement


----------



## Scubastevo80

Thanks for this - very cool way to pull the videos together.


----------



## Glade_EV

Yes! Your new "combined" is the one I've been waiting for,...


----------



## tsj

Yes, combined!


----------



## JML

This is a great app. Once I installed python*3*-pip it was easy to install on Linux. I have a few requests though, which I think are all very simple.

There is no default font set on Linux. It is hard to guess what all fonts people will have installed and in exactly what location, but this is working for me:


Python:


    'linux': '/usr/share/fonts/truetype/freefont/FreeSans.ttf',

I also got a bit of a speedup by using the Nvidia gpu codecs.


Python:


    'x264_nvenc': 'h264_nvenc',
    'x265_nvenc': 'hevc_nvenc',

Maybe even better would just have it so that if --encoding isn't x264 or x265 then it just passes the argument verbatim to ffmpeg.

Those are just some ideas. Thanks again for the script, as it really simplifies having to write out crazy long ffmpeg command lines every time.


----------



## ehendrix23

lairdb said:


> Nah -- if we can get them all, we stitch them together into a VR panorama.


That is cool. Loved watching it and moving around. 

As long as someone can tell me how to stitch them all together like that.


----------



## firedog7881

OakTree said:


> Cool, @ehendrix23BTW, I noticed that if you put the rigth camera on the left side and the left camera on the right side, you have a complete view of the sides and the back.
> 
> Thanks


I feel like if you keep the left and right on their respective sides but mirror the videos then the car side of the video will be toward the center and "feel" more natural. I don't have the knowledge, or time, right now to do it so I thought I would pass on the thought.


----------



## Joaquin

firedog7881 said:


> I feel like if you keep the left and right on their respective sides but mirror the videos then the car side of the video will be toward the center and "feel" more natural. I don't have the knowledge, or time, right now to do it so I thought I would pass on the thought.


+1 I actually thought you were already doing this, like @lairdb did in his sample here: https://teslaownersonline.com/threads/dashcam-video-script.11481/post-214441

In this output at second 6 we see an image like this:










Probably most people would expect something like this (horizontal flip, like in a mirror image):


----------



## ehendrix23

Joaquin said:


> +1 I actually thought you were already doing this, like @lairdb did in his sample here: https://teslaownersonline.com/threads/dashcam-video-script.11481/post-214441


K, will call it like that COMBINED. The other one where it seems like you're looking to the rear of the car I will call REAR. 

Still working on few other items and then will provide updated release.


----------



## @gravityrydr

Thank you so much for doing this. As soon as I saw how the videos were being labeled for the dash cam I thought about doing this. I glad I decided to take a look here and see if anyone else had the same thought. Excellent work


----------



## JWardell

So happy to finally be able to test this!
Sure enough the very first time I use it, someone hits my mirror with their door. I would have no idea if I didn't happen to be testing this...
But there was a problem, the generated video stops about halfway through the videos in the directory. Looks like there was some error, maybe because of corruption in the source video files (Maybe because of USB being too slow? Tesla REALLY needs to add better compression to its files)
Can you somehow configure this so that it ignores errors or moves along to the next file?

Here's the output log if it is helpful:


----------



## JWardell

Looks like I have a number of blank files, and it stops executing with a completely blank file. For my second example all the left repeater files are 0k and no output video is produced at all. Again, preferred if it skipped and continued with the files it does have.


----------



## ehendrix23

JWardell said:


> Looks like I have a number of blank files, and it stops executing with a completely blank file. For my second example all the left repeater files are 0k and no output video is produced at all. Again, preferred if it skipped and continued with the files it does have.


Your wish is my command. 

Will be going through the file you send me, make sure I can replicate the issues and handle it. Will be a few days (thinking on working more on this over the weekend .... job paying for my Tesla has been a bit busy <g>).

Right now for the next version I have:
-) Perspective - done
-) Side cameras mirrored so that it looks like it's a rear camera and not side). Seeing to do this separate from layout - in progress
-) Linux font - done
-) Hardware (GPU) encoding (clearly can only be enabled on supported platforms) - in progress
-) Better handling for missing files

After that:
-) Ability to use profiles (safe settings so command line switches don't have to be done every time), with a default one (that off course can always be updated). 
-) GUI (this will be an interesting one and might take me some time).


----------



## ehendrix23

JWardell said:


> So happy to finally be able to test this!
> Sure enough the very first time I use it, someone hits my mirror with their door. I would have no idea if I didn't happen to be testing this...
> But there was a problem, the generated video stops about halfway through the videos in the directory. Looks like there was some error, maybe because of corruption in the source video files (Maybe because of USB being too slow? Tesla REALLY needs to add better compression to its files)
> Can you somehow configure this so that it ignores errors or moves along to the next file?
> 
> Here's the output log if it is helpful:


So first file is missing, all the others are there but were empty, correct?


----------



## JWardell

ehendrix23 said:


> So first file is missing, all the others are there but were empty, correct?


I had to look back. So in this example, the output video stops about halfway through all the videos. It looks like right repeater file is missing at first, then 0k for the rest.
In the second use, right and left repeater files are all zero, and no output was produced at all.
So it seems it;'s not the 0k or missing files that are screwing it up, probably corrupted video/missing blocks/etc.
Feel free to feed me test versions to try

I'm suffering from the 0k files detailed in this thread which may just be a firmware issue, it looks like my stick's write light is only on part of the time. Will try an SSD this weekend


----------



## MelindaV

Can someone point me to a step-by-step how-to for running this on a Mac? I don't know any of the backend programming stuff, but can follow instructions well enough


----------



## JWardell

MelindaV said:


> Can someone point me to a step-by-step how-to for running this on a Mac? I don't know any of the backend programming stuff, but can follow instructions well enough


It requires using the terminal not only to run but to install python and ffmpeg, are you comfortable with that?
Otherwise hopefully someone can create some kind of app to do it all.


----------



## Norm Rechtman

The Mac OS script didn't work correctly in Terminal, it says No such file or directory after removing the .dms from the downloaded file and trying to run the script you wrote in terminal


----------



## Norm Rechtman

Damn, can't you just write a dmg file that everyone can run?


----------



## JWardell

Norm Rechtman said:


> The Mac OS script didn't work correctly in Terminal, it says No such file or directory after removing the .dms from the downloaded file and trying to run the script you wrote in terminal


Check the readme, you have to chmod it to an executable and run it from the shell and feed it the correct arguments. (It does work, but for advanced users at the moment)
I might work on an automator action this week or at least step by step instructions for Mac. Hopefully there is a new version soon too.


----------



## MelindaV

JWardell said:


> It requires using the terminal not only to run but to install python and ffmpeg, are you comfortable with that?
> Otherwise hopefully someone can create some kind of app to do it all.


Yeah, I'm fine with terminal, assuming I have the decoder ring


----------



## atomitod

I developed an Automator workflow that should be useful for MacOS users that want to run this (fantastic) dash cam script as efficiently as possible. I posted about it in a separate thread so as to keep this one focused. No doubt a GUI will end up being tons better, but for now Automator helps out a lot.


----------



## JWardell

atomitod said:


> I developed an Automator workflow that should be useful for MacOS users that want to run this (fantastic) dash cam script as efficiently as possible. I posted about it in a separate thread so as to keep this one focused. No doubt a GUI will end up being tons better, but for now Automator helps out a lot.


I tried but couldn't get your script to work. It's hard to troubleshoot because I couldn't find a way to display output from the run shell script command.

So I modified it to use AppleScript to use Terminal. I already have python and ffmpeg fully installed so this just relies on the video script binary to be in the home directory and uses the default video output location. It ran successfully on a number of recordings for me. Designed to be installed in the same ~/Library/Services/ directory but of course it can be opened with automator to edit.
Others are welcome to give it a try:
https://www.dropbox.com/s/rhbypdbtwl8xr2m/DashcamService.zip?dl=0

@ehendrix23 my recordings are all being written since whatever bug cleared up after day 1. I increased the quality a bit, but I find what I really tend to do is run things quickly, then play back the videos quickly to see if there is anything interesting. I'm not sure if it is a lot of work or even possible, but it would be great to have some quickly-processed output that plays back/skips frames at 20x for review, then if there is something important can be run again (maybe just with the particular minute or two) in a high quality mode that produces video at full resolution and quality. This is all probably best for a polished app. Or maybe Tesla can just do this on the car's display when you get back, and then delete videos that are not of concern....


----------



## lairdb

JWardell said:


> @ehendrix23 my recordings are all being written since whatever bug cleared up after day 1. I increased the quality a bit, but I find what I really tend to do is run things quickly, then play back the videos quickly to see if there is anything interesting. I'm not sure if it is a lot of work or even possible, but it would be great to have some quickly-processed output that plays back/skips frames at 20x for review, then if there is something important can be run again (maybe just with the particular minute or two) in a high quality mode that produces video at full resolution and quality. This is all probably best for a polished app. Or maybe Tesla can just do this on the car's display when you get back, and then delete videos that are not of concern....


I could argue that playback speed is best left to the player -- but if you want to adjust the file, dropping frames is an easy ffmpeg filter and would yield a timelapse effect.

The filter framestep=6,setpts=N/FRAME_RATE/TB should give you every 6th frame.

@ehendrix23, if you wanted to, you could add that as a distinct option that would apply to any selected output format.


----------



## ehendrix23

lairdb said:


> I could argue that playback speed is best left to the player -- but if you want to adjust the file, dropping frames is an easy ffmpeg filter and would yield a timelapse effect.
> 
> The filter framestep=6,setpts=N/FRAME_RATE/TB should give you every 6th frame.
> 
> @ehendrix23, if you wanted to, you could add that as a distinct option that would apply to any selected output format.


LOL. I was already looking at this and just finishing it in the script based on: https://trac.ffmpeg.org/wiki/How to speed up / slow down a video
Parameter --speedup is used to speed the video up, parameter --slowdown to slow it down.


----------



## ehendrix23

JWardell said:


> I tried but couldn't get your script to work. It's hard to troubleshoot because I couldn't find a way to display output from the run shell script command.
> 
> So I modified it to use AppleScript to use Terminal. I already have python and ffmpeg fully installed so this just relies on the video script binary to be in the home directory and uses the default video output location. It ran successfully on a number of recordings for me. Designed to be installed in the same ~/Library/Services/ directory but of course it can be opened with automator to edit.
> Others are welcome to give it a try:
> https://www.dropbox.com/s/rhbypdbtwl8xr2m/DashcamService.zip?dl=0
> 
> @ehendrix23 my recordings are all being written since whatever bug cleared up after day 1. I increased the quality a bit, but I find what I really tend to do is run things quickly, then play back the videos quickly to see if there is anything interesting. I'm not sure if it is a lot of work or even possible, but it would be great to have some quickly-processed output that plays back/skips frames at 20x for review, then if there is something important can be run again (maybe just with the particular minute or two) in a high quality mode that produces video at full resolution and quality. This is all probably best for a polished app. Or maybe Tesla can just do this on the car's display when you get back, and then delete videos that are not of concern....


Well, now you tell me.  So right now I have it that if a file is missing (i.e. left camera) then it won't be an issue and instead will just show black picture for that camera. Clearly, if out of the 10 files only 1 file is missing then it will only show the black for that 1 minute.

I had already looked into ability to speed up (or slow down) video and was just finishing that portion up as well.

Also have a number of other changes in there. Might put a post out a bit later for folks to test it out.

On another note, as you are using Mac. Any reason you're not using the single executable? Still need ffmpeg but with it there is no need for python (or there shouldn't based on my understanding).
Oh, and assuming you have a newer Mac (newer then like 2014) ... this newer version will leverage GPU acceleration.


----------



## ehendrix23

Norm Rechtman said:


> Damn, can't you just write a dmg file that everyone can run?


Cause I did not think on providing the Mac one in a DMG file. <g>. For next version I will also create a DMG file. Just also wanna see if I can include ffmpeg in there and if so what else I need to include from a license perspective for it.


----------



## JWardell

ehendrix23 said:


> Well, now you tell me.  So right now I have it that if a file is missing (i.e. left camera) then it won't be an issue and instead will just show black picture for that camera. Clearly, if out of the 10 files only 1 file is missing then it will only show the black for that 1 minute.
> 
> I had already looked into ability to speed up (or slow down) video and was just finishing that portion up as well.
> 
> Also have a number of other changes in there. Might put a post out a bit later for folks to test it out.
> 
> On another note, as you are using Mac. Any reason you're not using the single executable? Still need ffmpeg but with it there is no need for python (or there shouldn't based on my understanding).
> Oh, and assuming you have a newer Mac (newer then like 2014) ... this newer version will leverage GPU acceleration.


I can't remember why...maybe just reading python at the beginning I blindly installed it, even though I'm using the executable. Or maybe I installed it for something else...brain is going to mush.
Glad you are continuing to add features. This script just adds to the fun of this. Already caught folks at the mall pointing out the car, then the screen, and then reacted to HAL popping up.


----------



## ehendrix23

JWardell said:


> I can't remember why...maybe just reading python at the beginning I blindly installed it, even though I'm using the executable. Or maybe I installed it for something else...brain is going to mush.
> Glad you are continuing to add features. This script just adds to the fun of this. Already caught folks at the mall pointing out the car, then the screen, and then reacted to HAL popping up.


LOL. Yeah, just using executable should work fine. 

Yep, this next release has quite a few items in it. Also glad to see that Tesla did not do anything different on how to write the information from the cameras between dashcam and Sentry. Means same script can be used for either.


----------



## ehendrix23

K,

Got a test version ready for the next release. Following improvements have been done:

Added GPU hardware accelerated encoding for Mac and PCs with NVIDIA. On Mac it is enabled by default
Added option to have video from side cameras be shown as if one were to look at it through the mirror (option --mirror). This is now the default
Added option --rear to show video from side cameras as if one was looking to the rear of the car. This was how it was originally.
Added option to swap left and right camera in output. Mostly beneficial in FULLSCREEN with --rear option as it then seems like it is from a rear camera
Added option to speedup (--speedup) or slowdown (--slowdown) the video.
Added option to provide a different encoder for ffmpeg to use. This is for those more experienced with ffmpeg.
Now able to handle if a camera file is missing, a black screen will be shown for that duration for the missing file
For output (--output) one can now also just specify a folder name. The resulting filename will be based on the name of the folder it is then put in
The intermediate files (combining of the 3 cameras into 1 video file per minute) will now be written to the output folder if one provided.
The intermediate files will be deleted once the complete video file is created. This can be disabled through option --keep-intermediate
Set FULLSCREEN back as the default layout
Added a default font path for Linux systems
Help output (-h) will show what default value is for each parameter
Cleaned up help output
Added --version to get the version number
Note, I haven't tested completely tested this one yet. Hence a "beta" release. Most pieces so far seem to be working though.  Would love to get some other folks try it out however.
I created a single binary for Mac, but did not yet create one for Windows as it is a test release (and currently my Windows VM is shutdown).
The binary for Mac can be downloaded from here: https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.8-beta.1/tesla_dashcam
For those on Windows or Linux who want to try (I also have not yet pushed it to pypi) can get the python script by downloading the zip file from here: https://github.com/ehendrix23/tesla_dashcam/archive/v0.1.8-beta.1.zip
The script can be found in: tesla_dashcam folder within the zip file.

Note, plan is to also provide a DMG file for Mac users when I release 0.1.8.


----------



## smak

Thanks for all this. It's great.

I did notice a couple of times where one of the cameras was behind. I'd be at a stop sign, and start up again, and one camera (or 2) showed me still there. But then within the same video, they'd all catch up.


----------



## Quocamus

Thanks for your work on this script! It's very helpful.

Often times when I save video with the dashcam, I'm only interested in the last minute of video, so I'll delete the other 9 minutes. I see that the script will create the intermediate file, and then still go through the combining phase to create the final video (that is essentially the same). I wonder if it is worth checking if it is only combining one video, and then skipping that phase if that is the case. I guess it would just save processing time, since your new version will already delete the intermediate files.


----------



## JWardell

ehendrix23 said:


> K,
> 
> Got a test version ready for the next release. Following improvements have been done:
> 
> Added GPU hardware accelerated encoding for Mac and PCs with NVIDIA. On Mac it is enabled by default
> Added option to have video from side cameras be shown as if one were to look at it through the mirror (option --mirror). This is now the default
> Added option --rear to show video from side cameras as if one was looking to the rear of the car. This was how it was originally.
> Added option to swap left and right camera in output. Mostly beneficial in FULLSCREEN with --rear option as it then seems like it is from a rear camera
> Added option to speedup (--speedup) or slowdown (--slowdown) the video.
> Added option to provide a different encoder for ffmpeg to use. This is for those more experienced with ffmpeg.
> Now able to handle if a camera file is missing, a black screen will be shown for that duration for the missing file
> For output (--output) one can now also just specify a folder name. The resulting filename will be based on the name of the folder it is then put in
> The intermediate files (combining of the 3 cameras into 1 video file per minute) will now be written to the output folder if one provided.
> The intermediate files will be deleted once the complete video file is created. This can be disabled through option --keep-intermediate
> Set FULLSCREEN back as the default layout
> Added a default font path for Linux systems
> Help output (-h) will show what default value is for each parameter
> Cleaned up help output
> Added --version to get the version number
> Note, I haven't tested completely tested this one yet. Hence a "beta" release. Most pieces so far seem to be working though.  Would love to get some other folks try it out however.
> I created a single binary for Mac, but did not yet create one for Windows as it is a test release (and currently my Windows VM is shutdown).
> The binary for Mac can be downloaded from here: https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.8-beta.1/tesla_dashcam
> For those on Windows or Linux who want to try (I also have not yet pushed it to pypi) can get the python script by downloading the zip file from here: https://github.com/ehendrix23/tesla_dashcam/archive/v0.1.8-beta.1.zip
> The script can be found in: tesla_dashcam folder within the zip file.
> 
> Note, plan is to also provide a DMG file for Mac users when I release 0.1.8.


Thanks! For the most part the new version works well. I definitely prefer --rear over --mirror but as always it's great to have the option.
And --speedup does just what I want with a value of 20, increasing both processing time and reducing watch time! It took me a few attempts to realize this was looking for a numeric value.


----------



## ehendrix23

JWardell said:


> Thanks! For the most part the new version works well. I definitely prefer --rear over --mirror but as always it's great to have the option.
> And --speedup does just what I want with a value of 20, increasing both processing time and reducing watch time! It took me a few attempts to realize this was looking for a numeric value.


Yeah, some seem to like rear, other's mirror. Hence option to choose. Same with layout. 

Adjusted the usage a bit for --speedup (and --slowdown) hopefully making it more clear. <g>.


----------



## ehendrix23

smak said:


> Thanks for all this. It's great.
> 
> I did notice a couple of times where one of the cameras was behind. I'd be at a stop sign, and start up again, and one camera (or 2) showed me still there. But then within the same video, they'd all catch up.


There is a file for each camera, each minute. I merge the 3 files (for each camera) together into 1 video. Once I've done it for every minute of it I then take those videos and merge them into 1 video.
But, right now I go from the point that the timestamp for all 3 is exactly the same. Seems in your case some are just a bit behind or so.

Would be great if you could share some examples of this (if you don't mind). A future improvement is to synchronize the files based on the timestamps recorded within the media file, so would love to see if what you're encountering would then be resolved by that.


----------



## ehendrix23

Quocamus said:


> Thanks for your work on this script! It's very helpful.
> 
> Often times when I save video with the dashcam, I'm only interested in the last minute of video, so I'll delete the other 9 minutes. I see that the script will create the intermediate file, and then still go through the combining phase to create the final video (that is essentially the same). I wonder if it is worth checking if it is only combining one video, and then skipping that phase if that is the case. I guess it would just save processing time, since your new version will already delete the intermediate files.


Well, now you're just making sense. 

Just included it. If there is only 1 intermediate file then it will just be moved (if intermediate files are to be deleted) or copied (if you wanna keep intermediate files) instead of running ffmpeg again for no real reason.
This update is in v0.1.8-beta.2


----------



## tsj

Script (Win10, python) appears to be working well for me, thanks! I modified the .py script, doubling the sizes in the fullscreen section to retain the original video sizes. The result was, as expected, a 2560x1920 video size, larger file size and longer render time. 

Perhaps a scaling factor argument would be useful, smaller and faster, or large and slow to retain detail. 

Nice work. Thanks


----------



## Spinball

@ehendrix23 I think there's a path typo in the current Windows executable. I get an ffmpeg error no matter what, and I think it's because of this line:


Code:


drawtext=fontfile=C\\:\\Windows\\Fonts\\arial.ttf

Update: I've fixed it!  Installed Python, downloaded the source code, ran it, got the same error. Then edited the source code DEFAULT_FONT section like so and it's happily running now.



Code:


DEFAULT_FONT = {
    'darwin': '/Library/Fonts/Arial.ttf',
    'win32':  '/Windows/fonts/arial.ttf',
    'cygwin': '/Windows/fonts/arial.ttf',
    'linux':  '/usr/share/fonts/truetype/freefont/FreeSans.ttf',
}

I caught some folks checking out my car in the parking lot, so that was enough motivation to figure this ffmpeg issue out.


----------



## ehendrix23

Spinball said:


> @ehendrix23 I think there's a path typo in the current Windows executable. I get an ffmpeg error no matter what, and I think it's because of this line:
> 
> 
> Code:
> 
> 
> drawtext=fontfile=C\\:\\Windows\\Fonts\\arial.ttf
> 
> Update: I've fixed it!  Installed Python, downloaded the source code, ran it, got the same error. Then edited the source code DEFAULT_FONT section like so and it's happily running now.
> 
> 
> 
> Code:
> 
> 
> DEFAULT_FONT = {
> 'darwin': '/Library/Fonts/Arial.ttf',
> 'win32':  '/Windows/fonts/arial.ttf',
> 'cygwin': '/Windows/fonts/arial.ttf',
> 'linux':  '/usr/share/fonts/truetype/freefont/FreeSans.ttf',
> }
> 
> I caught some folks checking out my car in the parking lot, so that was enough motivation to figure this ffmpeg issue out.


Are you running this under Windows or cygwin in Windows? On my Windows VM it works with the font path I provided.
However, it looks like the path for cygwin might be incorrect and might indeed need to be changed to what you provide above.
Can you set the path for win32 back to:


Code:


'win32':  'C\:\\Windows\\Fonts\\arial.ttf',


----------



## ehendrix23

I just released v0.1.8 with the following changes:

- Added GPU hardware accelerated encoding for Mac and PCs with NVIDIA. On Mac it is enabled by default
- Added option to have video from side cameras be shown as if one were to look at it through the mirror (option --mirror). This is now the default
- Added option --rear to show video from side cameras as if one was looking to the rear of the car. This was how it was originally.
- Added option to swap left and right camera in output. Mostly beneficial in FULLSCREEN with --rear option as it then seems like it is from a rear camera
- Added option to speedup (--speedup) or slowdown (--slowdown) the video.
- Added option to provide a different encoder for ffmpeg to use. This is for those more experienced with ffmpeg.
- Now able to handle if a camera file is missing, a black screen will be shown for that duration for the missing file
- For output (--output) one can now also just specify a folder name. The resulting filename will be based on the name of the folder it is then put in
- If there is only 1 video file for merging then will now just rename intermediate (or copy if --keep-intermediate is set).
- The intermediate files (combining of the 3 cameras into 1 video file per minute) will now be written to the output folder if one provided.
- The intermediate files will be deleted once the complete video file is created. This can be disabled through option --keep-intermediate
- Set FULLSCREEN back as the default layout
- Added a default font path for Linux systems
- Fixed (I believe) cygwin path for fonts.
- Help output (-h) will show what default value is for each parameter
- Cleaned up help output
- Added --version to get the version number
- Releases will now be bundled in a ZIP file (Windows) or a DMG file (MacOS) with self-contained executables in them. This means Python does not need to be installed anymore (located on github)
- ffmpeg executable binary for Windows and MacOS added into respective bundle.
- Default path for ffmpeg will be set to same path as tesla_dashcam is located in, if not exist then default will be based that ffmpeg is part of PATH.

For Windows users, you can retrieve the executable here: https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.8/tesla_dashcam.zip
For MacOS users, you can retrieve the executable here: https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.8/tesla_dashcam.dmg
For Linux users, please use Python and pip to retrieve the latest version.


----------



## Spinball

ehendrix23 said:


> Are you running this under Windows or cygwin in Windows?


Regular Windows 7.


----------



## OakTree

ehendrix23 said:


> I just released v0.1.8 with the following changes:
> 
> - Added GPU hardware accelerated encoding for Mac and PCs with NVIDIA. On Mac it is enabled by default
> - Added option to have video from side cameras be shown as if one were to look at it through the mirror (option --mirror). This is now the default
> - Added option --rear to show video from side cameras as if one was looking to the rear of the car. This was how it was originally.
> - Added option to swap left and right camera in output. Mostly beneficial in FULLSCREEN with --rear option as it then seems like it is from a rear camera
> - Added option to speedup (--speedup) or slowdown (--slowdown) the video.
> - Added option to provide a different encoder for ffmpeg to use. This is for those more experienced with ffmpeg.
> - Now able to handle if a camera file is missing, a black screen will be shown for that duration for the missing file
> - For output (--output) one can now also just specify a folder name. The resulting filename will be based on the name of the folder it is then put in
> - If there is only 1 video file for merging then will now just rename intermediate (or copy if --keep-intermediate is set).
> - The intermediate files (combining of the 3 cameras into 1 video file per minute) will now be written to the output folder if one provided.
> - The intermediate files will be deleted once the complete video file is created. This can be disabled through option --keep-intermediate
> - Set FULLSCREEN back as the default layout
> - Added a default font path for Linux systems
> - Fixed (I believe) cygwin path for fonts.
> - Help output (-h) will show what default value is for each parameter
> - Cleaned up help output
> - Added --version to get the version number
> - Releases will now be bundled in a ZIP file (Windows) or a DMG file (MacOS) with self-contained executables in them. This means Python does not need to be installed anymore (located on github)
> - ffmpeg executable binary for Windows and MacOS added into respective bundle.
> - Default path for ffmpeg will be set to same path as tesla_dashcam is located in, if not exist then default will be based that ffmpeg is part of PATH.
> 
> For Windows users, you can retrieve the executable here: https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.8/tesla_dashcam.zip
> For MacOS users, you can retrieve the executable here: https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.8/tesla_dashcam.dmg
> For Linux users, please use Python and pip to retrieve the latest version.


Working great so far.
Btw, I'm running on Linux. 
Thanks


----------



## ehendrix23

Spinball said:


> Regular Windows 7.


Weird, I tested it on Windows 10 and path specified for font was working fine.

Can you try with the latest version?


----------



## ehendrix23

OakTree said:


> Working great so far.
> Btw, I'm running on Linux.
> Thanks


FYi, for Linux. I cannot provide a self-contained executable as I do not have Linux and per my understanding when making one it also might be somewhat dependent on the distribution.

BUT, if you want to make your own self-contained executable you can. Just install pyinstaller: 
pip install pyinstaller
And then to create the self-contained executable run:
pyinstaller --onefile tesla_dashcam.py

That is exactly what I do to create the executables for MacOS and Windows respectively.


----------



## Flashgj

I am at a total loss on how to use this script on a Mac. I have downloaded the files from Github and tried to download the stand-alone binaries for the Mac but got a broken link and was not able to download it.

Can someone help with step by step instructions on how to use this on a Mac? I do not have any experience with scripts and cannot figure out how to get this all to work.

Thanks in advance!


----------



## Bokonon

Flashgj said:


> I am at a total loss on how to use this script on a Mac. I have downloaded the files from Github and tried to download the stand-alone binaries for the Mac but got a broken link and was not able to download it.
> 
> Can someone help with step by step instructions on how to use this on a Mac? I do not have any experience with scripts and cannot figure out how to get this all to work.
> 
> Thanks in advance!


Have you seen this thread? @atomitod has made a MacOS Automator for the dashcam script to make it easier to work with.


----------



## Flashgj

@Bokonon, thank you! I will give that a try.


----------



## RickO2018

ehendrix23 said:


> All,
> 
> Just wanted to share that I created a Python script that combines the footage from the Tesla dash cam cameras and puts it into 1 video.
> 
> Perspective video (all 3 cameras next to each other):
> 
> 
> 
> 
> 
> Widescreen video (all 3 cameras next to each other):
> 
> 
> 
> 
> 
> Fullscreen video (front top center, left and right under front):
> 
> 
> 
> 
> 
> Further information is available in the description.
> 
> New releases (including binary for Windows and MacOS) can be found here: https://github.com/ehendrix23/tesla_dashcam/releases
> Readme: https://github.com/ehendrix23/tesla_dashcam/blob/master/README.rst
> 
> Python Package can be found: https://pypi.org/project/tesla-dashcam/
> Source: https://github.com/ehendrix23/tesla_dashcam
> 
> Enjoy.


The link i'm using leads to a 404 file error. Where do I get the latest DMG file?


----------



## ehendrix23

RickO2018 said:


> The link i'm using leads to a 404 file error. Where do I get the latest DMG file?


Here is the link for the DMG file (latest release which is v0.1.8):
https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.8/tesla_dashcam.dmg


----------



## ehendrix23

Flashgj said:


> I am at a total loss on how to use this script on a Mac. I have downloaded the files from Github and tried to download the stand-alone binaries for the Mac but got a broken link and was not able to download it.
> 
> Can someone help with step by step instructions on how to use this on a Mac? I do not have any experience with scripts and cannot figure out how to get this all to work.
> 
> Thanks in advance!


The link for latest release (DMG) is here: https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.8/tesla_dashcam.dmg

You can copy the ffmpeg and tesla_dashcam to a folder on your desktop or so (wherever you want). Then open a terminal window to execute.
i.e., when copied to your desktop just open a Terminal window and run: ~\Desktop\tesla_dashcam --help
That will give you the help,

Also see the README.html file that is in the disk image.


----------



## Flashgj

Thank you for everyone’s help. It is starting to make sense now but I am currently away from my M3 on vacation so I will play with it upon my return and see if I get it all working. I am confident that I will now.


----------



## RickO2018

ehendrix23 said:


> Here is the link for the DMG file (latest release which is v0.1.8):
> https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.8/tesla_dashcam.dmg


Thank you!


----------



## GDN

Had a little time to set this up tonight. Very cool and Thanks @ehendrix23 !! I'm on a Mac, so I used the automator that @atomitod put together. Makes is really nice and simple. I duplicated the automator a couple of times and updated it, I created one that will create using "--speed 10" and one for "--speed 20". I used "--rear" as that seems to make more sense to my brain. Speed 10 is really likely the perfect one for me - 10 minutes of video reduce down to 1. Can still get some detail as it doesn't play too fast.

It processes much faster with the "speed" options and that is perfect for glancing to see if something happened near or around the car, if it did I will just run it again using the normal speed so I can see it in real time and analyze closer if anything happened.


----------



## ehendrix23

For those willing to test ... a new test release is available (v0.1.9b0). Following improvements have been done:

- Added scanning of sub-folders clip files. Each folder will be processed and resulting movie file created. This can be disabled through parameter --exclude_subdirs
- Added option to merge the video files from multiple sub-folders into 1 movie file. Use parameter --merge to enable.
- Added option to monitor if the USB drive (or SD card) is inserted in the PC and then automatically start processing the files. Use parameter --monitor to enable.
Parameter --monitor_once will stop monitoring and exit after 1st time drive was inserted.
Parameter --delete_source will delete the source files and folder once the movie file for that folder has been created.
- Will now check if a new update is available, additional arguments to just perform check (--check_for_update), include test releases (--include_test), or disable always checking for updates (--no-check_for_update)
- Formatted output to easily show progress
- Time it took to create the video files will now be provided upon completion of processing.
- Will now handle it much better if a video file from a camera is corrupt (i.e. zero-byte file).

This is a test release and not everything has been fully vetted yet. MacOS DMG and Windows ZIP with binaries are available as well. 
You can download it here: Release v0.1.9b0 - BETA release 

Thx.


----------



## GDN

Very nice - thanks for the continued updating. I didn't do much with it, but did pull my drive and plugged it in, it processed the 16 or so sub folders I had creating the video file for each. I wasn't watching it super close, but it did error at the end and gave me some sort of error I think about the subdirectories. Maybe something about it didn't realize it had reached the end or something, sorry I didn't capture, and I don't see the message in may notifications (on a Mac). I didn't change any settings, I used my automator that I had setup for the last version, so didn't add any new parameters. 

Looking good though - that goes a long ways toward processing a weeks worth of video files really easy.


----------



## ehendrix23

GDN said:


> I wasn't watching it super close, but it did error at the end and gave me some sort of error I think about the subdirectories. Maybe something about it didn't realize it had reached the end or something, sorry I didn't capture, and I don't see the message in may notifications (on a Mac). I didn't change any settings, I used my automator that I had setup for the last version, so didn't add any new parameters. .


Any way you could replicate? I had like 46 folders on mine and it processed them all without error. But then that is just me. 
Hence would love to see the error you got so that I can fix it. 

Thx


----------



## GDN

ehendrix23 said:


> Any way you could replicate? I had like 46 folders on mine and it processed them all without error. But then that is just me.
> Hence would love to see the error you got so that I can fix it.
> 
> Thx


Give me 24 hours and I will definitely try again. I was busy doing some other things earlier and after I watched all of the videos it had created I cleaned up my SSD and I didn't leave anything on it.


----------



## japhule

I was able to run this latest beta across several subfolders. It didn't like one of the subfolders, causing it to stop completely. If I run the same folder using the previous beta, I do get an error but it skips the problem files and goes on to the next file and completes.

From latest beta


Code:


        Processing 11 clips in folder \\NAS\TeslaCam\Scan\2019-04-17_14-17-25 (5/6)
                Processing clip 1/11 from 04/17/19 14:07:08 and 59 seconds long.
                Processing clip 2/11 from 04/17/19 14:08:09 and 59 seconds long.
                Processing clip 3/11 from 04/17/19 14:09:10 and 60 seconds long.
                Processing clip 4/11 from 04/17/19 14:10:11 and 60 seconds long.
                Processing clip 5/11 from 04/17/19 14:11:12 and 59 seconds long.
Traceback (most recent call last):
  File "tesla_dashcam\tesla_dashcam.py", line 1444, in <module>
  File "tesla_dashcam\tesla_dashcam.py", line 1440, in main
  File "tesla_dashcam\tesla_dashcam.py", line 716, in process_folders
  File "tesla_dashcam\tesla_dashcam.py", line 448, in create_intermediate_movie
UnboundLocalError: local variable 'camera_1' referenced before assignment
[7496] Failed to execute script tesla_dashcam

From previous beta


Code:


Processing clip 1/11 from 04/17/19 14:07:08 and 59 seconds long.
Processing clip 2/11 from 04/17/19 14:08:09 and 59 seconds long.
Processing clip 3/11 from 04/17/19 14:09:10 and 60 seconds long.
Processing clip 4/11 from 04/17/19 14:10:11 and 60 seconds long.
Processing clip 5/11 from 04/17/19 14:11:12 and 59 seconds long.
Error trying to create clip for \\NAS\TeslaCam\2019-04-17_14-17-25\2019-04-17_14-11. RC: 1
Command: ['C:\\Users\\japhu\\Videos\\TeslaCam\\ffmpeg.exe', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-11-left_repeater.mp4', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-11-front.mp4', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-11-right_repeater.mp4', '-filter_complex', "color=duration=59.83:s=1280x960:c=black [base];[0:v] setpts=PTS-STARTPTS, scale=640x480  [left];[1:v] setpts=PTS-STARTPTS, scale=640x480  [front];[2:v] setpts=PTS-STARTPTS, scale=640x480  [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=C\\:\\Windows\\Fonts\\arial.ttf:fontcolor=white:fontsize=16:borderw=2:[email protected]:x=(w/2-text_w/2):y=(h-(text_h*2)):text='%{pts\\:localtime\\:1555528272\\:%x %X}'", '-preset', 'medium', '-crf', '28', '-c:v', 'libx264', '-y', '\\\\NAS\\TeslaCam\\Output\\2019-04-17_14-11.mp4']
Error: b"ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers\r\n  built with gcc 8.2.1 (GCC) 20190212\r\n  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth\r\n  libavutil      56. 22.100 / 56. 22.100\r\n  libavcodec     58. 35.100 / 58. 35.100\r\n  libavformat    58. 20.100 / 58. 20.100\r\n  libavdevice    58.  5.100 / 58.  5.100\r\n  libavfilter     7. 40.101 /  7. 40.101\r\n  libswscale      5.  3.100 /  5.  3.100\r\n  libswresample   3.  3.100 /  3.  3.100\r\n  libpostproc    55.  3.100 / 55.  3.100\r\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-11-left_repeater.mp4':\r\n  Metadata:\r\n    major_brand     : mp42\r\n    minor_version   : 0\r\n    compatible_brands: mp42mp41isomiso2\r\n    creation_time   : 2019-04-17T19:11:12.000000Z\r\n  Duration: 00:00:59.83, start: 0.000000, bitrate: 4009 kb/s\r\n    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4005 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\r\n    Metadata:\r\n      creation_time   : 2019-04-17T19:11:12.000000Z\r\n      handler_name    : VideoHandler\r\nInput #1, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-11-front.mp4':\r\n  Metadata:\r\n    major_brand     : mp42\r\n    minor_version   : 0\r\n    compatible_brands: mp42mp41isomiso2\r\n    creation_time   : 2019-04-17T19:11:12.000000Z\r\n  Duration: 00:00:59.83, start: 0.000000, bitrate: 4008 kb/s\r\n    Stream #1:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4005 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\r\n    Metadata:\r\n      creation_time   : 2019-04-17T19:11:12.000000Z\r\n      handler_name    : VideoHandler\r\n[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a00869be80] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!\r\n[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a00869be80] moov atom not found\r\n\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-11-right_repeater.mp4: Invalid data found when processing input\r\n"


Processing clip 6/11 from 04/17/19 14:12:13 and 60 seconds long.
Error trying to create clip for \\NAS\TeslaCam\2019-04-17_14-17-25\2019-04-17_14-12. RC: 1
Command: ['C:\\Users\\japhu\\Videos\\TeslaCam\\ffmpeg.exe', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-12-left_repeater.mp4', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-12-front.mp4', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-12-right_repeater.mp4', '-filter_complex', "color=duration=60.05:s=1280x960:c=black [base];[0:v] setpts=PTS-STARTPTS, scale=640x480  [left];[1:v] setpts=PTS-STARTPTS, scale=640x480  [front];[2:v] setpts=PTS-STARTPTS, scale=640x480  [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=C\\:\\Windows\\Fonts\\arial.ttf:fontcolor=white:fontsize=16:borderw=2:[email protected]:x=(w/2-text_w/2):y=(h-(text_h*2)):text='%{pts\\:localtime\\:1555528333\\:%x %X}'", '-preset', 'medium', '-crf', '28', '-c:v', 'libx264', '-y', '\\\\NAS\\TeslaCam\\Output\\2019-04-17_14-12.mp4']
Error: b"ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers\r\n  built with gcc 8.2.1 (GCC) 20190212\r\n  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth\r\n  libavutil      56. 22.100 / 56. 22.100\r\n  libavcodec     58. 35.100 / 58. 35.100\r\n  libavformat    58. 20.100 / 58. 20.100\r\n  libavdevice    58.  5.100 / 58.  5.100\r\n  libavfilter     7. 40.101 /  7. 40.101\r\n  libswscale      5.  3.100 /  5.  3.100\r\n  libswresample   3.  3.100 /  3.  3.100\r\n  libpostproc    55.  3.100 / 55.  3.100\r\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-12-left_repeater.mp4':\r\n  Metadata:\r\n    major_brand     : mp42\r\n    minor_version   : 0\r\n    compatible_brands: mp42mp41isomiso2\r\n    creation_time   : 2019-04-17T19:12:13.000000Z\r\n  Duration: 00:01:00.05, start: 0.000000, bitrate: 4008 kb/s\r\n    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4004 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\r\n    Metadata:\r\n      creation_time   : 2019-04-17T19:12:13.000000Z\r\n      handler_name    : VideoHandler\r\n[mov,mp4,m4a,3gp,3g2,mj2 @ 0000017e1a5034c0] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!\r\n[mov,mp4,m4a,3gp,3g2,mj2 @ 0000017e1a5034c0] moov atom not found\r\n\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-12-front.mp4: Invalid data found when processing input\r\n"


Processing clip 7/11 from 04/17/19 14:13:14 and 59 seconds long.
Error trying to create clip for \\NAS\TeslaCam\2019-04-17_14-17-25\2019-04-17_14-13. RC: 1
Command: ['C:\\Users\\japhu\\Videos\\TeslaCam\\ffmpeg.exe', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-13-left_repeater.mp4', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-13-front.mp4', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-13-right_repeater.mp4', '-filter_complex', "color=duration=59.86:s=1280x960:c=black [base];[0:v] setpts=PTS-STARTPTS, scale=640x480  [left];[1:v] setpts=PTS-STARTPTS, scale=640x480  [front];[2:v] setpts=PTS-STARTPTS, scale=640x480  [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=C\\:\\Windows\\Fonts\\arial.ttf:fontcolor=white:fontsize=16:borderw=2:[email protected]:x=(w/2-text_w/2):y=(h-(text_h*2)):text='%{pts\\:localtime\\:1555528394\\:%x %X}'", '-preset', 'medium', '-crf', '28', '-c:v', 'libx264', '-y', '\\\\NAS\\TeslaCam\\Output\\2019-04-17_14-13.mp4']
Error: b"ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers\r\n  built with gcc 8.2.1 (GCC) 20190212\r\n  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth\r\n  libavutil      56. 22.100 / 56. 22.100\r\n  libavcodec     58. 35.100 / 58. 35.100\r\n  libavformat    58. 20.100 / 58. 20.100\r\n  libavdevice    58.  5.100 / 58.  5.100\r\n  libavfilter     7. 40.101 /  7. 40.101\r\n  libswscale      5.  3.100 /  5.  3.100\r\n  libswresample   3.  3.100 /  3.  3.100\r\n  libpostproc    55.  3.100 / 55.  3.100\r\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-13-left_repeater.mp4':\r\n  Metadata:\r\n    major_brand     : mp42\r\n    minor_version   : 0\r\n    compatible_brands: mp42mp41isomiso2\r\n    creation_time   : 2019-04-17T19:13:14.000000Z\r\n  Duration: 00:00:59.86, start: 0.000000, bitrate: 4006 kb/s\r\n    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4003 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\r\n    Metadata:\r\n      creation_time   : 2019-04-17T19:13:14.000000Z\r\n      handler_name    : VideoHandler\r\n[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a29ff93480] moov atom not found\r\n\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-13-front.mp4: Invalid data found when processing input\r\n"


Processing clip 8/11 from 04/17/19 14:14:15 and 59 seconds long.
Processing clip 9/11 from 04/17/19 14:15:16 and 59 seconds long.
Processing clip 10/11 from 04/17/19 14:16:17 and 59 seconds long.
Processing clip 11/11 from 04/17/19 14:17:17 and 7 seconds long.
Creating movie \\NAS\TeslaCam\Output\2019-04-17_14-17-25.mp4, please be patient.
Movie \\NAS\TeslaCam\Output\2019-04-17_14-17-25.mp4 has been created, enjoy.


----------



## ehendrix23

japhule said:


> I was able to run this latest beta across several subfolders. It didn't like one of the subfolders, causing it to stop completely. If I run the same folder using the previous beta, I do get an error but it skips the problem files and goes on to the next file and completes.
> 
> From latest beta
> 
> 
> Code:
> 
> 
> Processing 11 clips in folder \\NAS\TeslaCam\Scan\2019-04-17_14-17-25 (5/6)
> Processing clip 1/11 from 04/17/19 14:07:08 and 59 seconds long.
> Processing clip 2/11 from 04/17/19 14:08:09 and 59 seconds long.
> Processing clip 3/11 from 04/17/19 14:09:10 and 60 seconds long.
> Processing clip 4/11 from 04/17/19 14:10:11 and 60 seconds long.
> Processing clip 5/11 from 04/17/19 14:11:12 and 59 seconds long.
> Traceback (most recent call last):
> File "tesla_dashcam\tesla_dashcam.py", line 1444, in <module>
> File "tesla_dashcam\tesla_dashcam.py", line 1440, in main
> File "tesla_dashcam\tesla_dashcam.py", line 716, in process_folders
> File "tesla_dashcam\tesla_dashcam.py", line 448, in create_intermediate_movie
> UnboundLocalError: local variable 'camera_1' referenced before assignment
> [7496] Failed to execute script tesla_dashcam
> 
> From previous beta
> 
> 
> Code:
> 
> 
> Processing clip 1/11 from 04/17/19 14:07:08 and 59 seconds long.
> Processing clip 2/11 from 04/17/19 14:08:09 and 59 seconds long.
> Processing clip 3/11 from 04/17/19 14:09:10 and 60 seconds long.
> Processing clip 4/11 from 04/17/19 14:10:11 and 60 seconds long.
> Processing clip 5/11 from 04/17/19 14:11:12 and 59 seconds long.
> Error trying to create clip for \\NAS\TeslaCam\2019-04-17_14-17-25\2019-04-17_14-11. RC: 1
> Command: ['C:\\Users\\japhu\\Videos\\TeslaCam\\ffmpeg.exe', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-11-left_repeater.mp4', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-11-front.mp4', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-11-right_repeater.mp4', '-filter_complex', "color=duration=59.83:s=1280x960:c=black [base];[0:v] setpts=PTS-STARTPTS, scale=640x480  [left];[1:v] setpts=PTS-STARTPTS, scale=640x480  [front];[2:v] setpts=PTS-STARTPTS, scale=640x480  [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=C\\:\\Windows\\Fonts\\arial.ttf:fontcolor=white:fontsize=16:borderw=2:[email protected]:x=(w/2-text_w/2):y=(h-(text_h*2)):text='%{pts\\:localtime\\:1555528272\\:%x %X}'", '-preset', 'medium', '-crf', '28', '-c:v', 'libx264', '-y', '\\\\NAS\\TeslaCam\\Output\\2019-04-17_14-11.mp4']
> Error: b"ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers\r\n  built with gcc 8.2.1 (GCC) 20190212\r\n  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth\r\n  libavutil      56. 22.100 / 56. 22.100\r\n  libavcodec     58. 35.100 / 58. 35.100\r\n  libavformat    58. 20.100 / 58. 20.100\r\n  libavdevice    58.  5.100 / 58.  5.100\r\n  libavfilter     7. 40.101 /  7. 40.101\r\n  libswscale      5.  3.100 /  5.  3.100\r\n  libswresample   3.  3.100 /  3.  3.100\r\n  libpostproc    55.  3.100 / 55.  3.100\r\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-11-left_repeater.mp4':\r\n  Metadata:\r\n    major_brand     : mp42\r\n    minor_version   : 0\r\n    compatible_brands: mp42mp41isomiso2\r\n    creation_time   : 2019-04-17T19:11:12.000000Z\r\n  Duration: 00:00:59.83, start: 0.000000, bitrate: 4009 kb/s\r\n    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4005 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\r\n    Metadata:\r\n      creation_time   : 2019-04-17T19:11:12.000000Z\r\n      handler_name    : VideoHandler\r\nInput #1, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-11-front.mp4':\r\n  Metadata:\r\n    major_brand     : mp42\r\n    minor_version   : 0\r\n    compatible_brands: mp42mp41isomiso2\r\n    creation_time   : 2019-04-17T19:11:12.000000Z\r\n  Duration: 00:00:59.83, start: 0.000000, bitrate: 4008 kb/s\r\n    Stream #1:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4005 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\r\n    Metadata:\r\n      creation_time   : 2019-04-17T19:11:12.000000Z\r\n      handler_name    : VideoHandler\r\n[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a00869be80] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!\r\n[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a00869be80] moov atom not found\r\n\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-11-right_repeater.mp4: Invalid data found when processing input\r\n"
> 
> 
> Processing clip 6/11 from 04/17/19 14:12:13 and 60 seconds long.
> Error trying to create clip for \\NAS\TeslaCam\2019-04-17_14-17-25\2019-04-17_14-12. RC: 1
> Command: ['C:\\Users\\japhu\\Videos\\TeslaCam\\ffmpeg.exe', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-12-left_repeater.mp4', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-12-front.mp4', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-12-right_repeater.mp4', '-filter_complex', "color=duration=60.05:s=1280x960:c=black [base];[0:v] setpts=PTS-STARTPTS, scale=640x480  [left];[1:v] setpts=PTS-STARTPTS, scale=640x480  [front];[2:v] setpts=PTS-STARTPTS, scale=640x480  [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=C\\:\\Windows\\Fonts\\arial.ttf:fontcolor=white:fontsize=16:borderw=2:[email protected]:x=(w/2-text_w/2):y=(h-(text_h*2)):text='%{pts\\:localtime\\:1555528333\\:%x %X}'", '-preset', 'medium', '-crf', '28', '-c:v', 'libx264', '-y', '\\\\NAS\\TeslaCam\\Output\\2019-04-17_14-12.mp4']
> Error: b"ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers\r\n  built with gcc 8.2.1 (GCC) 20190212\r\n  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth\r\n  libavutil      56. 22.100 / 56. 22.100\r\n  libavcodec     58. 35.100 / 58. 35.100\r\n  libavformat    58. 20.100 / 58. 20.100\r\n  libavdevice    58.  5.100 / 58.  5.100\r\n  libavfilter     7. 40.101 /  7. 40.101\r\n  libswscale      5.  3.100 /  5.  3.100\r\n  libswresample   3.  3.100 /  3.  3.100\r\n  libpostproc    55.  3.100 / 55.  3.100\r\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-12-left_repeater.mp4':\r\n  Metadata:\r\n    major_brand     : mp42\r\n    minor_version   : 0\r\n    compatible_brands: mp42mp41isomiso2\r\n    creation_time   : 2019-04-17T19:12:13.000000Z\r\n  Duration: 00:01:00.05, start: 0.000000, bitrate: 4008 kb/s\r\n    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4004 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\r\n    Metadata:\r\n      creation_time   : 2019-04-17T19:12:13.000000Z\r\n      handler_name    : VideoHandler\r\n[mov,mp4,m4a,3gp,3g2,mj2 @ 0000017e1a5034c0] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!\r\n[mov,mp4,m4a,3gp,3g2,mj2 @ 0000017e1a5034c0] moov atom not found\r\n\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-12-front.mp4: Invalid data found when processing input\r\n"
> 
> 
> Processing clip 7/11 from 04/17/19 14:13:14 and 59 seconds long.
> Error trying to create clip for \\NAS\TeslaCam\2019-04-17_14-17-25\2019-04-17_14-13. RC: 1
> Command: ['C:\\Users\\japhu\\Videos\\TeslaCam\\ffmpeg.exe', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-13-left_repeater.mp4', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-13-front.mp4', '-i', '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-13-right_repeater.mp4', '-filter_complex', "color=duration=59.86:s=1280x960:c=black [base];[0:v] setpts=PTS-STARTPTS, scale=640x480  [left];[1:v] setpts=PTS-STARTPTS, scale=640x480  [front];[2:v] setpts=PTS-STARTPTS, scale=640x480  [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=C\\:\\Windows\\Fonts\\arial.ttf:fontcolor=white:fontsize=16:borderw=2:[email protected]:x=(w/2-text_w/2):y=(h-(text_h*2)):text='%{pts\\:localtime\\:1555528394\\:%x %X}'", '-preset', 'medium', '-crf', '28', '-c:v', 'libx264', '-y', '\\\\NAS\\TeslaCam\\Output\\2019-04-17_14-13.mp4']
> Error: b"ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers\r\n  built with gcc 8.2.1 (GCC) 20190212\r\n  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth\r\n  libavutil      56. 22.100 / 56. 22.100\r\n  libavcodec     58. 35.100 / 58. 35.100\r\n  libavformat    58. 20.100 / 58. 20.100\r\n  libavdevice    58.  5.100 / 58.  5.100\r\n  libavfilter     7. 40.101 /  7. 40.101\r\n  libswscale      5.  3.100 /  5.  3.100\r\n  libswresample   3.  3.100 /  3.  3.100\r\n  libpostproc    55.  3.100 / 55.  3.100\r\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-13-left_repeater.mp4':\r\n  Metadata:\r\n    major_brand     : mp42\r\n    minor_version   : 0\r\n    compatible_brands: mp42mp41isomiso2\r\n    creation_time   : 2019-04-17T19:13:14.000000Z\r\n  Duration: 00:00:59.86, start: 0.000000, bitrate: 4006 kb/s\r\n    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4003 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\r\n    Metadata:\r\n      creation_time   : 2019-04-17T19:13:14.000000Z\r\n      handler_name    : VideoHandler\r\n[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a29ff93480] moov atom not found\r\n\\\\NAS\\TeslaCam\\2019-04-17_14-17-25\\2019-04-17_14-13-front.mp4: Invalid data found when processing input\r\n"
> 
> 
> Processing clip 8/11 from 04/17/19 14:14:15 and 59 seconds long.
> Processing clip 9/11 from 04/17/19 14:15:16 and 59 seconds long.
> Processing clip 10/11 from 04/17/19 14:16:17 and 59 seconds long.
> Processing clip 11/11 from 04/17/19 14:17:17 and 7 seconds long.
> Creating movie \\NAS\TeslaCam\Output\2019-04-17_14-17-25.mp4, please be patient.
> Movie \\NAS\TeslaCam\Output\2019-04-17_14-17-25.mp4 has been created, enjoy.


Thank you!!!! Found the issue and will be fixed in next beta version. Probably be tomorrow, got 1 more change I want to see to put in and hopefully GDN has been able to replicate the issue then as well and report back (and me fixing it).


----------



## ehendrix23

ehendrix23 said:


> For those willing to test ... a new test release is available (v0.1.9b0). Following improvements have been done:
> 
> - Added scanning of sub-folders clip files. Each folder will be processed and resulting movie file created. This can be disabled through parameter --exclude_subdirs
> - Added option to merge the video files from multiple sub-folders into 1 movie file. Use parameter --merge to enable.
> - Added option to monitor if the USB drive (or SD card) is inserted in the PC and then automatically start processing the files. Use parameter --monitor to enable.
> Parameter --monitor_once will stop monitoring and exit after 1st time drive was inserted.
> Parameter --delete_source will delete the source files and folder once the movie file for that folder has been created.
> - Will now check if a new update is available, additional arguments to just perform check (--check_for_update), include test releases (--include_test), or disable always checking for updates (--no-check_for_update)
> - Formatted output to easily show progress
> - Time it took to create the video files will now be provided upon completion of processing.
> - Will now handle it much better if a video file from a camera is corrupt (i.e. zero-byte file).
> 
> This is a test release and not everything has been fully vetted yet. MacOS DMG and Windows ZIP with binaries are available as well.
> You can download it here: Release v0.1.9b0 - BETA release
> 
> Thx.


New test release available: Release v0.1.9b1 - BETA release

Following are the updates:

Fixed:

Issue #12 when front camera is missing or corrupt.
Issue #13, selecting --gpu on Windows or Linux fails with KeyError error.
Checking for updates improved to ensure newer version and not just mismatch in version numbers.
Recurring message on monitor that TeslaCam folder was fond
Final movie would not be created if multiple folders were discovered but only 1 clip ended up being created.
New:

Added system notification for when processing starts (when monitoring) and completes.
Icon for tesla_dashcam
Print notification on deleting source files/folder
FFmpeg executable is now part of tesla_dashcam executable, no need for separate ffmpeg required in the bundle (one can still provide path to own ffmpeg).
Changed:

Monitor sleep changed from 60 seconds to 5 seconds
Improved messaging related to ejecting of drive and monitoring

If no issues then will release as v0.1.9 by the end of this week.


----------



## UltralightBeam

If I'm unfamiliar with setting this up via Terminal (on Mac), should I bother requesting the exact directions and locations to place the files etc? Or just wait for the stand alone desktop app? (if this is something that will be potentially a thing in the near future.)


----------



## MelindaV

UltralightBeam said:


> If I'm unfamiliar with setting this up via Terminal (on Mac), should I bother requesting the exact directions and locations to place the files etc? Or just wait for the stand alone desktop app? (if this is something that will be potentially a thing in the near future.)


there is a thread with an Automator workflow using @ehendrix23's script to make it pretty user friendly (on a mac).


----------



## ehendrix23

UltralightBeam said:


> If I'm unfamiliar with setting this up via Terminal (on Mac), should I bother requesting the exact directions and locations to place the files etc? Or just wait for the stand alone desktop app? (if this is something that will be potentially a thing in the near future.)


GUI front-end is coming but no ETA. 

Wait for 0.1.9 (I'll be releasing it soon, just waiting a bit for other folks to do some testing ensuring no issues). Then download it, you will download the DMG file.
Open the DMG on your Mac with Finder.
Drag&Drop tesla_dashcam from the DMG to your Applications folder.

Up till now, all pretty similar as you would do for certain applications on Mac.

Now, open Terminal.
Enter */Applications/tesla_dashcam -h* to get the help.

Most simple to run it:
*/Applications/tesla_dashcam --monitor_once --output ~/Desktop/Movies SavedClips*

That will find the USB drive, and once found create the clips from the SavedClips folder on the USB drive. Resulting file(s) will be stored in ~/Desktop/Movies. 
It will wait if the USB drive is not plugged in.

To also have it delete the files on your USB drive once it has processed them:
*/Applications/tesla_dashcam --monitor_once --delete_source --output ~/Desktop/Movies SavedClips*

And, if you want it to keep on monitoring. This means you can open Terminal, run the below command and then just leave it sitting there. It will process the files from your USB, notify you when done. You can then eject the drive, and put it back in your car. Then next time you plug it back in it will just start processing new ones again:
*/Applications/tesla_dashcam --monitor --delete_source --output ~/Desktop/Movies SavedClips*

Also check out the README file as is has a number of examples.


----------



## UltralightBeam

Awesome! I'll give this a try when the 1.9 version comes out!


----------



## MJJ

Just in case anyone has an older system, it appears you can't install the dependencies on MacOS 10.8 or older. Shucks! 

I hate planned obsolescence.


----------



## ehendrix23

MJJ said:


> Just in case anyone has an older system, it appears you can't install the dependencies on MacOS 10.8 or older. Shucks!
> 
> I hate planned obsolescence.


Can you provide the error or issue you see?

Sent from my iPhone using Tapatalk


----------



## MJJ

ehendrix23 said:


> Can you provide the error or issue you see?


I can do some screen shots tonight, but it seems clear that ffmpeg will not work on 10.8 anymore.

There are some explanations online that seem like they might work, but it involves installing SO MANY prerequisites that I'm just not up to it.

I'm thinking about converting that iMac to a Linux box because virtually nothing is supported on it anymore. Which is a shame as it is still a great unit.


----------



## japhule

Having issues with the latest beta when dealing with bad files. The previous beta would stop completely. This latest beta would continue past the problem files, but when it came time to combine all the videos it would error.



Code:


Processing clip 11/11 from 04/17/19 14:17:17 and 7 seconds long.
                Creating movie \\NAS\TeslaCam\Scan\2019-04-17_14-17-25.mp4, please be patient.
                Error trying to create movie \\NAS\TeslaCam\Scan\2019-04-17_14-17-25.mp4. RC: 1
                Command: ['C:\\Users\\japhu\\AppData\\Local\\Temp\\_MEI206682\\ffmpeg.exe', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-07.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-08.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-09.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-10.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-11.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-12.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-13.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-14.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-15.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-16.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-17.mp4', '-filter_complex', '[0:v:0] [1:v:0] [2:v:0] [3:v:0] [4:v:0] [5:v:0] [6:v:0] [7:v:0] [8:v:0] [9:v:0] [10:v:0] concat=n=11:v=1:a=0 [v]', '-map', '[v]', '-c:v', 'libx264', '-preset', 'medium', '-crf', '28', '-y', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-17-25.mp4']
                Error: b"ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers\r\n  built with gcc 8.2.1 (GCC) 20190212\r\n  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth\r\n  libavutil      56. 22.100 / 56. 22.100\r\n  libavcodec     58. 35.100 / 58. 35.100\r\n  libavformat    58. 20.100 / 58. 20.100\r\n  libavdevice    58.  5.100 / 58.  5.100\r\n  libavfilter     7. 40.101 /  7. 40.101\r\n  libswscale      5.  3.100 /  5.  3.100\r\n  libswresample   3.  3.100 /  3.  3.100\r\n  libpostproc    55.  3.100 / 55.  3.100\r\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-07.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:59.88, start: 0.000000, bitrate: 424 kb/s\r\n    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 422 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #1, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-08.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:59.92, start: 0.000000, bitrate: 370 kb/s\r\n    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 368 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #2, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-09.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:01:00.24, start: 0.000000, bitrate: 424 kb/s\r\n    Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 422 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #3, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-10.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:01:00.16, start: 0.000000, bitrate: 386 kb/s\r\n    Stream #3:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 384 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #4, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-11.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:59.84, start: 0.000000, bitrate: 243 kb/s\r\n    Stream #4:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 240 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #5, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-12.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:00.00, bitrate: N/A\r\nInput #6, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-13.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:00.00, bitrate: N/A\r\nInput #7, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-14.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:59.72, start: 0.000000, bitrate: 381 kb/s\r\n    Stream #7:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 378 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #8, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-15.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:59.80, start: 0.000000, bitrate: 384 kb/s\r\n    Stream #8:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 382 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #9, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-16.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:59.56, start: 0.000000, bitrate: 469 kb/s\r\n    Stream #9:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 467 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #10, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-17.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:07.44, start: 0.000000, bitrate: 394 kb/s\r\n    Stream #10:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 391 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nStream specifier ':v:0' in filtergraph description [0:v:0] [1:v:0] [2:v:0] [3:v:0] [4:v:0] [5:v:0] [6:v:0] [7:v:0] [8:v:0] [9:v:0] [10:v:0] concat=n=11:v=1:a=0 [v] matches no streams.\r\n"


----------



## ehendrix23

japhule said:


> Having issues with the latest beta when dealing with bad files. The previous beta would stop completely. This latest beta would continue past the problem files, but when it came time to combine all the videos it would error.
> 
> 
> 
> Code:
> 
> 
> Processing clip 11/11 from 04/17/19 14:17:17 and 7 seconds long.
> Creating movie \\NAS\TeslaCam\Scan\2019-04-17_14-17-25.mp4, please be patient.
> Error trying to create movie \\NAS\TeslaCam\Scan\2019-04-17_14-17-25.mp4. RC: 1
> Command: ['C:\\Users\\japhu\\AppData\\Local\\Temp\\_MEI206682\\ffmpeg.exe', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-07.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-08.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-09.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-10.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-11.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-12.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-13.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-14.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-15.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-16.mp4', '-i', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-17.mp4', '-filter_complex', '[0:v:0] [1:v:0] [2:v:0] [3:v:0] [4:v:0] [5:v:0] [6:v:0] [7:v:0] [8:v:0] [9:v:0] [10:v:0] concat=n=11:v=1:a=0 [v]', '-map', '[v]', '-c:v', 'libx264', '-preset', 'medium', '-crf', '28', '-y', '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-17-25.mp4']
> Error: b"ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers\r\n  built with gcc 8.2.1 (GCC) 20190212\r\n  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth\r\n  libavutil      56. 22.100 / 56. 22.100\r\n  libavcodec     58. 35.100 / 58. 35.100\r\n  libavformat    58. 20.100 / 58. 20.100\r\n  libavdevice    58.  5.100 / 58.  5.100\r\n  libavfilter     7. 40.101 /  7. 40.101\r\n  libswscale      5.  3.100 /  5.  3.100\r\n  libswresample   3.  3.100 /  3.  3.100\r\n  libpostproc    55.  3.100 / 55.  3.100\r\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-07.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:59.88, start: 0.000000, bitrate: 424 kb/s\r\n    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 422 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #1, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-08.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:59.92, start: 0.000000, bitrate: 370 kb/s\r\n    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 368 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #2, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-09.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:01:00.24, start: 0.000000, bitrate: 424 kb/s\r\n    Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 422 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #3, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-10.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:01:00.16, start: 0.000000, bitrate: 386 kb/s\r\n    Stream #3:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 384 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #4, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-11.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:59.84, start: 0.000000, bitrate: 243 kb/s\r\n    Stream #4:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 240 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #5, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-12.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:00.00, bitrate: N/A\r\nInput #6, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-13.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:00.00, bitrate: N/A\r\nInput #7, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-14.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:59.72, start: 0.000000, bitrate: 381 kb/s\r\n    Stream #7:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 378 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #8, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-15.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:59.80, start: 0.000000, bitrate: 384 kb/s\r\n    Stream #8:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 382 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #9, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-16.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:59.56, start: 0.000000, bitrate: 469 kb/s\r\n    Stream #9:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 467 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nInput #10, mov,mp4,m4a,3gp,3g2,mj2, from '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-17.mp4':\r\n  Metadata:\r\n    major_brand     : isom\r\n    minor_version   : 512\r\n    compatible_brands: isomiso2avc1mp41\r\n    encoder         : Lavf58.20.100\r\n  Duration: 00:00:07.44, start: 0.000000, bitrate: 394 kb/s\r\n    Stream #10:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 391 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\r\n    Metadata:\r\n      handler_name    : VideoHandler\r\nStream specifier ':v:0' in filtergraph description [0:v:0] [1:v:0] [2:v:0] [3:v:0] [4:v:0] [5:v:0] [6:v:0] [7:v:0] [8:v:0] [9:v:0] [10:v:0] concat=n=11:v=1:a=0 [v] matches no streams.\r\n"


I might have found the potential issue but not sure. 
Looks like '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-12.mp4 has a duration of 0 and that might then cause the issue. This would mean that the camera files for that timestamp would have 0 duration as well (or at least 1 with 2 others empty or so). 
As you're on windows, I've created a temporary windows executable with hopefully the fix for this. This is based on v0.1.9b2 but then with a check to skip video files that have a duration of 0.

Here is the link to download this temporary version: tesla_dashcam_190b3.exe

Let me know if this fixes the problem or not. If not, please provide me complete output and also check for any 0 byte files or extreme small files.

Thx.


----------



## MJJ

ehendrix23 said:


> Can you provide the error or issue you see


So I was trying to install ffmpeg 5. I think I got ffmpeg 4 to install last night. Will be a couple of days b fore I can try your script with it.


----------



## japhule

ehendrix23 said:


> I might have found the potential issue but not sure.
> Looks like '\\\\NAS\\TeslaCam\\Scan\\2019-04-17_14-12.mp4 has a duration of 0 and that might then cause the issue. This would mean that the camera files for that timestamp would have 0 duration as well (or at least 1 with 2 others empty or so).
> As you're on windows, I've created a temporary windows executable with hopefully the fix for this. This is based on v0.1.9b2 but then with a check to skip video files that have a duration of 0.
> 
> Here is the link to download this temporary version: tesla_dashcam_190b3.exe
> 
> Let me know if this fixes the problem or not. If not, please provide me complete output and also check for any 0 byte files or extreme small files.
> 
> Thx.


Looks like I'm getting the same error. I'll PM you the full log. Looking into the problem files, they appear to be normal 30mb files but they don't seem to play, probably corrupt.


----------



## ehendrix23

japhule said:


> Looks like I'm getting the same error. I'll PM you the full log. Looking into the problem files, they appear to be normal 30mb files but they don't seem to play, probably corrupt.


Thanks for the log. I had part of the solution but not complete. Was able to reproduce it though by making a change in the code resulting in same issue. And using that get a fix for it. 
I've updated the exe file with the fix: tesla_dashcam_190b3.exe. Same filename but updated, just download this newer version and test it.

Thx.


----------



## Spinball

ehendrix23 said:


> Weird, I tested it on Windows 10 and path specified for font was working fine.
> 
> Can you try with the latest version?


There still seems to be an issue with fonts for me on Windows 7.

I was using 1.9b1 today and still getting a font error when using the exe without the command line. However if I use the command line with argument 


Code:


--font /Windows/Fonts/arial.ttf

it will work without issue. Same as what I had to enter previously into the python script.

Whereas using 


Code:


--font C:\Windows\Fonts\arial.ttf

does NOT work. It's odd that ffmpeg expects forward slashes for the path even on Windows.


----------



## japhule

ehendrix23 said:


> Thanks for the log. I had part of the solution but not complete. Was able to reproduce it though by making a change in the code resulting in same issue. And using that get a fix for it.
> I've updated the exe file with the fix: tesla_dashcam_190b3.exe. Same filename but updated, just download this newer version and test it.
> 
> Thx.


Ok. This looks fixed. Video file is now being created properly.


----------



## ehendrix23

Just released 0.1.9.

Biggest change is the ability for it to scan all subfolders and create the merged video files, and by having it monitor for the USB (or SD) card to be inserted and then automatically start processing.
This means that it could be setup to have it just run continuously, and anytime the Tesla DashCam USB (or SD) is inserted it will start creating the merged video files, and upon completion provide a notification.

This version will now also check for new releases, and inform if a new release is available.

List of changes:
- Added scanning of sub-folders clip files. Each folder will be processed and resulting movie file created. This can be disabled through parameter --exclude_subdirs
- Added option to merge the video files from multiple sub-folders into 1 movie file. Use parameter --merge to enable.
- Added option to monitor if the USB drive (or SD card) is inserted in the PC and then automatically start processing the files. Use parameter --monitor to enable.
Parameter --monitor_once will stop monitoring and exit after 1st time drive was inserted.
Parameter --delete_source will delete the source files and folder once the movie file for that folder has been created.
- Added update checker to determine if there is a newer version, additional arguments to just perform check (--check_for_update), include test releases (--include_test), or disable always checking for updates (--no-check_for_update)
- Formatted output to easily show progress
- Time it took to create the video files will now be provided upon completion of processing.
- Will now handle it much better if a video file from a camera is corrupt (i.e. zero-byte file).
- ffmpeg is part of the tesla_dashcam executable
- Desktop notification when processing starts (when using monitor) and when it completes.
- DockerFile added making it easy to run tesla_dashcam within Docker (jeanfabrice)
- Fixed: combining clips to movie would not use GPU or provided encoding.
- Added additional check that video file exist before merging into movie.

MacOS and Windows executables can be downloaded here: https://github.com/ehendrix23/tesla_dashcam/releases/tag/v0.1.9
For Linux, Python package can be retrieved from pypi using pip (https://pypi.org/project/tesla-dashcam/)

Source is also available: https://github.com/ehendrix23/tesla_dashcam/releases/tag/v0.1.9

See README file that is included for all options and how to use it.


----------



## ehendrix23

Spinball said:


> There still seems to be an issue with fonts for me on Windows 7.
> 
> I was using 1.9b1 today and still getting a font error when using the exe without the command line. However if I use the command line with argument
> 
> 
> Code:
> 
> 
> --font /Windows/Fonts/arial.ttf
> 
> it will work without issue. Same as what I had to enter previously into the python script.
> 
> Whereas using
> 
> 
> Code:
> 
> 
> --font C:\Windows\Fonts\arial.ttf
> 
> does NOT work. It's odd that ffmpeg expects forward slashes for the path even on Windows.


Just to confirm, there is a C:\Windows\Fonts\arial.ttf right? It's not like you have Windows installed on a different drive or so?

What happens if you run from command line without --font? Same font error?

Just now running it with --font c:\Windows\Fonts\Cambria.ttf and it works on Windows 10 for me.


----------



## THX723

@ehendrix23 Great work! Have an odd request ... would you consider adding support for single-cam only output with time-stamp? Sometimes the other view(s) are not needed for insurance purpose (my current situation) and greatly reduces the file size, where time-stamping is very much needed. Bravo either way.


----------



## ehendrix23

THX723 said:


> @ehendrix23 Great work! Have an odd request ... would you consider adding support for single-cam only output with time-stamp? Sometimes the other view(s) are not needed for insurance purpose (my current situation) and greatly reduces the file size, where time-stamping is very much needed. Bravo either way.


Thx. Makes sense. Having seen other share videos, I think makes even more to identify the cameras wishing to be seen. For example, just front, or front and left, front and right, left and right.

Will see how to best do this, based on changes might then also include scaling or so as well.

Sent from my iPhone using Tapatalk


----------



## THX723

ehendrix23 said:


> Thx. Makes sense. Having seen other share videos, I think makes even more to identify the cameras wishing to be seen. For example, just front, or front and left, front and right, left and right.
> 
> Will see how to best do this, based on changes might then also include scaling or so as well.
> 
> Sent from my iPhone using Tapatalk


Excellent. Glad you're on-board.


----------



## Spinball

ehendrix23 said:


> Just to confirm, there is a C:\Windows\Fonts\arial.ttf right? It's not like you have Windows installed on a different drive or so?
> 
> What happens if you run from command line without --font? Same font error


Yes the path to arial.ttf is valid. Same command without -font gives the same font config error.


----------



## ATechGuy

ehendrix23 said:


> Just released 0.1.9.
> 
> Biggest change is the ability for it to scan all subfolders and create the merged video files, and by having it monitor for the USB (or SD) card to be inserted and then automatically start processing.
> This means that it could be setup to have it just run continuously, and anytime the Tesla DashCam USB (or SD) is inserted it will start creating the merged video files, and upon completion provide a notification.
> 
> This version will now also check for new releases, and inform if a new release is available.
> 
> List of changes:
> - Added scanning of sub-folders clip files. Each folder will be processed and resulting movie file created. This can be disabled through parameter --exclude_subdirs
> - Added option to merge the video files from multiple sub-folders into 1 movie file. Use parameter --merge to enable.
> - Added option to monitor if the USB drive (or SD card) is inserted in the PC and then automatically start processing the files. Use parameter --monitor to enable.
> Parameter --monitor_once will stop monitoring and exit after 1st time drive was inserted.
> Parameter --delete_source will delete the source files and folder once the movie file for that folder has been created.
> - Added update checker to determine if there is a newer version, additional arguments to just perform check (--check_for_update), include test releases (--include_test), or disable always checking for updates (--no-check_for_update)
> - Formatted output to easily show progress
> - Time it took to create the video files will now be provided upon completion of processing.
> - Will now handle it much better if a video file from a camera is corrupt (i.e. zero-byte file).
> - ffmpeg is part of the tesla_dashcam executable
> - Desktop notification when processing starts (when using monitor) and when it completes.
> - DockerFile added making it easy to run tesla_dashcam within Docker (jeanfabrice)
> - Fixed: combining clips to movie would not use GPU or provided encoding.
> - Added additional check that video file exist before merging into movie.
> 
> MacOS and Windows executables can be downloaded here: https://github.com/ehendrix23/tesla_dashcam/releases/tag/v0.1.9
> For Linux, Python package can be retrieved from pypi using pip (https://pypi.org/project/tesla-dashcam/)
> 
> Source is also available: https://github.com/ehendrix23/tesla_dashcam/releases/tag/v0.1.9
> 
> See README file that is included for all options and how to use it.


This app ROCKS. I'm running it on MACOS 10.12 and have had no issues. I was just running it on a "folder". When you get a great program like this, I know the last thing you want to hear "suggestions", but if I had to toss one in the hat, I would ask for an MP4 "marker" between each clip you merge together in a folder. That way, you could "fast forward" from clip to clip. When I say "clip", I mean the collection of the three. So if you're trying to view through an hour, you could just advance by index/chapters instead of by just moving your movie player slider along. Yeah, I know, very minor suggestion. but this is great as it is. Thanks for writing this.


----------



## langolier

Should someone who has no idea what you all are talking about be able to somehow open something that would show the videos that you describe?

All I can get is a .dmg that contains 'tesla_dashcam' (exec), ffmpeg (exec), filmpeg_LICENSE.txt, LICENSE.txt and README.html.

The first two just open Terminal. Should I be able to run something from this?

Sorry to be so dense. thanks.


----------



## ehendrix23

Spinball said:


> Yes the path to arial.ttf is valid. Same command without -font gives the same font config error.


Had someone else with Windows 8.1 with similar issue. I changed the default to /Windows/Fonts/arial.ttf instead as that works for you, the other person, and works on mine as well. 0.1.10 will have it in there.


----------



## ehendrix23

ATechGuy said:


> This app ROCKS. I'm running it on MACOS 10.12 and have had no issues. I was just running it on a "folder". When you get a great program like this, I know the last thing you want to hear "suggestions", but if I had to toss one in the hat, I would ask for an MP4 "marker" between each clip you merge together in a folder. That way, you could "fast forward" from clip to clip. When I say "clip", I mean the collection of the three. So if you're trying to view through an hour, you could just advance by index/chapters instead of by just moving your movie player slider along. Yeah, I know, very minor suggestion. but this is great as it is. Thanks for writing this.


Thank you. 

Bunch of features and options in it are based on feedback being provided, so keep it coming. . Just today someone asked for option to be able to provide multiple individual files instead of a folder. Got it in there for next release (with also option for multiple folders). Earlier someone asked for option to scale (as currently I scale the clips down but they wanted full resolution), next release has it. Someone asked for ability to have it only grab certain cameras (i.e. only left and front), next release will have it. 

I did a quick check and it looks to be possible to add chapter markers. Here is a question though. At what points should the chapter markers be?
If processing a single folder then it could be for each "minute". But what when processing multiple folders (i.e. everything under SavedClips)? Still every minute? Or a chapter marker for each folder then?

Would appreciate your input in this.


----------



## ehendrix23

langolier said:


> Should someone who has no idea what you all are talking about be able to somehow open something that would show the videos that you describe?
> 
> All I can get is a .dmg that contains 'tesla_dashcam' (exec), ffmpeg (exec), filmpeg_LICENSE.txt, LICENSE.txt and README.html.
> 
> The first two just open Terminal. Should I be able to run something from this?
> 
> Sorry to be so dense. thanks.


Based on contents of DMG file looks like you have a bit older version. So get the latest version here: https://github.com/ehendrix23/tesla_dashcam/releases/download/v0.1.9/tesla_dashcam.dmg

Open the README.html file in a browser as it has a bunch of examples.

On a Mac:
1. Drag&Drop tesla_dashcam to /Applications folder
2. Open Terminal (Type in Terminal in Spotlight to open it).
3. Absolute easiest to run it right now, type in following command (or just copy&paste) in Terminal: /Applications/tesla_dashcam --monitor_once --output ~/Movies SavedClips
4. Insert USB fob (or SD card).

This will take the default layout etc. (see README for other layouts). What this will do is that it will sit there waiting for a disk to be inserted (your USB fob or SD card) that has the TeslaCam folder. Once it detects it, processing will start automatically. It will create a video file for each folder within the SavedClips on your TeslaCam drive, the resulting video will be stored in your Movies folder on your Mac with the name same as the original folder (hence timestamp). Once it has completed processing all the program will quit.

If you are comfortable, you can have it delete the files and folder from your USB drive as well once it has processed them. Use the following command in Terminal for that:
/Applications/tesla_dashcam --monitor_once --delete_source --output ~/Movies SavedClips

You can also make it so that after processing it will just sit there waiting till you eject it and then insert it again later (like after your next drive). That way after entering the command you can just minimize that Terminal window and not have to enter the command each time (at least until you reboot or so). Following is what to type then instead:
/Applications/tesla_dashcam --monitor --delete_source --output ~/Movies SavedClips

The README file has a number of other examples. Putting together a GUI is in plan as well (together with a number of other features).

Feel free to ask for help as you did.


----------



## japhule

This has been working great for me. I usually move several savedclips folders into a path and then execute this over that path. In situations when there's only one savedclips folder in the path that gets scanned, it will name the video file after the root folder instead of the actual folder name where the video files were from. Can you update this to name it the proper folder name?


----------



## ehendrix23

japhule said:


> This has been working great for me. I usually move several savedclips folders into a path and then execute this over that path. In situations when there's only one savedclips folder in the path that gets scanned, it will name the video file after the root folder instead of the actual folder name where the video files were from. Can you update this to name it the proper folder name?


Making sure I have it right. You run it over multiple folders, and each created movie is based on the name of the folder. But if there happens to be only 1 folder then the name is based on the root folder and not the folder name. Got this right?

If so, yeah. Makes sense as now the behavior is a bit weird depending if there is 1 or multiple folders. . 
Will get that changed in next release.

Sent from my iPhone using Tapatalk


----------



## ATechGuy

ehendrix23 said:


> Thank you.
> 
> Bunch of features and options in it are based on feedback being provided, so keep it coming. . Just today someone asked for option to be able to provide multiple individual files instead of a folder. Got it in there for next release (with also option for multiple folders). Earlier someone asked for option to scale (as currently I scale the clips down but they wanted full resolution), next release has it. Someone asked for ability to have it only grab certain cameras (i.e. only left and front), next release will have it.
> 
> I did a quick check and it looks to be possible to add chapter markers. Here is a question though. At what points should the chapter markers be?
> If processing a single folder then it could be for each "minute". But what when processing multiple folders (i.e. everything under SavedClips)? Still every minute? Or a chapter marker for each folder then?
> 
> Would appreciate your input in this.


I was on ly asking for a marker at the beginning of each clip. So, if, say a folder had a full hour of clips (I think they're ten minutes each, right?) then you would have five markers (if you don't include the marker for the first one) I put my thumb drive back into the car last night, so I don't have a folder to look in, but just think marker at the begnning of each "set" of clips. No need to do minute math, I'd say. Just drop a marker at the beginning of each clip group. Thanks. Can't wait to try some of the other new features!


----------



## ATechGuy

langolier said:


> Should someone who has no idea what you all are talking about be able to somehow open something that would show the videos that you describe?
> 
> All I can get is a .dmg that contains 'tesla_dashcam' (exec), ffmpeg (exec), filmpeg_LICENSE.txt, LICENSE.txt and README.html.
> 
> The first two just open Terminal. Should I be able to run something from this?
> 
> Sorry to be so dense. thanks.


I usually skip the part of copying the clips from my thumb drive to my hard drive. I have plenty of space on my thumbdrive, so I generate the merge video there.

If you can't recall any syntax, here's what I suggest. Of course, you'll first need to drag the program (tesla_dashcam) to the applications folder.

1) Use Finder to open the Applications folder and then double-click the tesla_dashcam program. It will open a terminal window and spit out all the syntax and STAY OPEN, so you can use this as a reference. No need to keep checking back here.

2) From Spotlight, look for "Terminal" and open it. It usually starts in your HOME folder, but that really makes no difference.

3) look back at Finder, you should see your thumbdrive mounted. It will have a NAME. Mine (and in unix, case counts!) happens to be called TESLACAM (all upper). So, to access the thumbdrive, it's located at \Volumes\TESLACAM . If you want a list of all mounted volumes, type the command ' mount ' and it will list them. You'll see yours there. This is when you may realize putting a space into a volume name is a P.I.T.A. If you have one, you might want to rename the volume! Unix also is pretty friendly with completing a command line. We'll see how that works next.

4) Assuming you now know how to start the program, and know where to find your drive, it's a snap to start the program with its defaults. Again, with using my thumb drive as my source (and the program puts the resulting clip into the source directory) I start typing:

\Applications\tesla_dashcam \Volumes\TESLACAM\TeslaCam\SavedClips\2019-05-04_ And then I start hitting TAB. You can do this anywhere along the way, and the command line parser will try to complete the command until it hits a point where it's ambiguous. So for example, I will type \Vol and then hit TAB and it will complete it to read \Volumes\ And then I type TE and TAB again. and it fills it out for the drive. I happen to have two partitions on my thumbdrive, one for the cam, the other for my music. You'll then find two folders, RecentClips and SavedClips, so you'll want to drop into one of those folders. For my initial testing, I wanted ALL of RecentClips. that's an hour (I earlier said ten minutes per clip, but I think it's one minute per clip) so there were 61 clips in there. So, if you want to start like I did, just start typing \Appl and hit TAB, then add tesla_dashcam and then \Vol and TAB and just drill down to the name of the folder you want. What's next? Press Enter! And watch it do the magic. It's wonderfully verbose (not too much, just right) and depending on the speed of your Mac, it will chug right through the clips one by one and combine each set of three into one clip. And then in the end, each of those combined clips get merged into one.

5) If you can't figure out the name of the combined clip, just look in finder for the most recent file in the folder where you asked the clips to be combined. There you will find a new file with the name of the folder. that's your video. (It will also be the largest!)


----------



## langolier

Thank you ehendrix23 and ATechGuy. 

With your instructions I was able to see my videos. Not yet comfortable using Terminal but good work.


----------



## afgoody

On a PC, I downloaded the .zip and extracted it. When I double-clicked the .exe a window opened, appeared to run a short script, then the window closed. Upon further reading, it appears there is not a GUI yet, so I tried to run from a cmd prompt in the folder where the .exe is located using "tesla_dashcam.exe -h" and "tesla_dashcam -h", but both return "...not recognized as an internal or external command, operable program or batch file. What am I missing to get started here? Thank you.


----------



## rsf

From your command prompt just use 'tesla_dashcam.exe' by itself and it will show you the options. 
Here is an example command to process videos : *tesla_dashcam* *c:\putvidshere --output c:\putvidshere --no-timestamp --quality HIGH --layout WIDESCREEN --mirror*


----------



## afgoody

Thanks. I had to move the folder with the .exe somewhere other than my desktop. It's working now. Cheers.


----------



## MelindaV

@ehendrix23 - I've been getting something odd a few times (on a mac via terminal, saving clips to the thumb drive 'volumes/TESLACAM/TeslaCam')

often after running the command, 0kb files will begin populating, followed by the popup saying processing has been completed. First I thought it was doing this when a folder does not have front cam clips (something mine has been doing recently). But today, the files within the saved folder had all three cameras, and all were (mostly) the full 1min length without too much distortion in the repeater cameras.

I'll delete the new 0kb files the script created, and run the command again and it proceeds to work correctly.


----------



## ehendrix23

MelindaV said:


> @ehendrix23 - I've been getting something odd a few times (on a mac via terminal, saving clips to the thumb drive 'volumes/TESLACAM/TeslaCam')
> 
> often after running the command, 0kb files will begin populating, followed by the popup saying processing has been completed. First I thought it was doing this when a folder does not have front cam clips (something mine has been doing recently). But today, the files within the saved folder had all three cameras, and all were (mostly) the full 1min length without too much distortion in the repeater cameras.
> 
> I'll delete the new 0kb files the script created, and run the command again and it proceeds to work correctly.


Can you try saving to your local disk instead? Wondering if the thumb drive is having issues when both reading and writing from same drive.

Also, try without GPU acceleration using the --no-gpu parameter maybe it has something to do with that.


----------



## ATechGuy

I thought I saw the same behavior using the Android app. But I think the folder with the clip I was view was really marginal in quality. I wonder why. It seemed the right video was always showing a lot of noise or it wouldn't show anything at all. I don't see that very often when using the laptop to view the clips, so I can't help, but I know I've seen the same when the clip for a certain camera didn't exist, it seemed the app was generating a stub for the camera, and the stub file was 0Kb in size (empty).


----------



## James M

Dumb question, I know the script will combine Left/Front/Right videos, but would it also be possible to concatenate videos where the timestamps are sequential when compared to the length of the videos (ie video A is timestamped "12:00:00" and is ten minutes long and video B is timestamped "12:10:00" -- it would be nice to have this combined into a single video).


----------



## ehendrix23

New test release available: Release v0.1.10b0 - BETA release

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.


----------



## ehendrix23

James M said:


> Dumb question, I know the script will combine Left/Front/Right videos, but would it also be possible to concatenate videos where the timestamps are sequential when compared to the length of the videos (ie video A is timestamped "12:00:00" and is ten minutes long and video B is timestamped "12:10:00" -- it would be nice to have this combined into a single video).


Yes, option --merge does exactly that.

Following is what it does:
1. Merge the 3 camera clips into 1 video clip with a layout based on --LAYOUT parameter
2. Merge all the video clips from a folder created in step 1 into 1 video clip. This is then your 10 minute video
3. If using --merge option, then all the video clips from step 2 will be further concatenated into 1 large video clip. I believe this is what you're thus looking for.


----------



## SR22pilot

I have a minor request. Please change the name of the README file to Tesla_Dashcam - README. That way I can copy it to Applications and it will reside next to the executable and not get confused with any other README. On a grander scleras, I would love it if the executable had a UI so options could be easily selected rather than using command lines. Yeah, I'm being lazy.


----------



## ehendrix23

SR22pilot said:


> I have a minor request. Please change the name of the README file to Tesla_Dashcam - README. That way I can copy it to Applications and it will reside next to the executable and not get confused with any other README. On a grander scleras, I would love it if the executable had a UI so options could be easily selected rather than using command lines. Yeah, I'm being lazy.


README filename changed for 0.1.10. 

Yes, agree on UI.  With 0.1.10 you will be able to put your parameters in a text file and then use the text file with @<filename> as a parameter. Should make it somewhat easier with not having to provide the same parameters over and over.


----------



## SR22pilot

ehendrix23 said:


> README filename changed for 0.1.10.
> 
> Yes, agree on UI.  With 0.1.10 you will be able to put your parameters in a text file and then use the text file with @<filename> as a parameter. Should make it somewhat easier with not having to provide the same parameters over and over.


Thank you. I guess the text file is at least a small step towards a UI.


----------



## ehendrix23

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.


----------



## MelindaV

ehendrix23 said:


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


is there a trick to updating to the newest version (OSX)? I downloaded the latest .dmg and had it replace the earlier app, but was not able to use the newer commands, specifically --merge, returned an error that it was not recognized.


----------



## japhule

ehendrix23 said:


> 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

@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:[email protected]: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


----------



## SMichelsen

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

SMichelsen said:


> 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

MelindaV said:


> @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:[email protected]: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

ehendrix23 said:


> 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

MelindaV said:


> 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

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.


----------



## ehendrix23

New release available: Release v0.1.11

Following are the updates:

Fixed:

Traceback when getting ffmpeg path in Linux Issue #39
Running tesla_dashcam when installed using pip. Issue #38
Just providing a filename for output would result in traceback.
When providing a folder as output it would be possible that the last folder name was stripped potentially resulting in error

Apologies for duration. Been busy with vacation, summer, business trips, enjoying sunshine and putting some miles on the car.


----------



## dburkland

ehendrix23 said:


> New release available: Release v0.1.11
> 
> Following are the updates:
> 
> Fixed:
> 
> Traceback when getting ffmpeg path in Linux Issue #39
> Running tesla_dashcam when installed using pip. Issue #38
> Just providing a filename for output would result in traceback.
> When providing a folder as output it would be possible that the last folder name was stripped potentially resulting in error
> 
> Apologies for duration. Been busy with vacation, summer, business trips, enjoying sunshine and putting some miles on the car.


Excellent, thanks for fixing the pip on MacOS bug (aka #38)


----------



## ehendrix23

New release available: Release v0.1.12

Following are the updates:

Fixed:

Folders will now be deleted if there are 0-byte or corrupt video files within the folder Issue #40
Providing a filename for --output would create a folder instead and not setting resulting file to filename provided Issue #52
Thread exception in Windows that ToastNotifier does not have an attribute classAtom (potential fix). Issue #54
Traceback when invalid output path (none-existing) is provided or when unable to create target folder in given path.
Including sub dirs did not work correctly, it would only grab the 1st folder.
When using monitor, if . was provided as source then nothing would be processed. Now it will process everything as intended.
File created when providing a filename with --output and --monitor option did not put timestamp in filename to ensure unique filenames
Argument to get release notes was provided incorrectly when checking for updates. Thank you to demonbane for fixing.
New:

Added chapter markers in the concatenated movies. Folder ones will have a chapter marker for each intermediate clip, merged one has a chapter marker for each folder.
Option --chapter_offset for use with --merge to offset the chapter marker in relation to the folder clip
Added flags -movstart and +faststart for video files better suited with browsers etc. (i.e. YouTube). Thanks to sf302 for suggestion.
Option to add trigger (--monitor_trigger_file) to use existence of a file/folder/link for starting processing instead of USB/SD being inserted.
Changed:

Method for concatenating the clips together has been changed resulting in massive performance improvement (less then 1 second to do concatenation). Big thanks to sf302!


----------



## MelindaV

ehendrix23 said:


> New release available: Release v0.1.12
> 
> Following are the updates:
> 
> Fixed:
> 
> Folders will now be deleted if there are 0-byte or corrupt video files within the folder Issue #40
> Providing a filename for --output would create a folder instead and not setting resulting file to filename provided Issue #52
> Thread exception in Windows that ToastNotifier does not have an attribute classAtom (potential fix). Issue #54
> Traceback when invalid output path (none-existing) is provided or when unable to create target folder in given path.
> Including sub dirs did not work correctly, it would only grab the 1st folder.
> When using monitor, if . was provided as source then nothing would be processed. Now it will process everything as intended.
> File created when providing a filename with --output and --monitor option did not put timestamp in filename to ensure unique filenames
> Argument to get release notes was provided incorrectly when checking for updates. Thank you to demonbane for fixing.
> New:
> 
> Added chapter markers in the concatenated movies. Folder ones will have a chapter marker for each intermediate clip, merged one has a chapter marker for each folder.
> Option --chapter_offset for use with --merge to offset the chapter marker in relation to the folder clip
> Added flags -movstart and +faststart for video files better suited with browsers etc. (i.e. YouTube). Thanks to sf302 for suggestion.
> Option to add trigger (--monitor_trigger_file) to use existence of a file/folder/link for starting processing instead of USB/SD being inserted.
> Changed:
> 
> Method for concatenating the clips together has been changed resulting in massive performance improvement (less then 1 second to do concatenation). Big thanks to sf302!


so the --merge will work now? I've never been able to get it as a recognized command.


----------



## ehendrix23

MelindaV said:


> so the --merge will work now? I've never been able to get it as a recognized command.


Yes. Make sure you get the latest version (0.1.12). You can use --version to check. If it does not work then let me know and provide command you use together with output/result.
I've used it here multiple times combining the videos from multiple folders (and testing chapter markers).


----------



## japhule

Working great so far. A few notes...

How about an option for a focused chapter mark that jumps straight to the trigger event? Trigger events for me all happen at the either the 60 second mark from the end of the video (ie, for a 10m32s video, I find the trigger event at 9m32s) or within the last few seconds of the video (when I approach and open/unlock the car). Would be great if the only chapter mark is right before the trigger event (at -63s from end and/or -10s from end) so we can just jump right to it.

Also noticing that when merging videos, the merged video is named after the output folder in this version. Could we get these merged files a distinct name? Maybe named after the first and last files?

With merging files, I can at least set the chapter marks at -63s to help me jump to the trigger events, but this does require me to merge all the videos to do so.


----------



## MelindaV

@ehendrix23 - not sure if this is cause by a change in how the car records videos or something in the OSX 10.15 Catalina beta...


Code:


ValueError: time data '._2019-09-05_17-33-54' does not match format '%Y-%m-%d_%H-%M-%S'
[26520] Failed to execute script tesla_dashcam

and FYI, the file folder and file naming all look to match the expected naming:










and the 2019-09-05_17-33-54 was the 29th of 29 folders from today's 'RecentClips' folder. Removing that folder from the RecentClips folder, and rerunning gives a similar error with another clip set listed.

and running it for the RecentClips does this (error from the first of the 60 clips):


Code:


TeslaCam folder found on /Volumes/TESLACAM.
Retrieving all files from /Volumes/TESLACAM/TeslaCam/RecentClips
Discovered 1 folders containing total of 180 files, retrieving clip data.
There are 1 folders with 60 clips to process.
    Processing 60 clips in folder /Volumes/TESLACAM/TeslaCam/RecentClips (1/1)
        Processing clip 1/60 from 09/05/19 17:53:21 and 59 seconds long.
            Error trying to create clip for /Volumes/TESLACAM/TeslaCam/RecentClips/2019-09-05_17-53-21. RC: 1
            Command: ['/var/folders/fv/hd81md156y1bxjpk8ntm06hr0000gn/T/_MEIbZUvMp/ffmpeg', '-i', '/Volumes/TESLACAM/TeslaCam/RecentClips/2019-09-05_17-53-21-left_repeater.mp4', '-i', '/Volumes/TESLACAM/TeslaCam/RecentClips/2019-09-05_17-53-21-front.mp4', '-i', '/Volumes/TESLACAM/TeslaCam/RecentClips/2019-09-05_17-53-21-right_repeater.mp4', '-filter_complex', "color=duration=59.29: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:[email protected]:x=(w/2-text_w/2):y=(h-(text_h*2)):text='%{pts\\:localtime\\:1567731201\\:%x %X}'[tmp1];[tmp1]  setpts=0.5*PTS", '-preset', 'medium', '-crf', '28', '-allow_sw', '1', '-b:v', '5000K', '-c:v', 'h264_videotoolbox', '-y', '/volumes/etc/2019-09-05_17-53-21.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/RecentClips/2019-09-05_17-53-21-left_repeater.mp4':\n  Metadata:\n    major_brand     : mp42\n    minor_version   : 0\n    compatible_brands: mp42mp41isomiso2\n    creation_time   : 2019-09-06T00:53:21.000000Z\n  Duration: 00:00:59.29, start: 0.000000, bitrate: 4016 kb/s\n    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4010 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\n    Metadata:\n      creation_time   : 2019-09-06T00:53:21.000000Z\n      handler_name    : VideoHandler\nInput #1, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/TESLACAM/TeslaCam/RecentClips/2019-09-05_17-53-21-front.mp4':\n  Metadata:\n    major_brand     : mp42\n    minor_version   : 0\n    compatible_brands: mp42mp41isomiso2\n    creation_time   : 2019-09-06T00:53:21.000000Z\n  Duration: 00:00:59.25, start: 0.000000, bitrate: 4016 kb/s\n    Stream #1:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4011 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\n    Metadata:\n      creation_time   : 2019-09-06T00:53:21.000000Z\n      handler_name    : VideoHandler\nInput #2, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/TESLACAM/TeslaCam/RecentClips/2019-09-05_17-53-21-right_repeater.mp4':\n  Metadata:\n    major_brand     : mp42\n    minor_version   : 0\n    compatible_brands: mp42mp41isomiso2\n    creation_time   : 2019-09-06T00:53:21.000000Z\n  Duration: 00:00:59.00, start: 0.000000, bitrate: 4015 kb/s\n    Stream #2:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x960, 4010 kb/s, SAR 1:1 DAR 4:3, 36.02 fps, 36 tbr, 10k tbn, 20k tbc (default)\n    Metadata:\n      creation_time   : 2019-09-06T00:53:21.000000Z\n      handler_name    : VideoHandler\nFontconfig error: Cannot load default config file\n[Parsed_drawtext_12 @ 0x7fafc0e03480] Cannot find a valid font for the family Sans\n[AVFilterGraph @ 0x7fafc0e01600] Error initializing filter 'drawtext' with args 'fontfile=/Library/Fonts/Arial.ttf:fontcolor=white:fontsize=16.0:borderw=2:[email protected]:x=(w/2-text_w/2):y=(h-(text_h*2)):text=%{pts\\:localtime\\:1567731201\\:%x %X}'\nError initializing complex filters.\nNo such file or directory\n"


----------



## ehendrix23

Anyway you can provide me 1 of those video files so I can have a look at it? It looks like the metadata in them does not include the creation time and normally it should. This then results in it trying to get the timestamp from the filename and that is failing then. Not sure why the fallback is failing as the filename indeed looks normal. Can you provide me the complete command you use as well? I just did a test here local and even if creation time is not in the video metadata then the fallback to using the filename is working fine here.

For the 2nd issue, can you check if file /Library/Fonts/Arial.ttf exist? If not, check path /system/library/fonts/Supplemental/. Someone else had similar issue not too long ago and now I'm wondering if in Catalina they changed the location of this font file.


----------



## MelindaV

ehendrix23 said:


> Anyway you can provide me 1 of those video files so I can have a look at it? It looks like the metadata in them does not include the creation time and normally it should. This then results in it trying to get the timestamp from the filename and that is failing then. Not sure why the fallback is failing as the filename indeed looks normal. Can you provide me the complete command you use as well? I just did a test here local and even if creation time is not in the video metadata then the fallback to using the filename is working fine here.
> 
> For the 2nd issue, can you check if file /Library/Fonts/Arial.ttf exist? If not, check path /system/library/fonts/Supplemental/. Someone else had similar issue not too long ago and now I'm wondering if in Catalina they changed the location of this font file.


will PM you a link to one of the videos to download...
I do have arial (and all its various versions) in the Supplemental directory, but not the main.


----------



## ehendrix23

> I do have arial (and all its various versions) in the Supplemental directory, but not the main.


That is then the issue with the font and must be a change in Catalina. If you copy Arial.ttf to /Library/Fonts/Arial.ttf then that will fix it. Or you can provide the parameter --font with the full path to the Arial font file in that Supplemental directory. 
I'll put this in the next version to try the Supplemental folder if not exist in the original one.


----------



## japhule

I believe V10 will add the rear view camera. Have you started looking into getting that added to the script?


----------



## ehendrix23

japhule said:


> I believe V10 will add the rear view camera. Have you started looking into getting that added to the script?


Been thinking about it once Elon stated he would see to get it included but that's it. Need to figure out best position to put it for the different layouts.

Open to suggestions.


----------



## japhule

Suggestions


Code:


1. Normal - 4 Quadrants at 1280x960 (4:3)


[    front     ][  rear_view  ]

[left_repeater][right_repeater]


2. Diamond at 16:9 (1280x720 or 1920x1080)

               --------------

               |   [front]   |

[left_repeater]--------------[right_repeater]

               | [rear_view] |
               --------------


----------



## sduck

I like the diamond suggestion. I would use that. With the side views un-mirrored.


----------



## dburkland

I concur, diamond view would be nice!


----------



## ehendrix23

Diamond view as proposed would thus have a black portion in the middle between the left and right repeaters. Do you all prefer that or would you prefer:



Code:


               --------------
               |   [front]   |
       [left_repeater][right_repeater]
               | [rear_view] |
               --------------

Right now to incorporate the rear camera I'm doing:

WIDESCREEN (thus front camera is bigger on top with side and rear smaller below it):


Code:


[                 front                  ]
[left_repeater][rear_view][right_repeater]

FULLSCREEN (front camera centered on top, all 4 same size):


Code:


                 [front]                  
[left_repeater][rear_view][right_repeater]

Going to see to get rid of perspective (where the side ones are in this kind of diagonal view) and instead make it an option for each layout.


----------



## japhule

Would diamond something like the (rough) image below? Maybe small black portion could have the timestamp in it.


----------



## ehendrix23

japhule said:


> Would diamond something like the (rough) image below? Maybe small black portion could have the timestamp in it.
> 
> View attachment 29348


Got it in there for next version (0.1.13) with support for rear camera in other layouts as well (together with some other new stuff).


----------



## r-e-l

Was hoping the renewed thread will be about something else ….

now that the new browser can support video, was wondering if there is a chance to host this script on a website, have it read the files directly from the USB in the car and finally allow us to reviewd the videos in the car .....

possible?


----------



## ehendrix23

r-e-l said:


> Was hoping the renewed thread will be about something else ….
> 
> now that the new browser can support video, was wondering if there is a chance to host this script on a website, have it read the files directly from the USB in the car and finally allow us to reviewd the videos in the car .....
> 
> possible?


That would mean that web site would need to be developed to allow access to local files on the car. For that one would need to know exact path within the car the files are located (in other words where is the USB drive mounted on. Like which drive letter if it were Windows, as it runs Linux it is mount point). I have not heard or seen anyone being able to state so.
Further, then the browser would need to allow local access from a web site. Doubtful Tesla would allow this as it can comprise security of the car. Just on PCs etc. browsers have been blocking this and only allowing it by opening a dialog box to specify the files to be provided. 
I would more see Tesla then providing a method to view it on the screen then supporting something like that resulting in potential headlines about a Tesla car being hacked into.


----------



## ehendrix23

In celebration of Tesla just announcing the release of V10, there is also a new release off tesla_dashcam with support for the rear camera, 2 new layouts (CROSS and DIAMOND), ability to exclude cameras, restrict based on timestamps, provide folder offsets, fast-forward through video that has no motion (excellent for Sentry videos), and more.

Release v0.1.14

Fixed:

- Merge of videos fails when a relative path instead of an absolute path is provided for --output Issue #62 
- Issue during processing of metadata if files were missing
- 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.
- Checking if font path exist in Windows failed.

New:

- Support for rear camera (introduced in V10). This also results in layouts having been modified to allow inclusion of rear camera. Issue #71 
- Support for hardware encoding for systems with supported Intel GPUs.
- Support for hardware encoding on Raspberry Pi (RPi) (H.264 only) Issue #66 
- Layout CROSS with front camera top centered, side camera underneath it, and rear camera then underneath side cameras centered.
- Layout DIAMOND with front camera top centered, rear camera under front and side camera centered at the left and right of front&rear.
- Option --motion_only to fast-forward through the portions in the video that does not have anything motion (done through removal of duplicate frames).
- Option --skip_existing to skip creation of video files that already exist. Existence only is checked, not if layout etc are the same.
- 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.
- Options --start_offset and --end_offset can be used to provide starting and ending offset in seconds for resulting video (at folder level).
- Options --start_timestamp and --end_timestamp can be used to restrict resulting video (and processing) to specific timestamps. This can be used in combination with --start_offset and/or --end_offset
- Options --no-front, --no-left, --no-right, and --no-rear to exclude camera(s) from the videos
- Option --gpu_type to provide GPU installed in the system for Windows/Linux. Current supported options are nvidia, intel, and RPi.
- Option --no-faststart for not setting the faststart flag in the video files as doing this can result in encoding failures on network shares Issue #62 
- Option --temp_dir to provide a different path to store the temporary video files that are created Issue #67 
- Description metadata to include video was created by tesla_dashcam with version number.

Changed:

- WIDESCREEN layout will now by default show the front camera on top with higher resolution compared to others due to incorporation of rear camera
- Include folder SentryClips in default source list if no source provided (SavedClips was already default).
- Check to ensure that Python version is at required level or higher (currently 3.7).
- Existence of font file (provided or default) will be checked and error returned if not existing.
- Existence of ffmpeg will be checked and error returned if not existing.
- If no filename provided for merged video then current date/time will be used for filename.


----------



## JWardell

r-e-l said:


> Was hoping the renewed thread will be about something else ….
> 
> now that the new browser can support video, was wondering if there is a chance to host this script on a website, have it read the files directly from the USB in the car and finally allow us to reviewd the videos in the car .....
> 
> possible?


What you wish for already exists, and it works very well!

https://sentrycam.appspot.com

Edit: sorry, this is for running on your computer...still no way to do this from within the car.


----------



## JML

ehendrix23 said:


> That would mean that web site would need to be developed to allow access to local files on the car. For that one would need to know exact path within the car the files are located (in other words where is the USB drive mounted on. Like which drive letter if it were Windows, as it runs Linux it is mount point). I have not heard or seen anyone being able to state so.
> Further, then the browser would need to allow local access from a web site. Doubtful Tesla would allow this as it can comprise security of the car. Just on PCs etc. browsers have been blocking this and only allowing it by opening a dialog box to specify the files to be provided.
> I would more see Tesla then providing a method to view it on the screen then supporting something like that resulting in potential headlines about a Tesla car being hacked into.


From my playing with the browser a bit when it came out, urls of the form file:/// are not allowed. So as is, there's no way to open local files with the browser.


----------



## japhule

Looks like they decided to change the naming convention of the rear camera in the latest public release. It is now: 

2019-09-27_01-03-51-back.mp4 

instead of: 

2019-09-27_01-03-51-rear_view.mp4

Can you update this accordingly?


----------



## sduck

Yes, this new version works well, I guess, but no back camera yet. Waiting on version 1.15! Thanks for your continuing efforts on this ehendrix23!


----------



## ehendrix23

Release v0.1.15 is available now with the fix for rear camera filename (seems Tesla changed it last minute or so) and few other items.

Fixed:

- Rear view camera filename was changed from -rear_view to -back in TeslaCam folders. Issue #78 
- Missing python-dateutil package when installing from PIP Issue #77 
- Missing fonts in Docker Image (thanks to moorecp for providing fix)
- Only the 1st source was processed When using MONITOR or MONITOR_ONCE, or with V10 only SavedClips was processed when not providing a source

Changed:

- Reduced sensitivity for motion detection
- Minor improvement for font path checking, mainly message provided.


----------



## Kermit

Amazing software! Question - I was hoping to speed up my video a little bit with "--speedup 1.4" but got the error "invalid int value" ... any chance this could be made a float? 2x is comically quick and 1x is a little boring.


----------



## MelindaV

Kermit said:


> Amazing software! Question - I was hoping to speed up my video a little bit with "--speedup 1.4" but got the error "invalid int value" ... any chance this could be made a float? 2x is comically quick and 1x is a little boring.


and I think x5 isnt quick enough, but x10 is too quick


----------



## Kermit

MelindaV said:


> and I think x5 isnt quick enough, but x10 is too quick


I have great news for you, x7 or x8 is available to you! 😜


----------



## sduck

Kermit said:


> Amazing software! Question - I was hoping to speed up my video a little bit with "--speedup 1.4" but got the error "invalid int value" ... any chance this could be made a float? 2x is comically quick and 1x is a little boring.


Depending on what you're using to play back the files with, you can do this there. I use quicktime on my mac, and if you click the little forward arrow, it speeds up 2x, 5x, 10x, 30x. I'm sure there are similar features in whatever you're using.


----------



## Kermit

sduck said:


> Depending on what you're using to play back the files with, you can do this there. I use quicktime on my mac, and if you click the little forward arrow, it speeds up 2x, 5x, 10x, 30x. I'm sure there are similar features in whatever you're using.


I know clients can speed up playback. 🤣


----------



## ehendrix23

Kermit said:


> Amazing software! Question - I was hoping to speed up my video a little bit with "--speedup 1.4" but got the error "invalid int value" ... any chance this could be made a float? 2x is comically quick and 1x is a little boring.


Try with the new --motion_only; that way it will go skip anything where there is no motion (or very little motion).


----------



## GDN

ehendrix23 said:


> Try with the new --motion_only; that way it will go skip anything where there is no motion (or very little motion).


Sounds like a great new option. Will try the newer version this weekend.


----------



## Kermit

ehendrix23 said:


> Try with the new --motion_only; that way it will go skip anything where there is no motion (or very little motion).


These are lively dashcam videos, plenty of motion! Was hoping for a little more granular control of playback speed but I'm just being super picky, great software!


----------



## MelindaV

todays the first I've used the app since V10...
I could not get it to recognize 'RecentClips', and even when leaving the targeted directory off all together, it would only look at SavedClips and SentryClips

With the new 4 camera layouts, how do you get the rear camera to mirror so it matches the side cameras?


----------



## Joaquin

Very nice, @ehendrix23. Interesting that you packed everything into a .dmg package, I need to investigate how to do that 

Take a look at https://github.com/chriskiehl/Gooey. It's a very nice and super-easy GUI generator for command line python scripts. It may bump this tool to the next level


----------



## ehendrix23

MelindaV said:


> todays the first I've used the app since V10...
> I could not get it to recognize 'RecentClips', and even when leaving the targeted directory off all together, it would only look at SavedClips and SentryClips
> 
> With the new 4 camera layouts, how do you get the rear camera to mirror so it matches the side cameras?


Next version will mirror rear camera same as it does for the side ones. So when sides are mirrored, rear is. When sides are not mirrored rear is not.

For the folders, if you do not specify a source folder then it will only grab SavedClips and SentryClips.

I'm assuming you run it so it checks for existence of a USB drive. Thus if you want to include RecentClips you would need to use the parameter --monitor_once and then provide the 3 folders:


Code:


tesla_dashcam --monitor_once SavedClips SentryClips RecentClips

Or if you want it to keep on running and monitoring (this so that you can then. take the USB drive out, and at another time when you insert it back in it will start processing again):


Code:


tesla_dashcam --monitor SavedClips SentryClips RecentClips

Any other parameters you can still provide, like the output folder.


----------



## ehendrix23

Kermit said:


> These are lively dashcam videos, plenty of motion! Was hoping for a little more granular control of playback speed but I'm just being super picky, great software!


I checked and can use a float for it. Hence next version has it changed so you can use, for example, 1.4 for speedup (or slowdown).


----------



## ehendrix23

Joaquin said:


> Very nice, @ehendrix23. Interesting that you packed everything into a .dmg package, I need to investigate how to do that
> 
> Take a look at https://github.com/chriskiehl/Gooey. It's a very nice and super-easy GUI generator for command line python scripts. It may bump this tool to the next level


Process is actually very simple (once you know how). <g>. Just create a disk image from disk utility and make it big enough. That is then kind the "template". Then every time update the file(s) in that disk image and then use Disk Utility to convert and compress it. Here is a link to a page explaining it: https://el-tramo.be/blog/fancy-dmg/

Thanks for the tip for Gooey. Definitely going to look into that as that would make it easy to create a GUI for now.


----------



## ehendrix23

Release v0.1.16 is available now, this release will mirror rear camera as well (when side cameras are mirrored) and changes default font on Mac to work on Catalina.

New:
- Option --scale now accepts value of camera=<front, rear, left, right>. to set the scale of for each camera individually (value of 1 is 1280x960 for the clip)
- Option --swap_frontrear to swap front&rear cameras in output.
- Option --background to specify background color (default is black).
- Option --fps to set the frame rate for resulting video. Default is set to 24 (Tesla records at about 33 fps). Issue #85
- Parameter file (provided using @) can now include comments (specify using #)
- Option --loglevel to allow for debug information to be printed.

Fixed:
- Providing paths with spaces did not work in parameter files even although it worked from command line. Issue #89
- Changed Arial font on MacOS to Arial Unicode (from Arial) as it seems Arial is not available anymore on MacOS 10.15 (Catalina). Issue #64
- Incorrect encoder for x265 with Intel GPU hardware encoding - mbaileys

Changed:
- --speedup and --slowdown now accepts a float allowing for example to speed video up by 1.5
- Option --scale also accept fixed resolution (i.e. 640x480) for the clip.
- View of rear camera will be mirrored as well if side cameras are shown as mirror
- For all layouts default is to show mirror for rear&side if front camera is shown, otherwise show as rear viewing.
- Swap left&right cameras when showing rear&side as rear viewing, and not to swap them when showing rear&side as mirror view.
- Re-organized help (-h) for all parameters by grouping them.
- Added message to install fonts using apt-get install ttf-freefont on Linux if font file is not found.
- Only execute if we're main allowing to be imported into other scripts. Issue #94 
- Cleaned-up this README file to provide better information.


----------



## Kermit

Dude you rock!



ehendrix23 said:


> Changed:
> - --speedup and --slowdown now accepts a float allowing for example to speed video up by 1.5


----------



## JML

I just updated to 0.1.16 and noticed an issue with the Nvidia encoders. When running with --gpu --gpu-type nvidia the ffmpeg command is run with -b:v 60000K. That causes quite an inflation in the size of the output files. It does this for both x264 and x265. Using --enc hevc_nvenc doesn't insert the extra bitrate option and produces files of the expected size. When I don't use --gpu, then the bitrate is not specified, but the encoding is obviously much slower.

This is on Linux with ffmpeg 4.2.2.


----------



## eagleco

JML said:


> I just updated to 0.1.16 and noticed an issue with the Nvidia encoders. When running with --gpu --gpu-type nvidia the ffmpeg command is run with -b:v 60000K. That causes quite an inflation in the size of the output files. It does this for both x264 and x265. Using --enc hevc_nvenc doesn't insert the extra bitrate option and produces files of the expected size. When I don't use --gpu, then the bitrate is not specified, but the encoding is obviously much slower.
> 
> This is on Linux with ffmpeg 4.2.2.


I'm also getting very large file sizes when using --gpu --gpu_type nvidia on 0.1.16 (windows)

Loving the --motion_only option though!


----------

