Answer the question
In order to leave comments, you need to log in
How to get the program's response from the console into a variable?
Hello everyone, I have a question.
There is a call to ffmpeg via the PHP passthru() function;
More precisely, I need to get information about the video in order to parse it later.
I do this for example:
$response = passthru('ffmpeg -i /home/dokuro/vedeos/60fps_FREELY_TOMORROW_-_Hatsune_Miku.mp4');
var_dump($response);
passthru('ffmpeg -i /home/dokuro/vedeos/60fps_FREELY_TOMORROW_-_Hatsune_Miku.mp4 2> result.txt');
Answer the question
In order to leave comments, you need to log in
Use the exec()
function
. It has an array of strings that the command outputs.
It is possible that the command will output one thing to the terminal, and return a slightly different one to the exec() function. In this case, try adding an output redirect to the end of the command:ffmpeg ... 2>&1
php.net/manual/en/function.passthru.php
passthru('ffmpeg -i /home/dokuro/vedeos/60fps_FREELY_TOMORROW_-_Hatsune_Miku.mp4', $response);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question