Aimed at controlling the nitrogen loss caused by the ammonia gas emission during composting, the mixtures of magnesium hydroxide [Mg(OH)2] and phosphoric acid (H3PO4) were added into composting materials of swine manure and cornstalk. After 26 d composting, ammonical nitrogen and total nitrogen were improved obviously,which were 10.7 g x kg(-1) and 36.9 g x kg(-1) respectively in amended treatment (B), while they were 7.7 g x kg(-1) and 26.8 g x kg(-1) in un-amended trial. By analysis of the total organic carbon, t suggested that amendments accelerated the degradation of organic matter, germination index test showed the maturity of trial B(96%) was better than trial A(82%) in final compost. The scanning electron microscopy (SEM) and energy dispersive X-ray spectroscopy (EDS) analysis confirmed the existence of struvite (MgNH4PO4 x 6H2O). These results indicated that Mg (OH)2 and H3PO4 could accelerate the degradation of organic matter, and reduce the ammonia emission by struvite crystallization reaction.