PHP-FFmpeg-video-streaming icon indicating copy to clipboard operation
PHP-FFmpeg-video-streaming copied to clipboard

Video loses aspect ratio

Open userlip opened this issue 4 years ago • 1 comments

Describe the bug I have a video which has the original height and width of 956x354 which means aspect ration of 956/354 = 2.7 When I use the autoGenerateRepresentations function I get these sizes in my m3u8 file:

144x60 = 2,4 240x100 = 2,4 360x150 = 2,4 480x200 = 2,4 720x302 = 2,38 956x354 = 2,7

Which will cause a jump in the aspect ratio of the file, which is unwanted. Is there any way to solve this issue so that the streams all have the original aspect ratio of 2,7?

To Reproduce Steps to reproduce the behavior:

Use this Video: https://fuego-files.s3.eu-central-1.amazonaws.com/public/8431057685e3d64d85ecac/c2a0759deb767c63c2982a7c45cfef6/video/video.mp4

With this code:

$format = new Streaming\Format\X264();

$hls = $video->hls() ->setFormat($format) ->autoGenerateRepresentations() ->setHlsTime(2) ->fragmentedMP4() ->save(null, $to_s3);

Expected behavior All other reps have the same aspect ration of 2.7 (like the original)

Desktop/Server (please complete the following information):

  • OS: Ubuntu 18.04
  • FFmpeg vesion : ffmpeg version 4.3.1-0york0~18.04

userlip avatar Feb 17 '21 22:02 userlip

I will check this issue later but the code uses this function to calculate width and height.

aminyazdanpanah avatar Mar 20 '21 12:03 aminyazdanpanah