1

Folks, I am trying to add text to an mp4 file. Seems easy enough right? But once the new mp4 file is generated, the new file has half the width of the original file and is higher. It is almost like it switches the mp4 file from landscape to portrait? Here is the command I am using:

ffmpeg -i file01.mp4 -vf drawtext="text='Text Here': fontcolor=white: fontsize=24: box=1: [email protected]: boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2: enable='between(t,20,30)'" -codec:a copy file01Text01.mp4

I then attempted to stop drawtext from distorting the video stream but this results in an error:

ffmpeg -i file01.mp4 -vf drawtext="text='Text Here': fontcolor=white: fontsize=24: box=1: [email protected]: boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2: enable='between(t,20,30)'" -c copy file01Text01.mp4

Any help on seeing how I can modify the command so that the video width/height is not changed would be appreciated. Thank you.

3
  • drawtext cannot alter the video frame size. Your video is most likely portrait but stored as landscape with a rotation tag, and ffmpeg auto-rotates the video for you. Add -noautorotate before -i to avoid that.
    – Gyan
    Commented Oct 9, 2018 at 14:28
  • Gyan, it worked fine. By any chance do you know how to change the video to landscape and remove the rotation tag? I still am having problems when I upload it to youtube. It again tries to put it in portrait. Commented Oct 9, 2018 at 18:27
  • Add -metadata:s:v rotate=0 before the output filename.
    – Gyan
    Commented Oct 9, 2018 at 19:12

1 Answer 1

1

Gyan solved it: (see comment above)

drawtext cannot alter the video frame size. Your video is most likely portrait but stored as landscape with a rotation tag, and ffmpeg auto-rotates the video for you. Add -noautorotate before -i to avoid that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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