I'm trying to get real-time output from ffmpeg command with popen, but it returns empty after one time of execution in the loop.
<?php
$a = popen('ffpb -i mymovie.mp4 -vf subtitles=subtitles.srt mysubtitledmovie.mp4 2>&1', 'r');
while (true) {
$b = fread($a, 2096);
var_dump($b) . "<br>\n";
ob_flush();
flush();
sleep(1);
}
The output ::
mymovie.mp4: 0%| | 0/61080.0 [00:00<?, ? frames/s]"
string(105) "Unexpected exception: 'ascii' codec can't encode characters in position 43-47: ordinal
not in range(128)
"
string(0) ""
string(0) ""
string(0) ""