diff --git a/vid_to_mp4/README.md b/vid_to_mp4/README.md new file mode 100644 index 000000000..58f1609f9 --- /dev/null +++ b/vid_to_mp4/README.md @@ -0,0 +1,12 @@ +#Description: **Other Video format to mp4 converter** + +#Setup instructions: +-it is simple if you have python installed on your machine -you need to run vid_to_mp4.py in terminal -by typing 'python' for windows and 'python3' for Linux -it will go like this 'python vid_to_mp4.py' or 'python3 vid_to_mp4.py' -this will ask for prompts on the cmd. Fill in the required information + +-if you didn't install python on your machine. -here is the installation guide https://realpython.com/installing-python/ please refer to it. + +#Output: +File Saved! + +#Author: +[shrivastavanolo](https://github.com/shrivastavanolo) diff --git a/vid_to_mp4/vid_to_mp4 b/vid_to_mp4/vid_to_mp4 new file mode 100644 index 000000000..ff54fec36 --- /dev/null +++ b/vid_to_mp4/vid_to_mp4 @@ -0,0 +1,25 @@ +import subprocess +import os + +src = input("Enter the source file path: ") +dst = input("Enter the destination file path: ") + +for root, dirs, filenames in os.walk(src, topdown=False): + # Print the filename + for filename in filenames: + print('[INFO] 1', filename) + try: + # These are valid video formats that can be converted to .mp4 file + valid_formats = [".flv", ".mp4", ".avi", ".mov"] + _format = '' + dot = filename.index('.') + _format = filename[dot:] + if _format in valid_formats: + inputfile = os.path.join(root, filename) + print('[INFO] 1', inputfile) + new_file = filename.lower().replace(_format, ".mp4") + outputfile = os.path.join(dst, ) + caller = ['ffmpeg', '-i', inputfile, outputfile] + subprocess.call(caller, new_file) + except Exception: + print("An exception occurred")