[FFmpeg-user] Rotating webm videos

Gyan ffmpeg at gyani.pro
Sat Mar 23 14:22:12 EET 2019



On 23-03-2019 04:40 PM, Michael Koch wrote:
> Am 23.03.2019 um 12:00 schrieb Rex East:
>> On Sat, Mar 23, 2019 at 7:46 PM Michael Koch
>> <astroelectronic at t-online.de> wrote:
>>> As far as I know, rotating without re-encoding isn't possible. Try 
>>> this:
>>>
>>> ffmpeg -i input.webm -vf rotate=PI/2 output.webm
>>>
>> Thank you Michael for the reply and information.
>>
>> However, that command resulted in the video being cropped to a square
>> (original video is in portrait mode), and there is still significant
>> quality loss...
>
> then you could pad the video before applying the rotate filter, and 
> crop it after the rotate filter:
>
> -vf pad=iw:iw:-1:-1,rotate=PI/2,crop=xxx:ih
> where xxx is the height of the input video

rotate has options for output size and can accommodate the rotated 
output, see https://ffmpeg.org/ffmpeg-filters.html#toc-rotate
*
*But if re-encoding is acceptable, then transpose is the suitable 
filter. If streamcopying is required, then the appropriate side-data 
element has to be generated and stored. For Matroska family files, I 
don't see a specific element available for display orientation. I do see 
a 3D projection mapping tag element which could conceivably used by 
setting projection type to rectangular and a non-zero roll value (yaw, 
pitch = 0). However, ffmpeg does not write the side-data for this 
purpose, nor does it read it as such. Not to mention I don't know if 
other consumers (players, editors) look at it either.

Gyan


More information about the ffmpeg-user mailing list