Content adaptation is an effective solution to support the quality of service for multimedia services over heterogeneous networks. This paper deals with the accuracy and the real-time processing, two important issues in making decision on content adaptation. We present the content adaptation as a constrained optimization problem, considering both modality conversion and content scaling. To this problem, we propose an optimal algorithm and a fast approximation based on the Viterbi algorithm of dynamic programming. Through experiments, we show that the proposed algorithms can enable accurate adaptation decisions and can support the real-time requirement.