This module includes video and audio utilities to go along with the core module to make synthetic video generation a smooth experience.
to_hhmmss(5)
to_hhmmss(10000)
Note:
test_eq
tests if the two things are equal while test_fail
makes sure it’s expected to fail for those argumentstest_eq(to_hhmmss(100), '00:01:40')
test_eq(to_hhmmss(0), '00:00:00')
test_fail(to_hhmmss, -1)
to_secs('02:46:40')
to_secs('00:01:05')
test_eq(to_secs('00:00:00'), 0)
test_eq(to_secs('00:00:05'), 5)
display_video('Anna.mp4')
check_resolution('Anna.mp4')
assert check_resolution('Anna.mp4') == {'height': 720, 'width': 1280}
check_fps('Anna.mp4')
check_fps('Anna.mp4', round_res = True)
assert check_fps('Anna.mp4') == 29.97
assert check_fps('Anna.mp4', True) == 30
Let's convert a .wav
file to a .mp3
file
change_audio_format('demo_audio.wav', 'my_audio.mp3')
change_audio_format('my_audio.mp3', 'another_audio.flac')
play_audio('my_audio.mp3')
trim_audio('my_audio.mp3', 0, 5)
play_audio('trimmed_audio.mp3')
trim_audio('my_audio.mp3', 5, 10, 'small_audio.mp3')
play_audio('small_audio.mp3')
Note: The output for
trim_audio
can be in a different format than the inputtrim_audio('my_audio.mp3', 10, 15, 'small_audio.wav')
play_audio('small_audio.wav')
play_audio('small_audio.wav')
loud_audio = change_volume('small_audio.wav', 5)
play_audio(loud_audio)
quiet_audio = change_volume('small_audio.wav', -5)
play_audio(quiet_audio)
looped_audio = loop_audio('small_audio.mp3')
play_audio(looped_audio)
looped_audio = loop_audio('small_audio.mp3', 4)
play_audio(looped_audio)
c = concat_audios('trimmed_audio.mp3', 'small_audio.mp3')
play_audio(c)
c = concat_audios('trimmed_audio.mp3', ['small_audio.mp3', 'small_audio.wav'])
play_audio(c)