protonemedia / laravel-ffmpeg

This package provides an integration with FFmpeg for Laravel. Laravel's Filesystem handles the storage of the files.
https://protone.media/en/blog/how-to-use-ffmpeg-in-your-laravel-projects
MIT License
1.62k stars 193 forks source link

How to make subtitle quality better? #475

Closed irakan closed 1 year ago

irakan commented 1 year ago

I am using this code to hardcode the subtitle and the output is .MP4. But the subtitle text output's quality is really bad.

How can I improve it?

$format = new X264();
FFMpeg::openUrl($videoUrl)
->addFilter(function (VideoFilters $filters) use ($subtitleFilePath) {
  $filters->custom("subtitles={$subtitleFilePath}:fontsdir={$fontsdir}:force_style='BorderStyle=4,Outline=0,Shadow=5,Alignment={$alignment},FontName={$fontNameWeight},FontSize={$fontSize},PrimaryColour=&H{$fontColor}&,BackColour=&H{$backgroundColor}&,Italic={$fontStyle}'");
})
->export()
->inFormat($format)
->toDisk('s3')
->save($tmpVideoOutputPath);
irakan commented 1 year ago

never mind