Skip to main content

Consolidate and format Tesla vehicle camera video data

Project description

teslacam

Tesla Camera

This is a very simple python 3 script to help me consolidate my Tesla's raw camera data into nicely formatted videos. It tries to maintain the same resolution as the original with the same video quality by default.

This also makes use of nvidia video card GPUs to accelerate encoding.

Installation:

Download FFMpeg here: https://ffmpeg.org/download.html

Run:

python -m pip install teslacam

Command line usage

python -m teslacam --help
usage: teslacam [-h] [--codec {hevc_nvenc,libx265}] [--preset PRESET] [--reduce REDUCE] [--layout {pyramid,tall_diamond,short_diamond,cross}] [--keep_temp_folder KEEP_TEMP_FOLDER]
                ffprobe_file_path ffmpeg_file_path input_folder_path output_folder_path

positional arguments:
  ffprobe_file_path     full path to ffprobe binary
  ffmpeg_file_path      full path to ffmpeg binary
  input_folder_path     full path to the video folder containing timestamped folders
  output_folder_path    full path of the output folder for merged files and temporary work folder

optional arguments:
  -h, --help            show this help message and exit
  --codec {hevc_nvenc,libx265}
                        codec to use for encoding
  --preset PRESET       preset to use for encoding
  --reduce REDUCE       percent to reduce video to
  --layout {pyramid,tall_diamond,short_diamond,cross}
                        camera layout
  --keep_temp_folder KEEP_TEMP_FOLDER
                        keep temporary working folder after extraction

API Usage

import teslacam
from teslacam import *

def main():
  print(f"Available layouts: {', '.join(teslacam.constants.LAYOUT.keys())}")
  print(f'Available codecs: {teslacam.constants.CODEC_OPTIONS.items()}')
  extract_videos(
    FFMpegPaths(
      r'some_ffmpeg_path\ffprobe.exe', # path to ffprobe
      r'some_ffmpeg_path\ffmpeg.exe'   # path to ffmpeg
    ),
    LayoutOptions(
      'hevc_nvenc', # Codec name
      'fast',       # Codec preset
      'pyramid',    # Layout name
      DONT_REDUCE   # Percentage value from 1-100 (or DONT_REDUCE constant)
    ),
    BaseFolderPaths(
      r'g:\TeslaCam\SentryClips',   # Path to your USB stick
      r'c:\users\user\videos\tesla' # Destination path
    ),
    True  # Keep temporary working folder
  )

if __name__ == '__main__':
  main()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

teslacam-1.0.2-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file teslacam-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: teslacam-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for teslacam-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 10ee0bfa63c12715b651a56c63adbaa224eae69cafa7f1303e56d12f24f2214c
MD5 e5220d031473a23fbab90fc34b65f95a
BLAKE2b-256 b2f4d0438459238112de3f2186f7f7b1dd2ce066480cdc444b3379313b035e94

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page