Q:

PHP-FFMPeg Converts Video Twice

I'm using FFMpeg's library for PHP (see https://github.com/PHP-FFMpeg/PHP-FFMpeg).
After starting the convert process, the converted video's file size gradually increases (I constantly refresh the folder) and after converting finishes, the file size becomes 0 again and converting starts again.
So converting is done twice, I could not understand if it is normal or there is something wrong.
My converting code is:
require 'vendor/autoload.php';
$ffmpeg = FFMpeg\FFMpeg::create([
        'ffmpeg.binaries'  => 'C:/ffmpeg/ffmpeg.exe', 
        'ffprobe.binaries' => 'C:/ffmpeg/ffprobe.exe',
        'timeout'          => 0 
    ]);

$video = $ffmpeg->open($fileName);
$video
    ->filters()
    ->resize(new FFMpeg\Coordinate\Dimension(1920, 1080 ))
    ->synchronize();

$format = new FFMpeg\Format\Video\X264('libmp3lame');

try {
    $video->save($format, $outFileName);
} catch (Exception $e) {
    echo $e->getMessage();
}

A:

This is because ffmpeg uses 2 pass encoding.
https://superuser.com/questions/1362800/ffmpeg-2-pass-encoding
first it writes everything to a log and then from that log it makes the video

