LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-23-2018, 10:50 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,555

Rep: Reputation: 177Reputation: 177
How to rotate mp4 file


I've been searching and testing for hours. No luck. I have a .mov file I converted to mp4 using:
Code:
ffmpeg -i "2018.10 Chair Update Video.mov" -f mp4 -vcodec copy -acodec copy output.mp4
Unfortunately, the video is rotated 90 degrees counter-clockwise. I've tried numerous things including using VLC and various ffmpeg commands including:
Code:
ffmpeg -i output.mp4 -vf "transpose=1" outputR.mp4
ffmpeg -i output.mp4 -c copy -metadata:s:v:0 rotate=90 outputR.mp4
and numerous other variations I found on the web. Nothing works. The video remains stubbornly rotate 90-counter.

This is turning out a lot more difficult than I thought. Ideas?
 
Old 10-24-2018, 02:45 PM   #2
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
I've used handbrake in past, and it was quite good (however, I did not rotate video)
I do see there is an option to rotate:
https://www.itsupportguides.com/know...ing-handbrake/

https://www.groovypost.com/howto/con...les-transcode/

Have you tried this already?

BTW: there is also CLI option for handbrake if you do not want to use GUI:
https://handbrake.fr/docs/en/latest/...reference.html

Last edited by dc.901; 10-24-2018 at 02:53 PM.
 
Old 10-24-2018, 03:08 PM   #3
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 560

Rep: Reputation: 220Reputation: 220Reputation: 220
You can rotate your monitor.
Anyway, this command you suggested worked for me:
Code:
ffmpeg -i output.mp4 -vf "transpose=1" outputR.mp4
ffmpeg version:
Code:
$ ffmpeg --version
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --docdir=/usr/doc/ffmpeg-3.2.4/html --mandir=/usr/man --disable-debug --enable-shared --disable-static --enable-gpl --enable-version3 --enable-avresample --arch=x86_64 --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-libcaca --enable-libcdio --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libmp3lame --enable-opengl --enable-libopenjpeg --enable-libpulse --enable-libsmbclient --enable-libwavpack --enable-x11grab
Is ffmpeg printing some errors?
 
Old 10-24-2018, 03:12 PM   #4
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 560

Rep: Reputation: 220Reputation: 220Reputation: 220
And also notice that some video players can rotate videos, for example mplayer:
Code:
mplayer -vf rotate=2 outputR.mp4
In man mplayer it says:
Code:
       rotate[=<0-7>]
              Rotates the image by 90 degrees and optionally flips it.  For values between  4-7  rotation  is  only
              done if the movie geometry is portrait and not landscape.

                 0    Rotate by 90 degrees clockwise and flip (default).

                 1    Rotate by 90 degrees clockwise.

                 2    Rotate by 90 degrees counterclockwise.

                 3    Rotate by 90 degrees counterclockwise and flip.
 
Old 10-24-2018, 03:35 PM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
maybe convert it to mp4 first, as stated, I too use HandBrake for this.
 
Old 10-24-2018, 03:45 PM   #6
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 560

Rep: Reputation: 220Reputation: 220Reputation: 220
Quote:
Originally Posted by BW-userx View Post
maybe convert it to mp4 first, as stated, I too use HandBrake for this.
I think that's what OP is doing - he first converts .mov to .mp4 with ffmpeg and then tries to rotate output .mp4 video.
 
Old 10-25-2018, 09:07 AM   #7
alexpaton
Member
 
Registered: Jul 2009
Distribution: Ubuntu & ClearOS
Posts: 163

Rep: Reputation: 47
I find that AVIDemux is one of the most useful video tools for applying filters to videos. It looks less pretty than Handbrake, but the settings are much more comprehensible.
 
Old 10-25-2018, 02:26 PM   #8
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
Both of these will rotate video 90deg clockwise

Examples:
Code:
ffmpeg -i input.mov -c:a copy -c:v libx264 -crf 18 -preset slow -vf "rotate=PI/2" outfile.mp4
Code:
ffmpeg -i input.mov -c:a copy -c:v libx264 -crf 18 -preset slow -vf "transpose=1" outfile.mp4
 
  


Reply

Tags
mp4, rotate



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mencoder adds the extension of the original file to the output file ex: file.flv.mp4 linuxlicious Linux - General 2 04-17-2012 02:22 PM
Mencoder adds the extension of the original file to the output file ex: file.flv.mp4 linuxlicious Linux - General 1 04-15-2012 04:07 AM
log file size and rotate control lasantha Linux - Server 1 02-12-2009 03:12 AM
cannot delete or rotate messages log file dan451 Linux - Newbie 14 08-04-2006 04:13 PM
Rotate a avi file - Video question dth1 Linux - Software 7 12-12-2005 04:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration