0

I have a critical problem. I am sharing the details with you.

Problem: - I have a video file in .mov format, taken from the IPhone. This video is in portrait mode, I want to play this video on the webpage in landscape mode and vice versa.

Please suggest me, should I convert my video from portrait to landscape mode using FFMPEG. Does FFMPEG provide this conversion feature? If yes, Please send the exe and the command line for converting portrait video into landscape mode and vice versa. i am using these commands

ffmpeg -i "Inputname.mov" -acodec libvorbis -ac 2 -ab 96k -ar 44100 -b 345k output.webm
ffmpeg -i "Inputname.mov" -b 1500k -vcodec libx264 -vpre slow -vpre baseline -g 30 output.mp4

ffmpeg -i "Inputname.mov" -b 1500k -vcodec libtheora -acodec libvorbis -ab 160000 -g 30 output.ogv

any one can help to solve this issue

Sohail Yasmin
  • 498
  • 5
  • 16

2 Answers2

0

I manage to Fix this issue my self I install mediainfo on my linux centos

     yum install mediainfo

     $ffmpeg = "/usr/path/of/ffmpeg";
     $pathinfo = pathinfo($video->video_path.$video->video_name);
  $video_path = $video->video_path.$video->video_name;
  // get rotation of the video
   if($pathinfo['extension']=='mov'){

      $result = shell_exec("mediainfo ".getcwd()."/".$video->video_path.$video->video_name." | grep Rotation");
       //$rotate  = explode(":", $result);
     preg_match("|\d+|", $result,$rotation);

     if ($rotation[0]  == "90")
     {
       shell_exec($ffmpeg . ' -i ' . $video_path . '  -vf "transpose=1" -sameq ' . $video_path . ".rot.mov ") . "\n";
          shell_exec("mv $video_path.rot.mov $video_path") . "\n";
        }
        else if ($rotation[0] == "180")
        {
          shell_exec($ffmpeg . ' -i ' . $video_path . '  -vf "transpose=2,transpose=2" -sameq ' . $video_path . ".rot2.mov ") . "\n";
        //echo shell_exec($ffmpeg . ' -i ' . $video_path . '.rot2.mp4 -vf "transpose=1" ' . $video_path . ".rot.mp4  ") . "\n";
          shell_exec("mv $video_path.rot2.mov $video_path") . "\n";
        }
        else if ($rotation[0] == "270")
        {
          shell_exec($ffmpeg . ' -i ' . $video_path . '  -vf "transpose=2" -sameq ' . $video_path . ".rot.mov ") . "\n";
          shell_exec("mv $video_path.rot.mov $video_path") . "\n";
        }
      }
Sohail Yasmin
  • 498
  • 5
  • 16
-1

If you are simply trying to scale it you can use:

-vf scale='width':-1

Simple replace width with the desired width. The :-1 will keep the original aspect ratio rather than stretching the video.

However, if what you want is to rotate the video, you should see this answer:

https://stackoverflow.com/a/9570992/2345443

Community
  • 1
  • 1
gatotkaca
  • 52
  • 11