diff --git a/src/media/video/filter_transpose.cpp b/src/media/video/filter_transpose.cpp index 3a2c90e9e5c1b2124889445ee2850b11240ce4f0..780a273e4ee94c756b88c78f64cd99341862c510 100644 --- a/src/media/video/filter_transpose.cpp +++ b/src/media/video/filter_transpose.cpp @@ -43,9 +43,14 @@ getTransposeFilter(int rotation, std::string inputName, int width, int height, i case 90: case -270: ss << "transpose=2"; - if (rescale) - ss << ", scale=w=-1:h=" << height - << ", pad=" << width << ":" << height << ":(ow-iw)/2"; + if (rescale) { + if (width > height) + ss << ", scale=w=-1:h=" << height + << ", pad=" << width << ":" << height << ":(ow-iw)/2"; + else + ss << ", scale=w=" << width << ":h=-1" + << ", pad=" << width << ":" << height << ":0:(oh-ih)/2"; + } break; case 180 : case -180 : @@ -54,9 +59,14 @@ getTransposeFilter(int rotation, std::string inputName, int width, int height, i case 270 : case -90 : ss << "transpose=1"; - if (rescale) - ss << ", scale=w=-1:h=" << height - << ", pad=" << width << ":" << height << ":(ow-iw)/2"; + if (rescale) { + if (width > height) + ss << ", scale=w=-1:h=" << height + << ", pad=" << width << ":" << height << ":(ow-iw)/2"; + else + ss << ", scale=w=" << width << ":h=-1" + << ", pad=" << width << ":" << height << ":0:(oh-ih)/2"; + } break; default : return {}; diff --git a/src/media/video/video_mixer.cpp b/src/media/video/video_mixer.cpp index 502b175f0b5942ed49ae24f551e9c3c7c8cf1035..2827f9560a780e769e55ef23b92c4cf0bdc95636 100644 --- a/src/media/video/video_mixer.cpp +++ b/src/media/video/video_mixer.cpp @@ -213,7 +213,7 @@ VideoMixer::render_frame(VideoFrame& output, const VideoFrame& input, const constexpr char filterIn[] = "mixin"; if (angle != source->rotation) { source->rotationFilter = video::getTransposeFilter(angle, filterIn, - frame->width(), frame->height(), frame->format(), true); + frame->width(), frame->height(), frame->format(), false); source->rotation = angle; } if (source->rotationFilter) {