quasarstream / PHP-FFmpeg-video-streaming

📼 Package media content for online streaming(DASH and HLS) using FFmpeg
https://www.quasarstream.com/op/php/ffmpeg-streaming?u=php-ff
MIT License
514 stars 117 forks source link

Video loses aspect ratio #89

Open userlip opened 3 years ago

userlip commented 3 years ago

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):

aminyazdanpanah commented 3 years ago

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