{"id":186,"date":"2013-01-05T18:55:53","date_gmt":"2013-01-06T02:55:53","guid":{"rendered":"http:\/\/blog.ls-al.com\/?p=186"},"modified":"2013-01-05T19:17:20","modified_gmt":"2013-01-06T03:17:20","slug":"rotate-video","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/rotate-video\/","title":{"rendered":"Rotate Video"},"content":{"rendered":"
Did you take a video on your Iphone and when you viewed the .mov file it is flipped 90 degrees.\u00a0 This happens often and there is many ways to fix it.\u00a0 Just viewing with quicktime or VLC could work but VLC the aspect was way off.\u00a0 So I had myself swinging a golf club and looking like I am 3 feet tall.\u00a0 Windows Movie Maker can flip the video 90 degrees but then I have to export in different format.\u00a0 Not too mention I had 20 videos and it is very cumbersome to do.<\/p>\n
Instead a quick Linux command line can do all 20 videos quickly.<\/p>\n
Using avconv (ffmpeg successor):<\/strong><\/span><\/p>\n Or use mencoder (quality might be worse):<\/strong><\/span><\/p>\n The rotate \/ transpose settings:<\/strong><\/span> http:\/\/libav.org\/libavfilter.html#transpose TODO:<\/strong><\/span><\/p>\n Is there a good way to tell the video is flipped without looking at it.\u00a0 Probably looking at the width and height dimensions (1280x720)<\/strong> but I have not looked into it further.<\/p>\n Did you take a video on your Iphone and when you viewed the .mov file it is flipped 90 degrees.\u00a0<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,23],"tags":[],"class_list":["post-186","post","type-post","status-publish","format-standard","hentry","category-linux","category-video-encoding"],"_links":{"self":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/comments?post=186"}],"version-history":[{"count":0,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/186\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/media?parent=186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/categories?post=186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/tags?post=186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\r\n# apt-get install libav-tools\r\n# avconv -filters 2>\/dev\/null | grep transpose\r\ntranspose\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Transpose input video.\r\n\r\n# apt-get install libavcodec-extra-53\r\n# avconv -codecs | grep 264\r\navconv version 0.8.4-6:0.8.4-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers\r\nbuilt on Nov\u00a0 6 2012 16:51:11 with gcc 4.7.2\r\nD V D\u00a0 h264\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 H.264 \/ AVC \/ MPEG-4 AVC \/ MPEG-4 part 10\r\nD V D\u00a0 h264_vdpau\u00a0\u00a0\u00a0\u00a0\u00a0 H.264 \/ AVC \/ MPEG-4 AVC \/ MPEG-4 part 10 (VDPAU acceleration)\r\nEV\u00a0\u00a0\u00a0 libx264\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 libx264 H.264 \/ AVC \/ MPEG-4 AVC \/ MPEG-4 part 10\r\n\r\n# avconv -i 838.MOV -vf transpose=1 -c:v libx264 -crf 23 -c:a copy 838.m4v\r\n<\/pre>\n
\r\n# apt-get install mencoder\r\n\r\n# mencoder 827.MOV -vf rotate=1 -oac pcm -ovc x264 -o 827.MP4\r\n<\/pre>\n
\n** rotate 1 =\u00a0 90 degrees clockwise<\/p>\n\r\n\r\n# avconv -i 838.MOV 2>&1 | grep Video:\r\nStream #0.0(und): Video: h264 (Baseline), yuv420p, 1280x720, 10722 kb\/s, 29.97 fps, 29.97 tbr, 600 tbn, 1200 tbc\r\n\r\n# avconv -i 838.m4v 2>&1 | grep Video:\r\nStream #0.0(und): Video: h264 (Main), yuv420p, 720x1280, 1184 kb\/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"