2

I shot a video with my phone in portrait orientation (vertically), which now I need to edit to make it fit properly in a landscape (horizontal) layout. When playing it on my computer and in any of the video editors available on linux, it looks like this.

Original

So what I want to do now, first and foremost, is rotate it 90 degrees and make it look like this.

Wanted

Basically, I want the result to be as tall as the width of the original video. Optionally, I want it to be as wide as the height of the original video.

However, what I get is a video which has the same dimensions as the original, without rotation, which therefore gets letter-boxed (black bands on its sides) and has the upper and lower parts cropped, like shown in this picture.

What I get instead

From what I understood, I should play with profiles, however I don't seem to get it right no matter what I do.

I'm fine with letter-box, but I don't want the video cropped, and I don't want to zoom out so that the image fits by losing vertical resolution.

Any help would be appreciated.

Max N
  • 1,134
  • 11
  • 23
Fabio A.
  • 2,517
  • 26
  • 35

3 Answers3

3

If you don't mind using ffmpeg, you can do:

ffplay input -vf 'rotate=angle=PI/2:out_w=ih:out_h=iw'

Replace "ffplay" with "ffmpeg" to encode to an output file. Replace "PI/2" with "-PI/2" to rotate counter clockwise.

Brian
  • 1,200
  • 6
  • 8
  • 1
    Except that gives you a portrait-oriented video, and his question says "fit properly in a horizontal layout." The real issue is about what is "proper?" Does he want to crop some of the original image and fill out more of the width or keep the entirety of the image and have padding? That to me is still unclear, but the Shotcut filter I pointed out (which uses MLT per the original question) offers the controls to let one choose what to do (not including distorting the aspect to stretch or scaling non-linearly). – Dan Dennedy Mar 10 '15 at 02:08
  • I agree that there is some confusion. The screen shots imply that he would like a vertical orientation. But some of the words suggest otherwise. – Brian Mar 10 '15 at 16:48
  • It could be that he/someone simply wants to rotate while maintaining original dimensions (out_w=ih:out_h=iw) in order to use MLT/Shotcut to prepare/convert videos - either for another tool or as a pre-processing step for later projects. This is definitely a use case where MLT falls short. It is not entirely impossible, but certainly inconvenient (custom mlt_profile and difficult-to-determine zoom level due to how the affine filter works). – Dan Dennedy Mar 11 '15 at 17:13
2

Shotcut, a MLT-based editor has a Rotate filter with pan and zoom controls that works good for this purpose. You do not need to make a custom MLT profile (Settings > Video Mode > Custom... in Shotcut) unless you do want a portrait/tall output video resolution (which you said you don't).

Dan Dennedy
  • 446
  • 4
  • 6
  • 1
    I used the rotate filter, but it produces the result shown in the third picture. I could then _zoom out_, but that is precisely what I do not want because I'd lose vertical resolution. – Fabio A. Mar 05 '15 at 15:33
  • Then zoom in! Do you need to scale more than 200%? – Dan Dennedy Mar 05 '15 at 17:19
1

I know this is an old question, but thought I'd add to it by saying.. if you ARE going to use ffmpeg then perhaps a combination of the following would bring about the (..I'm presuming) desired result.

ffmpeg -i video.mp4 -vf transpose=1 rotated.mp4

that rotates the video by 90 degrees clockwise, then,

ffmpeg -i rotated.mp4 -c:v h264 -s 1024x768 -aspect 16:9 output.mp4

this then stretches it out to the original dimensions, of course you might have to adapt the above for the file type and resolution/aspect ratio you have used. The result might look a bit "squashed" though.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
Martin A.
  • 11
  • 2