slider.py 997 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env python
  2. import os
  3. import requests
  4. import re
  5. textfile = "slider.txt"
  6. audio = "C:\\SGZ_Pro\\Hobbys\\Media\\music\\lukrembo - butter (royalty free vlog music) [Ua7Qfc1xu90].mp3"
  7. with open(textfile,"r") as f:
  8. data = f.read()
  9. # This assumes you have stuff in '' not ""
  10. files = re.findall("'(.+?)'",data)
  11. for file in files:
  12. if file.endswith(".jpg") or file.endswith(".jpeg"):
  13. beforedot = url.split(".")[0]
  14. os.system(f"ffmpeg -y -i {file} -preset ultrafast {beforedot}.png")
  15. os.remove(file)
  16. for file in files:
  17. if file.endswith(".png"):
  18. os.system(f'ffmpeg -i {file} -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1:color=black" edit-{file}')
  19. os.remove(file)
  20. os.rename("edit-"+file,file)
  21. os.system(f"ffmpeg -f concat -i {textfile} -vsync vfr -pix_fmt yuv420p input.mp4")
  22. os.system(f'ffmpeg -y -i input.mp4 -i "{audio}" -filter_complex \" [1:0] apad \" -shortest output.mp4')
  23. os.remove("input.mp4")