abi / screenshot-to-code

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Home Page:https://screenshottocode.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

failed to generate code when uploading a screen recording

brettyoung6678 opened this issue · comments

1、it will suceed when uploading a screenshot.
2、it will fail when uploading a screen recording.
the log from chrome console is as follows:
image
the log from backend service is as follows:
image

thanks for your help.

@brettyoung6678 how large is your screen recording? And which browser are you using?

That information will be helpful to me in debugging this issue.

browser : chrome version :123.0.6312.123(64 bit)
screen recording: 12,545KB
image

i can not upload here because of the size limitation of github. i can provide a s3 link if you need.

thanks a lot, @abi

No need for the actual screen recording file. I just wanted to see how large the file was.

I'll check on my end if that should be okay.

One thing you could do is make the file smaller (just use some online compression site) and try it. I think it should work.

Same issue here. When generating screenshots, everything works fine, but whether it's screen recording or uploading local screen files, it fails to generate. The front-end indicates an error in generating the code.

I reviewed the backend logs and found that the system failed to process the video when uploading video files and attempting to generate code. Although the WebSocket connection was successfully established, and the server logs indicated that the code generation process had begun, an error occurred during the video file processing stage. The system tried to parse the video using the MoviePy library but encountered an IndexError with the message "list index out of range". The specific stack trace indicates that this error occurred while trying to read the video file's duration. Here is an excerpt from the error log:

Exception in ASGI application
OSError: MoviePy error: failed to read the duration of file C:\Users\mywinusername\AppData\Local\Temp\tmpfk6jogim.webm.
Here are the file infos returned by ffmpeg:

At the bottom of the error log, there is also an entry stating "C:\Users\mywinusername\AppData\Local\Temp\tmpfk6jogim.webm: Permission denied," indicating that access to this file was denied.

No need for the actual screen recording file. I just wanted to see how large the file was.

I'll check on my end if that should be okay.

One thing you could do is make the file smaller (just use some online compression site) and try it. I think it should work.

Yes, you are right. i can work when i compress the file into a smaller one. thanks a lot.

@brettyoung6678 Awesome, I'll try to make it work for larger files as well.

@hei2077 thanks for looking at all the logs. There's a problem browser recorded webm videos not including the duration which might be causing this problem. I have to fix this in s2c codebase but can you try recording the video using a different app or taking the recorded video and converting it to MP4. That might fix your problem. The problem could also be with the permissions of the temp directory. Could you try Googling and seeing if there's a fix for this. I'm using the Python tempfile lib: https://docs.python.org/3/library/tempfile.html to store the video before processing.