You are here

Correct Video Aspect Ratio using FFmpeg

Error message

Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in drupal_strip_dangerous_protocols() (line 1458 of /home2/crephoto/public_html/techblog/includes/common.inc).

Occasionally I come across a video (generally a WMV/ASF file) which contains an obviously incorrect aspect ratio in the metadata. Coming from the still photography world, I'm a neophyte when it comes to video encoding, but I've come to rely on FFmpeg to handle this type of problem.

A quick google search revealed a solution on superuser.com which also provided an explanation of how and why this problem might arise. The "approved" answer (with the green check mark) worked for me. I wasn't really interested in transcoding, which essentially is just making up data, I just wanted things to look right, so I used the following command:

$ ffmpeg -i <INPUT_FILE> -aspect 16:9 -c copy [OUTPUT_FILE]

Another video I found needed an aspect ratio of 2.35:1. In this case, just enter the 2.35 as the aspect.

As always, YMMV.

73

Tags: