How to make video play with correct aspect ratio I have the following issue: I have a video file (h264) that plays with the correct aspect ratio in mplayer. However, if I load it into Intel's Computer Vision Annotation Tool, or if I re-encode the video using openCV, the aspect ratio is no longer correct. 

"ffprobe -i" on the original file gives


  1440x1080 [SAR 4:3 DAR 16:9]


whereas for the re-encoded file I get


  1440x1080 [SAR 1:1 DAR 4:3]


I have other video files with


  1920x1080 [SAR 1:1 DAR 16:9]


that do not cause this issue.

Do I just have to modify the SAR in the header or is the problem more complicated? I would like to preserve the codec if possible.
For a H264 stream, use the h264_metadata bitstream filter

ffmpeg -i in.mp4 -c copy -bsf:v "h264_metadata=sample_aspect_ratio=4/3" out.mp4