Driven by the large-scale video traffic, mobile edge computing (MEC) has emerged as a promising technique that extends cloud-computing capabilities to the proximate small base stations (SBSs) in wireless networks, especially in ultra-dense networks (UDNs). With MEC, video transcoding, which processes the adaptive bitrates of a video and provides the adaptive video streaming to users, can significantly release the backhaul burden of networks. However, video transcoding is a time-consuming task, and how to guarantee quality-of- service (QoS) for large video data with MEC is still challenging. To address this issue, in this paper, we propose a joint SBSs selection, tasks scheduling, and resource allocation approach for achieving a delay- optimal transcoding under the constraints of network cost. Specifically, to reduce the delay, a set of SBSs are formed into a Virtual SBSs Group (VSG) to perform the video transcoding and delivering in parallel for a given user. Then, the joint tasks scheduling and feasible resource allocation are performed to minimizing total delay while maintaining a low network cost. The optimization problem is formulated as a mixed integer non- convex programming problem and a three-stage search solution is proposed to solve it. Simulation results show that our proposed approach can significantly improve the transcoding performance while satisfying the resource consumption constraint.