Maximofn commited on
Commit
3cba4b1
1 Parent(s): 0e7448c

Set slice_audio.py no verbose

Browse files
Files changed (1) hide show
  1. slice_audio.py +2 -5
slice_audio.py CHANGED
@@ -27,12 +27,10 @@ def main(args):
27
  # name, extension = input.split(".")
28
  path, filename = os.path.split(input)
29
  name, extension = os.path.splitext(filename)
30
- print(path, name, extension)
31
 
32
  # Get audio duration in seconds
33
  duration = float(os.popen(f'ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 {input}').read())
34
  hour, minute, second = seconds_to_hms(int(duration))
35
- print(f"Audio duration = {duration} = {hour}:{minute:02d}:{second}")
36
 
37
  # Number of chunks
38
  num_chunks = -(-int(duration) // SECONDS) # Redondeo hacia arriba
@@ -52,10 +50,9 @@ def main(args):
52
  output = f"{FOLDER}/{name}_chunk{chunk:003d}{extension}"
53
 
54
  if start_time + SECONDS > duration:
55
- command = f'ffmpeg -i {input} -ss {hour_start:02d}:{minute_start:02d}:{second_start:02d} {output}'
56
  else:
57
- command = f'ffmpeg -i {input} -ss {hour_start:02d}:{minute_start:02d}:{second_start:02d} -t {hour:02}:{minute:02}:{second:02} {output}'
58
- print(command)
59
  os.system(command)
60
 
61
  output_files.append(output)
 
27
  # name, extension = input.split(".")
28
  path, filename = os.path.split(input)
29
  name, extension = os.path.splitext(filename)
 
30
 
31
  # Get audio duration in seconds
32
  duration = float(os.popen(f'ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 {input}').read())
33
  hour, minute, second = seconds_to_hms(int(duration))
 
34
 
35
  # Number of chunks
36
  num_chunks = -(-int(duration) // SECONDS) # Redondeo hacia arriba
 
50
  output = f"{FOLDER}/{name}_chunk{chunk:003d}{extension}"
51
 
52
  if start_time + SECONDS > duration:
53
+ command = f'ffmpeg -i {input} -ss {hour_start:02d}:{minute_start:02d}:{second_start:02d} -loglevel error {output}'
54
  else:
55
+ command = f'ffmpeg -i {input} -ss {hour_start:02d}:{minute_start:02d}:{second_start:02d} -t {hour:02}:{minute:02}:{second:02} -loglevel error {output}'
 
56
  os.system(command)
57
 
58
  output_files.append(output)