MusfiqDehan / video-analyzer

This web app will compare and analyze two videos and determines the similarity score between them.
3 stars 1 forks source link

Error after clicking "Compare" #2

Open m-m-0-m opened 9 months ago

m-m-0-m commented 9 months ago

I am using a MacBook Air M2 on MacOS 12.5.

I tried to compare two videos, but I got this error in the Terminal window:

127.0.0.1 - - [02/Jan/2024 14:11:02] "POST / HTTP/1.1" 302 - [2024-01-02 14:11:02,130] ERROR in app: Exception on /compare [GET] Traceback (most recent call last): File "/Users/user/.local/share/virtualenvs/video-analyzer-MzrZxvID/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app response = self.full_dispatch_request() File "/Users/user/.local/share/virtualenvs/video-analyzer-MzrZxvID/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/user/.local/share/virtualenvs/video-analyzer-MzrZxvID/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request rv = self.dispatch_request() File "/Users/user/.local/share/virtualenvs/video-analyzer-MzrZxvID/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "/Users/user/video-analyzer/app.py", line 171, in compare similarity_percentage = calculate_similarity(video1_path, video2_path) File "/Users/user/video-analyzer/app.py", line 143, in calculate_similarity audio1_path = extract_audio(video1_path) File "/Users/user/video-analyzer/app.py", line 61, in extract_audio audio.write_audiofile(audio_path, logger=None) AttributeError: 'NoneType' object has no attribute 'write_audiofile' 127.0.0.1 - - [02/Jan/2024 14:11:02] "GET /compare?video1=replicate-prediction-hgc6twjbvmodfahzh6zlbqwfwu.mp4&video2=replicate-prediction-aq42cmrbx5bi56isehhfgbbo3i.mp4 HTTP/1.1" 500 -

The webpage said this:

Internal Server Error

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Is there something I am missing? What should I do?

MusfiqDehan commented 9 months ago

What is the size and length of your videos?

m-m-0-m commented 9 months ago

Both videos are around 490KB. They are both 6 seconds long, and they have no audio. I tried renaming the files, but it still did not work.

MusfiqDehan commented 9 months ago

I think this is the main error message

AttributeError: 'NoneType' object has no attribute 'write_audiofile'

Try to compare video with audio also. I think, video without audio is generating error.

m-m-0-m commented 9 months ago

I used iMovie to add a random audio track to the videos, and it worked. Thanks. Extra question: How is the similarity score calculated? What does it mean if videos have a similarity score of 0.7?