I am trying to do something similar to the questions here and here, but with a small difference. I am trying to flip the video along the Y or X axes instead of doing a rotation.
The solution in those threads to modify the rotation matrix seems like the perfect approach, and I am able to modify the parameters to perform the rotation. But I cannot figure out what the values should be for flipping the video.
To quote from those threads:
- no rotation:00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40
180°:
FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40
90° cw:
00 00 00 00 00 01 00 00 00 00 00 00 FF FF 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40
90° ccw:
00 00 00 00 FF FF 00 00 00 00 00 00 00 01 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40
I was unable to find documentation online that talks about what the values in those two lines indicate, hence I was not able to achieve the flip.
I tried alternatives with ffmpeg as well, but I run into issues:
ffmpeg -i input.mp4 -vf hflip output.mp4
... This re-encodes the file because of the "vf" flag that applies filtering.
ffmpeg -i input.mp4 -vf "transpose=0,transpose=1" output.mp4
... This too re-encodes the file because of the "vf" flag.
ffmpeg -i input.mp4 -metadata:s:v rotate="90" -codec copy output.mp4
... This works without re-encoding (and is almost as fast as directly editing the file), but obviously rotation does not achieve a flip. Is there a way I could use the metadata option with transpose?
ffmpeg -i input.mp4 -vf "transpose=0,transpose=1" -codec copy output.mp4
... This gives me an error saying that filtering and streamcopy cannot be used together.
Is it possible to do what I am trying to do? How would I achieve a video flip without encoding? Even if I end up encoding, how can I do it in a lossless manner?
I would have posted on the threads I have referenced above for help, but I am a new user here and cannot post comments on threads as a result.