Created
April 15, 2020 10:09
-
-
Save hvrauhal/d6c1d81e632ccb288d40e9e33d3c8184 to your computer and use it in GitHub Desktop.
Generate video sample files suitable for Android Emulator testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
# Audio generation | |
python3 - << EOF | |
import subprocess | |
sounds = [ | |
'Start playing', | |
'30 seconds', | |
'1 minute', | |
'1 minute 30 seconds', | |
'2 minutes', | |
'2 minutes 30 seconds', | |
'3 minutes', | |
'3 minutes 30 seconds', | |
'4 minutes', | |
'4 minutes 30 seconds' | |
] | |
for v, i in enumerate(sounds): | |
filename=f'sample_{v:02}_unpadded.aiff' | |
out_filename=f'sample_{v:02}.wav' | |
subprocess.run(['say', '-v', 'Ava', i, '-o', filename]) | |
subprocess.run(['ffmpeg', '-y', '-i', filename, '-filter','apad=whole_dur=30', out_filename]) | |
EOF | |
sox sample*.wav out.wav | |
rm sample*wav | |
# Video generation | |
# | |
# -vprofile baseline to support playback in android emulator https://stackoverflow.com/questions/4910222/what-formats-of-video-will-play-in-emulator/13030509#13030509 | |
ffmpeg -y -i out.wav -c:a aac -f lavfi -i testsrc2=duration=300:size=1280x720:rate=30 -vcodec libx264 -vprofile baseline -tune animation -crf 41 test_1280_16_9.mp4 | |
ffmpeg -y -i out.wav -c:a aac -f lavfi -i testsrc2=duration=300:size=960x720:rate=30 -vcodec libx264 -vprofile baseline -tune animation -crf 41 test_960_3_4.mp4 | |
Author
hvrauhal
commented
Jun 24, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment