Skip to content

Commit

Permalink
fixing audio file creation
Browse files Browse the repository at this point in the history
  • Loading branch information
joelibaceta committed Dec 10, 2018
1 parent af3ce11 commit c6d71d8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion video_to_ascii/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ def main():
PARSER.add_argument('--strategy', default='ascii-color', type=str, dest='strategy',
choices=["ascii-color", "just-ascii", "filled-ascii"], help='choose an strategy to render the output', action='store')
PARSER.add_argument('-o', '--output', type=str, dest='output', help='output file to export', action='store')
PARSER.add_argument('-a','--with-audio', dest='with_audio', help='play audio track', action='store_true')

ARGS = PARSER.parse_args()

player.play(ARGS.file, strategy=ARGS.strategy, output=ARGS.output)
player.play(ARGS.file, strategy=ARGS.strategy, output=ARGS.output, play_audio=ARGS.with_audio)


if __name__ == '__main__':
Expand Down
3 changes: 2 additions & 1 deletion video_to_ascii/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ def play(filename, strategy=None, output=None, play_audio=False):
if play_audio:
import ffmpeg
temp_dir = tempfile.gettempdir()
temp_file_path = temp_dir + "/temp.wav"
temp_file_path = temp_dir + "/temp-audiofile-for-vta.wav"
stream = ffmpeg.input(filename)
stream = ffmpeg.output(stream, temp_file_path)
stream = ffmpeg.overwrite_output(stream)
ffmpeg.run(stream)
engine.with_audio = True
if strategy is not None:
Expand Down
2 changes: 1 addition & 1 deletion video_to_ascii/render_strategy/ascii_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def render(self, cap, output=None, with_audio=False):
import wave

temp_dir = tempfile.gettempdir()
temp_file_path = temp_dir + "/temp.wav"
temp_file_path = temp_dir + "/temp-audiofile-for-vta.wav"
wave_file = wave.open(temp_file_path, 'rb')
chunk = int(44100 / fps)
p = pyaudio.PyAudio()
Expand Down

0 comments on commit c6d71d8

Please sign in to comment.