Find a file in the directory ~/path with either the .avi or .mp4 extension, randomly select one of them, and display the first one.
find ~/path -type f \( -name "*.avi" -o -name "*.mp4" \) | shuf | head -n 1