0

I use ffmpeg to convert a 3gp video to MP4. You can see a part of output of ffmpeg here:

ffmpeg version N-79139-gde1a0d4 Copyright (c) 2000-2016 the FFmpeg developers

...

Input #0, 

...
    Metadata:
      rotate          : 90
      creation_time   : ...
      handler_name    : VideoHandle
      encoder         :                                
    Side data:
      displaymatrix: rotation of -90.00 degrees
    ...

I use noautorotate option in below command to avoid auto rotate based on metadata of file and it is successful:

ffmpeg -noautorotate -i $vid -qscale 0 -acodec libmp3lame -ar 44100 -ab 128k ../MP4/$(basename $vid).mp4

Then I tried this HTML code to open converted file in a browser(for example by Google Chrome):

<!DOCTYPE html>
<html>
<body>

<video width="320" height="240" controls>
  <source src="../videos/test.mp4" type="video/mp4">
</video>

</body>
</html>

But when I open that, video shown rotated. How I can solve this problem? Is there a tag or any other thing to disable autorotate in HTML?

2

Although noautorotate stops FFmpeg from rotating the video, it does not remove the rotation tag from the output. So, you have to set the tag manually.

ffmpeg -noautorotate -i $vid .....  -metadata:s:v rotate=0 output.mp4 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.