MoneyPrinter icon indicating copy to clipboard operation
MoneyPrinter copied to clipboard

[BUG] Video generation fails when creating subtitles locally.

Open djsv23 opened this issue 1 year ago • 5 comments

Describe the bug Video generation fails after MoviePy finishes. The next debug message is "Creating Subtitles Locally" and then comes an error: "Expected contiguous start of match or end of input at char 198, but started at char 483 (unmatched content: '2\n0:00:10,780 --> 0:00\nIn this video, we will explore the fascinating world of cars, from their history and evolution to their impact on society and the environment.\n\n1\n\n3\n0:00 --> 0:00:25,760\nEvolution of Cars:\n\nCars have come a long way since their invention in the late 19th century')"

The request returns an error and no output.mp4 is generated

To Reproduce Steps to reproduce the behavior:

  1. Cloned git repository
  2. Built MagickImage from linux source and installed on Ubuntu 22.04
  3. Updated .env file per ENV.md. ImageMagick is pointed to /usr/bin/local/magick where it was installed by make install
  4. Run main.py for the backend as suggested
  5. Send a JSON request to the backend endpoint from Postman on a remote machine:

{ "videoSubject": "Cars", "voice": "en_au_001" }

Expected behavior Video to be generated at ./temp/output.mp4

Observed behavior The video clips are downloaded and audio is generated into ./temp/, but the request errors and stops before the video is composited.

djsv23 avatar Feb 07 '24 20:02 djsv23

Interesting - I will disable local subtitles for now and look into what the issue is. Thanks for explaining so well.

FujiwaraChoki avatar Feb 07 '24 20:02 FujiwaraChoki

I'm facing a issue with the same function while building a Docker image of the application. Im suspicious that the issue is on "AudioFileClip", since it raises the following error:

[10/11] RUN python3 Backend/main.py: 1.441 Traceback (most recent call last): 1.441 File "Backend/main.py", line 4, in 1.441 from video import * 1.441 File "/Backend/video.py", line 59, in 1.441 def __generate_subtitles_locally(sentences: list[str], audio_clips: list[AudioFileClip]) -> str: 1.441 TypeError: 'type' object is not subscriptable

donburgareli avatar Feb 07 '24 21:02 donburgareli

I see the error, it's a list not List.

This will have to be imported from typing.

Can you open a PR?

FujiwaraChoki avatar Feb 07 '24 21:02 FujiwaraChoki

Sure, done.

donburgareli avatar Feb 07 '24 22:02 donburgareli

Interesting - I will disable local subtitles for now and look into what the issue is. Thanks for explaining so well.

I think after you turned it off you turned off all future steps of generation?

MoviePy - Writing audio in ../temp/a4268bf6-9f0a-4efa-a69a-78764f9c06f3.mp3
MoviePy - Done.                                                                                   
[-] Local subtitle generation has been disabled for the time being.
[-] Exiting.

Edit: I looked at the source, if you don't use Assembly_AI then the app just kills itself. Which is weird cause the .env said that feature is optional.

jdriselvato avatar Feb 08 '24 00:02 jdriselvato

Interesting - I will disable local subtitles for now and look into what the issue is. Thanks for explaining so well.

I think after you turned it off you turned off all future steps of generation?


MoviePy - Writing audio in ../temp/a4268bf6-9f0a-4efa-a69a-78764f9c06f3.mp3

MoviePy - Done.                                                                                   

[-] Local subtitle generation has been disabled for the time being.

[-] Exiting.

Edit: I looked at the source, if you don't use Assembly_AI then the app just kills itself. Which is weird cause the .env said that feature is optional.

I literally just said I will turn it off.

FujiwaraChoki avatar Feb 08 '24 04:02 FujiwaraChoki

So ist that mean (until this issue solved) it can't generate the finale video right now?

raniaamina avatar Feb 08 '24 07:02 raniaamina

So ist that mean (until this issue solved) it can't generate the finale video right now?

You can, just provide your AssemblyAI API Key.

FujiwaraChoki avatar Feb 08 '24 07:02 FujiwaraChoki