Skip to content

Commit ab35270

Browse files
authored
Merge pull request #304 from lovishprabhakar02/main
Added Video to audio convertor
2 parents 9285b34 + f6cb385 commit ab35270

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,7 @@ Once you are done working on your script edit this `README.md` file and add the
9999
72| QR and Barcode Scanner | Scans both QR Codes and Barcodes | [Find me Here](https://github.com/GDSC-RCCIIT/General-Purpose-Scripts/tree/main/scripts/QR%20and%20Barcode%20Scanner) |
100100
73| PDF-Delete-Pages | Deletes pages from PDF as entered by the user | [Find me Here](https://github.com/GDSC-RCCIIT/General-Purpose-Scripts/tree/main/scripts/PDF-Delete-Pages) |
101101
74| Copy to clipboard | Copies contents form a text file to your clipboard | [Find me Here](https://github.com/GDSC-RCCIIT/General-Purpose-Scripts/tree/main/scripts/Copy%20to%20clipboard) |
102-
75| Audio Recorder | Records audio from system's audio input device for `n` seconds | [Find me Here](https://github.com/GDSC-RCCIIT/General-Purpose-Scripts/tree/main/scripts/Audio%20Recorder) |
102+
75| Video-to-audio Convertor | Extracts audios from videos. | [Find me here](https://github.com/GDSC-RCCIIT/General-Purpose-Scripts/tree/main/scripts/Video-to-audio-convertor) |
103+
76| Audio Recorder | Records audio from system's audio input device for `n` seconds | [Find me Here](https://github.com/GDSC-RCCIIT/General-Purpose-Scripts/tree/main/scripts/Audio%20Recorder) |
104+
103105
### Good Luck and don't forget to have fun with Open Source 🚀
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# To extract audio from a video, follow these steps:
2+
3+
1. Clone the repository with `https://github.com/GDSC-RCCIIT/General-Purpose-Scripts.git`.
4+
2. Change your working directory to the directory of this script using: `cd General-Purpose-Scripts/scripts/Video-to-audio-convertor`.
5+
3. Install the dependencies using `pip install -r requirements.txt`.
6+
4. Run the vid_to_aud.py file in terminal with `python3 vid_to_aud.py`.
7+
5. Enter the path of the video in the terminal as shown:
8+
9+
10+
![image](https://user-images.githubusercontent.com/89595539/137353286-bc53a567-d888-4929-bb8b-8be0b9fe7354.png)
11+
12+
13+
14+
6. Press Enter.
15+
7. The extracted audio will be saved in the same directory as `vid_to_aud.py` as shown:
16+
17+
18+
![image](https://user-images.githubusercontent.com/89595539/137309482-5425f60d-8b8a-4ffa-ad20-a8f508ee214f.png)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
moviepy==1.0.3
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import moviepy.editor
2+
from moviepy.video.VideoClip import VideoClip
3+
from pathlib import Path
4+
5+
try:
6+
# to select the video file:
7+
a = input("Enter the path of the video:\n")
8+
video = moviepy.editor.VideoFileClip(a) # Add path of your video in the terminal
9+
10+
# to create the audio file:
11+
12+
audio = video.audio
13+
audio.write_audiofile(
14+
"extractedaudio.mp3"
15+
) # audio will be saved as extractedaudio.mp3 in the current directory.
16+
17+
except Exception as e:
18+
print("Error:", e)
19+
exit(1)

0 commit comments

Comments
 (0)