tfaehse / DashcamCleaner

Censor identifiable information in videos, in particular dashcam recordings in Germany.
GNU Affero General Public License v3.0
131 stars 27 forks source link

Programm ends with an error, but video is created #2

Closed MBadberg closed 2 years ago

MBadberg commented 3 years ago

After the video is created, following error occurs:

Traceback (most recent call last): File "D:\conda\DashcamCleaner\dashcamcleaner\src\blurrer.py", line 160, in run subprocess.run( File "D:\Users\marku\miniconda3\envs\py38\lib\subprocess.py", line 493, in run with Popen(*popenargs, **kwargs) as process: File "D:\Users\marku\miniconda3\envs\py38\lib\subprocess.py", line 858, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "D:\Users\marku\miniconda3\envs\py38\lib\subprocess.py", line 1251, in _execute_child args = list2cmdline(args) File "D:\Users\marku\miniconda3\envs\py38\lib\subprocess.py", line 553, in list2cmdline for arg in map(os.fsdecode, seq): File "D:\Users\marku\miniconda3\envs\py38\lib\os.py", line 818, in fsdecode filename = fspath(filename) # Does type-checking offilename. TypeError: expected str, bytes or os.PathLike object, not NoneType

But the video is fine

tfaehse commented 3 years ago

Hi!

This is just an assumption, but I think your ffmpeg-binary isn't found. The tool expects to find the path to the executable in the "FFMPEG_BINARY" path, and doesn't do any error-checking whatsoever.

This is, in general, a fairly ugly solution. I'll try to keep it short: I use OpenCV to blur objects, but it doesn't support audio tracks. So the resulting video has no sound. My current (naive) solution is to use OpenCV to create a _temp file without audio and then use ffmpeg to combine the unedited video's audio with the blurred video. Once that's done, the (muted) OpenCV result is deleted. There are a few things about this that could lead to errors, in your case it just seems to be a missing path variable for the ffmpeg executable.

It will unfortunately take a bit, but I'll improve error handling so that (hopefully) error messages actually make sense and don't crash the program.

As for your original comment: the quality is absolutely something I should work on! My own dashcam videos were already heavily compressed from the camera so I never noticed how bad it actually could get. OpenCV doesn't really allow you to control the bitrate/compression, but I found some potential workarounds. I can't really promise any timeline here, but I'll get to it sooner or later and post an update here!

tfaehse commented 3 years ago

@MBadberg The newest commits should address the issues, at least somewhat.