5

It is possible -- indeed, quite easy -- to rotate JPEG-files without re-encoding them, which means, no additional loss of quality is introduced in the process.

Is the same possible for the similarly-lossy video-formats (MPG, MP4)?

Mikhail T.
  • 634
  • 1
  • 8
  • 27
  • By 90 degrees, and without changing the resolution? E.g. 848x480 would become 480x848? I think that should be possible if the macro blocks etc. are symmetric wrt. vertical/horizontal dimensions, which IIRC they are. But I don't know any tool which would do it. 180 degrees should definitely be possible. – dirkt Jan 08 '17 at 08:51

1 Answers1

18

For some containers (e.g. MOV and MP4) you can set a rotation flag without changing the actual video:

ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=<x> output.mp4

Here, replace <x> with 0 to disable any existing rotation, or any value like 90, 180 or 270 to rotate the displayed video. Note that some players may ignore these flags.

See also: Can I set rotation field for a video stream with FFmpeg?

slhck
  • 223,558
  • 70
  • 607
  • 592