def test_setaudio(util): clip = ColorClip(size=(100, 60), color=(255, 0, 0), duration=0.5) make_frame_440 = lambda t: [np.sin(440 * 2 * np.pi * t)] audio = AudioClip(make_frame_440, duration=0.5) audio.fps = 44100 clip = clip.with_audio(audio) location = os.path.join(util.TMP_DIR, "setaudio.mp4") clip.write_videofile(location, fps=24) assert os.path.isfile(location)
def test_setaudio(): clip = ColorClip(size=(100, 60), color=(255, 0, 0), duration=0.5) make_frame_440 = lambda t: [sin(440 * 2 * pi * t)] audio = AudioClip(make_frame_440, duration=0.5) audio.fps = 44100 clip = clip.set_audio(audio) location = os.path.join(TMP_DIR, "setaudio.mp4") clip.write_videofile(location, fps=24) assert os.path.isfile(location) close_all_clips(locals())