alexlaverty / python-reddit-youtube-bot

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

ERROR LONGS VIDEO NOT AS CONFIG : max_video_length #61

Open alexdo83 opened 1 year ago

alexdo83 commented 1 year ago

I tried many times but the output video is not the same as in the configuration section of "settings.py"

image

alexlaverty commented 1 year ago

I'll have a look at that post and see if I can see what's going on,

to understand the logic :

the script connects to the reddit post and pulls down the post title, body and comments. etc.

Then it will loop through the comments and filter out and remove comments based off certain criteria : https://github.com/alexlaverty/python-reddit-youtube-bot/blob/main/video_generation/video.py#L329-L385

the Length : 245 i can see in your screenshot is the number of characters in the comment string.

comment_limit is the number of comments it will attempt to screenshot and download.

the max_video_length each time it adds a comment to the video it checks to make sure the current length of the video does not exceed the max_video_length. So that's why it might be a lot shorter then you expect because it might have filtered out a lot of comments and never actually reached the max length.

alexlaverty commented 1 year ago

The code could probably be improved to first generate all the mp3 audio files until the max_video_length is reached, then attempt to only screenshot download those comments, instead of what it's currently doing which is downloading a predetermined number of comments and then only using some of the screenshots.