I'm using the PHP-FFMpeg v1.1.0 library to compress videos sent from a variety of mobile devices into 480p (640x480) MP4 videos.
Everything is working great, but I'm wondering how to reach an optimal compression level. It looks like I'm already using the recommended video bitrate for 480p, as well as a fairly low quality audio (64Kbps).
Am I missing any best practices/options here?
My code:
$videoFile = '/tmp/source.avi';
$destVideoFile = '/tmp/'.uniqid().'.mp4';
$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open($videoFile);
$video->filters()->resize(new FFMpeg\Coordinate\Dimension(640, 480), 'width')->synchronize();
$codec = new FFMpeg\Format\Video\X264();
$codec->setKiloBitrate(960)->setAudioKiloBitrate(64);
$video->save($codec, $destVideoFile);