Change video name instead of overwriting the existing video?
Hey, I've made a script to auto run the process. It can make a bunch of videos and is fully automatic. I'd like to have it be fully automatic although the existing video gets overwritten. Is there any way to have the video name change itself after completing so it won't overwrite it?
sure. in final_video.py L57 thats where the file name is picked just replace final_video with {os.getenv("POST_ID")} and in askreddit.py just add os.environ["POST_ID"] = str(submission) after L26
then the file name would be the Reddit post's ID (you can also replace submission with submission.title if you want the posts title instead of the id)
or even easier but lame imo replace
final.write_videofile(
"assets/final_video.mp4", fps=30, audio_codec="aac", audio_bitrate="192k"
)
with
final.write_videofile(
f"assets/{len(os.listdir('./assets'))}.mp4", fps=30, audio_codec="aac", audio_bitrate="192k"
and the file names will be like 1.mp4, 2.mp4......
I tried with the reddit post name but I get the below error:
Traceback (most recent call last):
File "C:\r\main.py", line 22, in <module>
final_video = make_final_video(number_of_comments)
File "C:\r\video_creation\final_video.py", line 57, in make_final_video
f"assets/{len(os.listdir('./assets'))}.mp4", fps=30, audio_codec="aac", audio_bitrate="192k"
NameError: name 'os' is not defined
You have to import OS
what do you mean by import os ? sorry im kinda new haha
At the top of the file type Import os
oh perfect thank you seems to work although I am stugeling to get find an outrun solution like every 10 min or when its complete any idea on that ? Thanks in advance
please clarify
I mean if you might have an idea how to implement an end of autorun so every time it completes a video it directly starts a new one
you could add os.system('python main.py') at the bottom of the main.py file in the if main block
oh shit thx ill try it out later
oh shit thx ill try it out later
oh perfect thank you seems to work although I am stugeling to get find an outrun solution like every 10 min or when its complete any idea on that ? Thanks in advance
Where exactly did you put the Import OS command Im also very new to this Update fixed it
Hi @Goodgamer78,
I hope you were able to resolve your issue as there has not been activity in this Issue, I will be closing this for the time being. Feel free to re-open the issue if it has not been solved!!
Happy Coding!