
Recherche avancée
Autres articles (42)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)
Sur d’autres sites (6885)
-
I have installed FFMPEG and can't find it inside a PHP script
14 novembre 2019, par AntopI have installed FFMPeg in CentOS. It works perfectly.
It’s inside /usr/bin directory. Also, I have PHP 7.2.24 that comes with Plesk 18.0.20.I want to use FFMPeg inside a PHP script, but that script can’t find the executable of FFMpeg. I have tried giving the exact route (/usr/bin/ffmpeg) but doesn’t work.
It’s a production server. The same script, in my development server (macOS) works perfectly.
I tried using :
var_dump(getenv('PATH'));
var_dump(exec('which ffmpeg'));
var_dump(ini_get('open_basedir'));
var_dump(is_file(exec('which ffmpeg')));
var_dump(is_executable(exec('which ffmpeg')));And it returns me :
string(49) "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
string(0) ""
string(44) "/var/www/vhosts/name-of-the-domain.com/:/tmp/"
bool(false)
bool(false)
NULL¿What could be happening ?
A very strange thing I’ve noticed is that I can’t access any command via php :
I tried using it with echovar_dump(exec('which echo'));
var_dump(is_file(exec('which echo')));
var_dump(is_executable(exec('which echo')));And it returns me :
string(0) ""
bool(false)
bool(false)
NULLAnd the permissions are right :
[root@vps bin]# ls -lha echo
-rwxr-xr-x 1 root root 33K ago 20 08:25 echo
[root@vps bin]# ls -lha ffmpeg
-rwxr-xr-x 1 root root 217K abr 4 2019 ffmpegBut if I make a
var_dump(exec('echo "HELLO"'))
it returns me
string(5) "HELLO"
-
Trying to fetch all audio streams with FFmpeg Python
27 juillet 2022, par ApolloI'm using ffmpeg-python to fetch streams from a video and write some parameters (codec_name, resolution, etc.) for each stream into csv.


video = 'test.mkv'
probe = ffmpeg.probe(video)
video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
print(video_stream['codec_long_name'])
audio_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'audio'), None)
...



My problem is that it works well for a video stream, but not for multiple audio (or subtitles) streams. If the video has several audio streams it returns only one audio stream.


I've tried another approach, but it returns some streams 2-3 times and I get duplicates. So if the video sample has 4 audio tracks, I end up with 9 audio streams instread of 4.


audio_streams = []
for audio in (probe['streams']):
 if (audio['codec_type'] == 'audio'):
 audio_streams.append(audio)
 pprint(audio_streams)



All other ideas I tried don't work, I'm new to programming and I'm stuck with it.
How can I get all audio streams from a file without duplicates ?


-
How do I get the last line of a popen() callback in every iteration ?
29 mai 2017, par MikeI’m trying to create a progress bar with FFMPEG using php and AJAX. When a user uploads a video file I want to be able to display the current percent until completion. I have managed to get everything working but I have one issue.
The data returns what I want, but it also returns all the data from the previous iterations... like it just keeps stacking everything on top rather than flushing out the data from previous iterations. I tried to work with
tail
thinking it would return only the last line, but it did not return anything.Here is the code I’m working with :
encode.php
$video_path = 'test.mp4';
$cmd = 'ffmpeg -i ' . $video_path .' -y -hide_banner output.mp4 2>&1';
while (@ ob_end_flush());
$proc = popen($cmd, 'r');
while (!feof($proc))
{
$file = escapeshellarg(fread($proc, 4096));
//$line = `tail -n 1 $file`; // <-tried this with no luck
echo fread($file, 4096) . "\n";
@ flush();
}
return 'complete';
pclose($proc);The above code returns :
// first iteration
frame= 52 fps= 13 q=29.0 size= 279kB time=00:00:00.10 bitrate=22856.9kbits/s
// second iteration
frame= 52 fps= 13 q=29.0 size= 279kB time=00:00:00.10 bitrate=22856.9kbits/s
frame= 54 fps= 12 q=29.0 size= 329kB time=00:00:00.16 bitrate=16146.6kbits/s
// third iteration
frame= 52 fps= 13 q=29.0 size= 279kB time=00:00:00.10 bitrate=22856.9kbits/s
frame= 54 fps= 12 q=29.0 size= 329kB time=00:00:00.16 bitrate=16146.6kbits/s
frame= 57 fps= 11 q=29.0 size= 464kB time=00:00:00.26 bitrate=14233.2kbits/sAs you can see the data stacks, I need only the new line of data, not the data stacking.
** EDIT ** this has been marked as a duplicate, rather than me explain how it’s different, I’d like to hear how this is the same thing ? I am not writing to a log file and, like most people, do not feel that’s a good solution.