From a1da22e890ff269e4b5c272c46526335f62b8028 Mon Sep 17 00:00:00 2001 From: ambushneupane Date: Wed, 5 Oct 2022 10:16:10 +0530 Subject: [PATCH 1/5] Add Video Merger --- AutomationScripts/Video_Merger/README.md | 5 +++++ AutomationScripts/Video_Merger/listvideos.py | 17 ++++++++++++++++ AutomationScripts/Video_Merger/main.py | 7 +++++++ AutomationScripts/Video_Merger/renderVideo.py | 20 +++++++++++++++++++ .../Video_Merger/requirements.txt | 2 ++ 5 files changed, 51 insertions(+) create mode 100644 AutomationScripts/Video_Merger/README.md create mode 100644 AutomationScripts/Video_Merger/listvideos.py create mode 100644 AutomationScripts/Video_Merger/main.py create mode 100644 AutomationScripts/Video_Merger/renderVideo.py create mode 100644 AutomationScripts/Video_Merger/requirements.txt diff --git a/AutomationScripts/Video_Merger/README.md b/AutomationScripts/Video_Merger/README.md new file mode 100644 index 000000000..838c1dbca --- /dev/null +++ b/AutomationScripts/Video_Merger/README.md @@ -0,0 +1,5 @@ +# Video Merger +## How it Works:- +This script is useful to merge small videos (mp4 only) into a single video. Here you have to enter the full path of where the videos are located and the script displayes the all the mp4 videos and starts merging them. Also you have to specify which location you want the video to be in. +## Author:- +Ambush Neupane diff --git a/AutomationScripts/Video_Merger/listvideos.py b/AutomationScripts/Video_Merger/listvideos.py new file mode 100644 index 000000000..3c71f8766 --- /dev/null +++ b/AutomationScripts/Video_Merger/listvideos.py @@ -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}') diff --git a/AutomationScripts/Video_Merger/main.py b/AutomationScripts/Video_Merger/main.py new file mode 100644 index 000000000..7a4a15a01 --- /dev/null +++ b/AutomationScripts/Video_Merger/main.py @@ -0,0 +1,7 @@ +from renderVideo import renderFinalVideo + +def main(): + renderFinalVideo() + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/AutomationScripts/Video_Merger/renderVideo.py b/AutomationScripts/Video_Merger/renderVideo.py new file mode 100644 index 000000000..2c7be79d9 --- /dev/null +++ b/AutomationScripts/Video_Merger/renderVideo.py @@ -0,0 +1,20 @@ +from moviepy.editor import VideoFileClip,concatenate_videoclips +from listvideos import videoslist,pathOfVideo +import os + + +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}") \ No newline at end of file diff --git a/AutomationScripts/Video_Merger/requirements.txt b/AutomationScripts/Video_Merger/requirements.txt new file mode 100644 index 000000000..e6c5c842e --- /dev/null +++ b/AutomationScripts/Video_Merger/requirements.txt @@ -0,0 +1,2 @@ +Libraries used: moviepy, os + From 2a18f1dd7a27aba1daf8de323bf118bcf9471112 Mon Sep 17 00:00:00 2001 From: Ambush <56769633+ambushneupane@users.noreply.github.com> Date: Sat, 8 Oct 2022 13:48:21 +0530 Subject: [PATCH 2/5] Renamed file name --- AutomationScripts/Video_Merger/{listvideos.py => list_videos.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename AutomationScripts/Video_Merger/{listvideos.py => list_videos.py} (100%) diff --git a/AutomationScripts/Video_Merger/listvideos.py b/AutomationScripts/Video_Merger/list_videos.py similarity index 100% rename from AutomationScripts/Video_Merger/listvideos.py rename to AutomationScripts/Video_Merger/list_videos.py From 6aab058e8f00756b18f90ec4fca1049b84ca1e54 Mon Sep 17 00:00:00 2001 From: Ambush <56769633+ambushneupane@users.noreply.github.com> Date: Sat, 8 Oct 2022 13:49:31 +0530 Subject: [PATCH 3/5] Updated File Name --- .../Video_Merger/{renderVideo.py => render_Video.py} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename AutomationScripts/Video_Merger/{renderVideo.py => render_Video.py} (93%) diff --git a/AutomationScripts/Video_Merger/renderVideo.py b/AutomationScripts/Video_Merger/render_Video.py similarity index 93% rename from AutomationScripts/Video_Merger/renderVideo.py rename to AutomationScripts/Video_Merger/render_Video.py index 2c7be79d9..2d6d6324f 100644 --- a/AutomationScripts/Video_Merger/renderVideo.py +++ b/AutomationScripts/Video_Merger/render_Video.py @@ -2,7 +2,7 @@ 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') @@ -17,4 +17,4 @@ def renderFinalVideo(): print("Sorry the extension must be .mp4") else: - print(f"Sorry Error Occured!!!Make sure this path exists:- {filePath}") \ No newline at end of file + print(f"Sorry Error Occured!!!Make sure this path exists:- {filePath}") From 48f2d3e6e365d42dfad6c2509abd8e1b43076012 Mon Sep 17 00:00:00 2001 From: Ambush <56769633+ambushneupane@users.noreply.github.com> Date: Sat, 8 Oct 2022 13:57:09 +0530 Subject: [PATCH 4/5] Updated README.md --- AutomationScripts/Video_Merger/README.md | 35 +++++++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/AutomationScripts/Video_Merger/README.md b/AutomationScripts/Video_Merger/README.md index 838c1dbca..e8af9d9a9 100644 --- a/AutomationScripts/Video_Merger/README.md +++ b/AutomationScripts/Video_Merger/README.md @@ -1,5 +1,32 @@ -# Video Merger -## How it Works:- -This script is useful to merge small videos (mp4 only) into a single video. Here you have to enter the full path of where the videos are located and the script displayes the all the mp4 videos and starts merging them. Also you have to specify which location you want the video to be in. -## Author:- +# 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 + From 5e93487596e22de09077731367ae03d7f053f956 Mon Sep 17 00:00:00 2001 From: Ambush <56769633+ambushneupane@users.noreply.github.com> Date: Sun, 16 Oct 2022 15:27:32 +0530 Subject: [PATCH 5/5] Update README.md --- AutomationScripts/Video_Merger/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/AutomationScripts/Video_Merger/README.md b/AutomationScripts/Video_Merger/README.md index e8af9d9a9..e5fa4a505 100644 --- a/AutomationScripts/Video_Merger/README.md +++ b/AutomationScripts/Video_Merger/README.md @@ -11,13 +11,16 @@ The Purpose of the project is to help you combine many videos into a single vide ## Short description of package/script - Helps to make a sinle video from many videos. +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 -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 +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