Rotation metadata not changing when encoding with ffmpeg

Been struggling for a few days, here is the setup:

ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate="-90" output.mp4 

changes the output.mp4 rotation metadata. At the same time:

ffmpeg -i input.mp4 -c:v libx264 -metadata:s:v:0  rotate="-90" output.mp4 

does not.Why can’t I encode and change rotation field at the same time? Tried with different codecs and rotation angles. Other metadata fields are changing just fine. Using:

ffmpeg -i input.mp4 -c libx264 intermediate.mp4
ffmpeg -i intemediate.mp4 -metadata:s:v:0 rotate="-90" output.mp4

is always an option, but seems wasteful.

Read more here: Source link