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

Patch 1 #947

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions vid_to_mp4/README.md
Original file line number Diff line number Diff line change
@@ -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)
25 changes: 25 additions & 0 deletions vid_to_mp4/vid_to_mp4
Original file line number Diff line number Diff line change
@@ -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")