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

HLS conversion ts segment duration #84

Closed infohassan closed 3 years ago

infohassan commented 3 years ago

How do i set the segment size of .ts files generated while HLS conversion?

aumkarthakur commented 3 years ago

Hi,

You can do this by using ->setHlsTime(5)

Like this:

$video->hls()
    ->setHlsBaseUrl('https://bucket.s3-us-west-1.amazonaws.com/videos') // Add a base URL
    ->setHlsTime(5) // Set Hls Time. Default value is 10 
    ->setHlsAllowCache(false) // Default value is true 
    ->x264()
    ->addRepresentations([$r_360p, $r_480p, $r_720p])
    ->save();
aminyazdanpanah commented 3 years ago

You can only set the segment duration. You can use @aumkarthakur 's solution. Thanks @aumkarthakur