Welcome to Android Forums, Gecko114!
sometimes delete the videos itself
What you're describing simply doesn't make sense. Neither Android, nor the OS it's based on, Linux, randomly or arbitrarily will delete files. Window$? Perhaps. But not Linux. It takes some form of user action for files to be deleted.
'User action' may mean something obvious, like selecting a file and pressing 'delete.' But it can also mean something less obvious, like a setting within an app.
For example, in my Ring app, I can set parameters for when/whether to delete images/videos. Like, save only up to X number of images, or delete images more than Y days old. Perhaps some app you're using has similar options--and you set them.
would sometimes delete the videos itself but not the folders.
This makes me even more convinced of the above. I use
F-Stop Gallery Pro. Here's what its help page says about how it deletes files:
"Deleting a folder will not delete the entire folder from disk unless it is completely empty. Instead, it will only delete the valid media in that folder that causes the folder to disappear from the folders view. This is done intentionally since you may have other files in the folder that you do not want to delete but isn’t shown to you by F-Stop."
Perhaps you have something similar going on.
Please let us know which media apps you're using, i.e., apps for taking/managing/viewing images and videos. If they're in the Play Store, providing links to them would be helpful.