In wireless communications, the available throughput depends on several parameters, like physical layer, base station distance, fading and interference. Users experience changes in bandwidth within a cell and among same-technology cells, but also among different networks. Moreover, in case of video transmission, the user may specify a desired quality level. The source should encode the stream at a quality as close as possible to this value, without exceeding the available bitrate. We propose a technique to decide whether to encode at constant quality, if resources are enough, or at constant bitrate, if the throughput is not sufficient. With negligible complexity, it proved to obtain better PSNR/bitrate ratios, with respect to only constant bitrate and only constant PSNR coding. We also show this algorithm working in a realistic scenario of a user roaming among heterogeneous networks (WLAN and UMTS). Also in this case, the algorithm proved to achieve high quality/bitrate ratios. 1