alexlaverty / python-reddit-youtube-bot

Automated Reddit Youtube Video Bot
https://www.youtube.com/channel/UCzIwW92D_rM5_yvWBsquSbw
75 stars 17 forks source link

Issue with background videos since last commit #95

Closed sebbourgeois closed 9 months ago

sebbourgeois commented 9 months ago

This is the error I get when I try to make a video with the setting enable_background set to True :

2023-11-07 23:06:15 INFO     Background : assets/backgrounds/NO COPYRIGHT MOTION GRAPHICS_2XX5zDThC3U.mp4
Traceback (most recent call last):
  File "/home/sb/videos-creation/python-reddit-youtube-bot/app.py", line 397, in <module>
    process_submissions(submissions)
  File "/home/sb/videos-creation/python-reddit-youtube-bot/app.py", line 64, in process_submissions
    process_submission(submission)
  File "/home/sb/videos-creation/python-reddit-youtube-bot/app.py", line 115, in process_submission
    vid.create(
  File "/home/sb/videos-creation/python-reddit-youtube-bot/video_generation/video.py", line 695, in create
    background_clip = background_clip.subclip(random_seconds, background_clip.duration)
  File "<decorator-gen-35>", line 2, in subclip
  File "/home/sb/.local/lib/python3.10/site-packages/moviepy/decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "<decorator-gen-34>", line 2, in subclip
  File "/home/sb/.local/lib/python3.10/site-packages/moviepy/decorators.py", line 32, in apply_to_mask
    newclip = f(clip, *a, **k)
  File "<decorator-gen-33>", line 2, in subclip
  File "/home/sb/.local/lib/python3.10/site-packages/moviepy/decorators.py", line 43, in apply_to_audio
    newclip = f(clip, *a, **k)
  File "/home/sb/.local/lib/python3.10/site-packages/moviepy/Clip.py", line 391, in subclip
    raise ValueError(
ValueError: t_start (108.91) should be smaller than the clip's duration (30.00).

If I disable it, the generation of the video works.

Subreddit I tested for reference : https://www.reddit.com/r/AskReddit/comments/17piped/what_are_some_signs_that_your_married_friend/

alexlaverty commented 9 months ago

have pushed a fix for this, can you pull latest and try

sebbourgeois commented 9 months ago

All good, thanks for the quick fix !