Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video Merger #1099

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions AutomationScripts/Video_Merger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Package/Script Name

## Aim

The main aim of the project is to Merge many videos into a single Video.


## Purpose

The Purpose of the project is to help you combine many videos into a single video.


## Short description of package/script
Helps to make a sinle video from many videos.



## Workflow of the Project

Firstly it asks where the videos are located It then Grabs the videos from the given location and combines them into a single video and at last It asks you the location where you want to store the file

## Setup instructions
Open the Terminal
Install the packages mentioned in requirements.txt
On the terminal enter ```python main.py```



## Author(s)

Ambush Neupane

17 changes: 17 additions & 0 deletions AutomationScripts/Video_Merger/list_videos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

#this script returns the list of videos (.mp4) from the path you choose.
import os
pathOfVideo=input("Enter the full path where videos are located.")

def array_Of_Videos():
fileExists= os.path.exists(pathOfVideo) #returns a boolen

if fileExists:
dirList= sorted(os.listdir(pathOfVideo)) #returns list of files inside the path
return [files for files in dirList if files.endswith(".mp4") ]

else:
print(f"No such path as {pathOfVideo}")

videoslist= array_Of_Videos()
print(f'If the sequence of the videos doesn\'t look like Following. You can press Control + C to kill the program.\n{videoslist}')
7 changes: 7 additions & 0 deletions AutomationScripts/Video_Merger/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from renderVideo import renderFinalVideo

def main():
renderFinalVideo()

if __name__ == '__main__':
main()
20 changes: 20 additions & 0 deletions AutomationScripts/Video_Merger/render_Video.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from moviepy.editor import VideoFileClip,concatenate_videoclips
from listvideos import videoslist,pathOfVideo
import os

#Taking Input about Video Location.
def renderFinalVideo():
videoNames=[VideoFileClip(os.path.join(pathOfVideo, video)) for video in videoslist]
final_video = concatenate_videoclips(videoNames,method='compose')
filePath= input("Enter location to save file:-")
filePathExists= os.path.exists(filePath)
if filePathExists:
fileName= input("Enter file name;-")

if fileName.endswith(".mp4"):
final_video.write_videofile(os.path.join(filePath,fileName))
else:
print("Sorry the extension must be .mp4")

else:
print(f"Sorry Error Occured!!!Make sure this path exists:- {filePath}")
2 changes: 2 additions & 0 deletions AutomationScripts/Video_Merger/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Libraries used: moviepy, os