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 all 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
35 changes: 35 additions & 0 deletions AutomationScripts/Video_Merger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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
When you have many small videos and have to complete all of them then it's a real problem cause every time the video ends you have to play the next video, It would be great if you can combine those videos into a single video and relax on the couch and enjoy the video. Well, that's what this script exactly does for you.



## Workflow of the Project

1) Firstly it asks where the videos are located
2) It then Grabs the videos from the given location and combines them into a single video
3) At last, It asks you the location where you want to store the file
4) Creates a single merged video in the given location .

## 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