Portrait format import (variable bit rate)

I’m a very new Kdenlive user. I have a source video clip taken on a mobile phone (Android) that is too large for convenience (679MB). I want to use Kdenlive to edit it to substantially reduce the size.

Issue

The video was shot in vertical/portrait format, and it seems it uses a variable bit rate mp4 encoding scheme.

I set the project to “vertical HD 30fps”. When I load the clip KDL warns me that a variable bitrate is used, which might cause audio sync issues. It recommends transcoding the clip to a different format (the default is “lossy x264 I frame only VAAPI GPU”).

  1. If I transcode the clip, at best I get a landscape result. At worst it ends up with the image shrunk and rotated into a portrait letterbox in a 1920x1080 landscape video, plus the whole project gets switched to landscape(!?)
  2. If I don’t transcode the clip, i’ve found I can do at least basic edits (all I need) successfully, but when I try to render the result the render process crashes.

A guess is that the phone is not recording “raw” portrait 1080x1920 video, but is storing the video as landscape format 1080p with a “rotated” metadata tag that Kdenlive is not honoring.

There has to be a simple way to deal with this. I haven’t found a simple “switch landscape to/from portrait” option. What’s the best way of dealing with it?, any suggestions welcome.

System Info

Operating System: EndeavourOS
KDE Plasma Version: 6.6.5
KDE Frameworks Version: 6.26.0
Qt Version: 6.11.1
Kernel Version: 7.0.11-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 7700 8-Core Processor
Memory: 32 GiB of RAM (30.4 GiB usable)

It is variable frame rate that’s causing the issue.

Try running it through Handbrake for the transcoding step before loading it into Kdenlive.

Can you run Kdenlive from the command line, load the project, make a few cuts, render it, and then post the console output here (as an attachment, please!) when it crashes?

Thanks for the suggestions. I carried on fiddling with this and made some progress.

On the import - I accepted the transcode, which caused the conversion to landscape mode, then manually worked out the transformation parameters to rotate and scale the source clip back to portrait. Really clunky (there needs to be an easy way to do this) but it worked.

The rendering issue seemed to linked to the classic Linux issue of pathnames. My project name was quite a long string with spaces and other punctuation. I changed the output file name to a minimal “8.3” name using only alphabetic characters, and the render stage ran to completion.

Again, ideally KDL should be able to handle non-trivial pathnames, but at least i now know what was causes the crashes.

Glad you could get it to work.

This needs to be investigated. Can you please open a bug report for that? Thanks.

The rendering issue seemed to linked to the classic Linux issue of pathnames.

I thought this used to be a Windows problem. Needs investigating. Please create a bug report and provide the full path or at least the project name that may have caused the crash. Thanks.

Happy to report these.

then manually worked out the transformation parameters to rotate and scale the source clip back to portrait.

If you go to the Logging layout, there is a tab with a pencil. In there, you can edit the rotation. I use it all the time.

Thanks. I wonder why it’s not included in the editing layout? As a newbie I don’t yet understand what the logging view is even for, but i’m sure i’ll get there.

One question I do have- if the portrait format source is incorrectly rotated and letterboxed to 1080x1920, does rotating it back to portrait format involve a loss of quality as the long axis is scaled from 1080 back to 1920 pixels?

The whole purpose of editing the rotation as a “logging” or pre-editing step rather than doing it while editing is to not lose quality, as if you rotate a video multiple times, you can get the exact loss of quality from constant scaling you talked about.

When you rotate a clip before using the Clip Properties tab (that was the name I was looking for), I believe it edits the way Kdenlive sees the video - it thinks that you gave it a vertical video, or vice versa. It doesn’t involve any scaling, just rotating the pixels. In fact, many vertical videos have metadata stored in them that tells programs like Kdenlive that this video should be rotated.

For example, in the screenshots below, you can see that the vertical video I recorded on my phone has the rotation set to 90° on import. Thus, it is technically a rotated horizontal video.


To put it simply, no, rotating the video through it’s properties doesn’t affect quality.

It is by virtue of the Clip Properties widget. It’s just not open by default but a tab “underneath” the project bin.

Aha, there’s the easy way I was looking for. Thanks :wink:

well… reduce a video using a Video editor.. is something a little bit strange.

if your are adding some text… changing colors.. doing some cuts… ok… you can use a Video editor.

alternatively there is some other very power full tools (Selur Hybrid… HandBrake… FFMPEG…Vapoursynth… AviSynth… etc etc)

Btw i’m also working with Variable frame rate rotated video from Android phones.

first think i do is: place a vertical clip on the project. (this make the project can be surely portrait… surely the correct resolution… surely the correct framerate

after that… i place unprocessed clips on project bin doing trascoding and rotation (rotation by attributes on clip INfo… and not using transformations)