ExifTool Forum

ExifTool => Newbies => Topic started by: beernoo on February 04, 2020, 04:08:09 AM

Title: Lossless rotation of MP4
Post by: beernoo on February 04, 2020, 04:08:09 AM
Hi ExifTool community,

I mistakenly started shooting a video portrait (few seconds) then turned my camera to shoot landscape which was meant to be the orientation of the shooting. As a result, the whole video is set as portrait hence the landscape content shows at a wrong angle (90°CW). Now I would like to fix this and rotate the video -90°CW in a lossless fashion. I came across:
https://stackoverflow.com/questions/25031557/rotate-mp4-videos-without-re-encoding
https://exiftool.org/forum/index.php/topic,6670.msg46809.html

I tried the below commands (Windows Powershell) which successfully execute ("1 image files updated") but the video still shows as portrait when playing in VLC media player:
exiftool.exe -orientation="Rotate 270 CW" "20160617_cptwn.mp4"
exiftool.exe -orientation#=8 "20160617_cptwn.mp4"

Am I doing anything wrong?

Thanks!
Title: Re: Lossless rotation of MP4
Post by: Phil Harvey on February 04, 2020, 08:49:51 AM
For videos, try writing Rotation instead of Orientation.  ie)

exiftool -rotation=270 FILE.mp4

- Phil
Title: Re: Lossless rotation of MP4
Post by: beernoo on February 04, 2020, 07:04:52 PM
Hi Phil, thanks for your reply! It did help a lot but had to tweak the command. I tried rotation=270 but it rotated the image 180°. Then I tried again with rotation=360 which rotated the image 270° and solved my problem. Could this be a bug or maybe my video was recorded in a special way?
Attaching a sample so that you can reproduce the issue.
Here is the command that helped: exiftool -rotation=360 smallfile.mp4
Thanks
Title: Re: Lossless rotation of MP4
Post by: StarGeek on February 04, 2020, 07:46:24 PM
The problem was that it already was tagged with Rotation : 90 and that wasn't taken into account. So what you actually wanted was -Rotation=0 for it to be set correctly.
Title: Re: Lossless rotation of MP4
Post by: Phil Harvey on February 04, 2020, 09:54:23 PM
Try this to add 90 degrees to the rotation:

exiftool "-rotation<${rotation;$_ += 90}" FILE

- Phil