News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Lossless rotation of MP4

Started by beernoo, February 04, 2020, 04:08:09 AM

Previous topic - Next topic

beernoo

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!

Phil Harvey

For videos, try writing Rotation instead of Orientation.  ie)

exiftool -rotation=270 FILE.mp4

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

beernoo

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

StarGeek

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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

Try this to add 90 degrees to the rotation:

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

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).