Amalgamated free products of weakly rigid factors and calculation of their symmetry groups