tesla_dashcam icon indicating copy to clipboard operation
tesla_dashcam copied to clipboard

ValueError: invalid literal for int() with base 10: ' N/A'

Open withinfocus opened this issue 3 months ago • 7 comments

Utilizing the latest stable FFmpeg 8 I am getting

Traceback (most recent call last):
  File "/usr/src/app/tesla_dashcam/tesla_dashcam/tesla_dashcam.py", line 4776, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/src/app/tesla_dashcam/tesla_dashcam/tesla_dashcam.py", line 4700, in main
    process_folders(source_folder_list, video_settings, args.delete_source)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/app/tesla_dashcam/tesla_dashcam/tesla_dashcam.py", line 2703, in process_folders
    event_list = get_movie_files(source_folders, video_settings)
  File "/usr/src/app/tesla_dashcam/tesla_dashcam/tesla_dashcam.py", line 1630, in get_movie_files
    metadata = get_metadata(
        video_settings["ffmpeg_exec"],
        [front_path, left_path, right_path, rear_path, left_pillar_path, right_pillar_path],
    )
  File "/usr/src/app/tesla_dashcam/tesla_dashcam/tesla_dashcam.py", line 1903, in get_metadata
    int(duration_list[0]) * 60 * 60
    ~~~^^^^^^^^^^^^^^^^^^

for occasional clips right off the device.

withinfocus avatar Sep 15 '25 17:09 withinfocus

No testing has been done with ffmpeg8. Should work with ffmpeg7.

ehendrix23 avatar Sep 30 '25 18:09 ehendrix23

Same error for 7 for what it's worth, I just happen to be trying 8. There's no relevant differences.

withinfocus avatar Sep 30 '25 18:09 withinfocus

Can you provide the version you are running? Erik Hendrix

On Sep 30, 2025, at 12:59 PM, Matt Bishop @.***> wrote:

 [https://avatars.githubusercontent.com/u/1046132?s=20&v=4]withinfocus left a comment (ehendrix23/tesla_dashcam#212)https://github.com/ehendrix23/tesla_dashcam/issues/212#issuecomment-3353426989

Same error for 7 for what it's worth, I just happen to be trying 8. There's no relevant differences.

— Reply to this email directly, view it on GitHubhttps://github.com/ehendrix23/tesla_dashcam/issues/212#issuecomment-3353426989, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADR4RRQ27CUYF4XCF42FHM33VLHJ3AVCNFSM6AAAAACGSDPVJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGNJTGQZDMOJYHE. You are receiving this because you commented.Message ID: @.***>

ehendrix23 avatar Sep 30 '25 21:09 ehendrix23

I have a fork at https://github.com/withinfocus/tesla_dashcam but it's in sync logic-wise with here, I just wanted to get newer container images with patches. I introduced the upgrade to FFmpeg 7 in this repo by the way. I have used both 7 and 8 hoping a bump would just get around this but it's specific to certain files coming off my vehicle. Short of sharing a video file which would be a bit too revealing to me I am not sure what other info I can provide.

withinfocus avatar Sep 30 '25 21:09 withinfocus

I ran into this issue and it was because of a clip that had no duration:

ffprobe ./SentryClips/2025-01-02_13-40-12/2025-01-02_13-40-11-back.mp4
ffprobe version 7.1.2-1+b1 Copyright (c) 2007-2025 the FFmpeg developers
  built with gcc 15 (Debian 15.2.0-4)
  configuration: --prefix=/usr --extra-version=1+b1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.101 / 61. 19.101
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './SentryClips/2025-01-02_13-40-12/2025-01-02_13-40-11-back.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41isomiso2
    creation_time   : 2025-01-02T00:40:11.000000Z
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1280x960, SAR 1:1 DAR 4:3, 10k tbn (default)
      Metadata:
        creation_time   : 2025-01-02T00:40:11.000000Z
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]

Not sure what created it, but I found it with find . -name "*.mp4" -print0 | xargs -0 -I {} sh -c 'ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "{}" 2>&1 | grep -q "N/A" && echo "Found bad file: {}"

This is a file that was synced from teslapi, so presumably a file created by the car

ryanelliottsmith avatar Nov 18 '25 21:11 ryanelliottsmith

@ryanelliottsmith definitely right from the car, so it had some error with what it saved to disk. This happens rarely for me, but it did just happen a week or so ago so I feel it's an eventuality. Do you think the prep steps in this solution should just run a cleanup command? Or do we run this and skip clips with zero duration?

withinfocus avatar Nov 21 '25 17:11 withinfocus

The coding I'm working on right now should be able to capture this and then put out a warning that there is no duration. That clip will then be excluded as we don't know the duration of it.

ehendrix23 avatar Nov 24 '25 22:11 ehendrix23