How to Get Video Lossless Rotation When Re-encoding Using FFmpeg?

1.5k Views Asked by At

I'm looking for how to rotate a video without losing any quality when re-encoding.

I currently use ffmpeg -i "inputvideo" -crf 0 -vf transpose=2 -acodec copy "outputvideo".

Although -crf 0 should be lossless, I found there is difference after comparing the first frame of the orginal video and the rotated video. What is the reason?

As I do not have enough reputation, I put the screenshot here https://sm.ms/image/6bjAIkFJM4rDiaf. Left is the original.

I noticed there is an answer https://stackoverflow.com/a/49535017/11081223 modifying hex data to achieve video rotation without re-encoding, but it does not change the actual file just the metadata only to let the player know. I assume that method leaves rotation job for player to deal with so the image quality difference is more obvious.

The screenshot is here https://sm.ms/image/StZxPgHOEDKFRcr. Left is the original.

0

There are 0 best solutions below