Skip to content

Commit

Permalink
Merge pull request #5 from Abinash-bit/Abinash-bit-patch-5
Browse files Browse the repository at this point in the history
Trim_Audio
  • Loading branch information
Abinash-bit authored Sep 9, 2024
2 parents fd81b95 + 67d8734 commit 296ac6a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Trim_Audio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def trim_audio(input_file_path, output_file_path, start_time, end_time):
# Load the video file
audio = AudioSegment.from_wav(input_file_path)
# Trim the video
trimmed_audio = audio[start_time * 1000:end_time * 1000]
# Save the trimmed video
trimmed_audio.export(output_file_path, format="wav")

# Example usage:
input_file_path = 'input.wav'
output_file_path = 'trimmed_output.wav'
start_time = 10 # in seconds
end_time = 20 # in seconds
trim_audio(input_file_path, output_file_path, start_time, end_time)

0 comments on commit 296ac6a

Please sign in to comment.