
Recherche avancée
Médias (1)
-
La conservation du net art au musée. Les stratégies à l’œuvre
26 mai 2011
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (111)
-
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...) -
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)
Sur d’autres sites (7293)
-
Can I create a proccess to kill blocked processes in a queue with Python ?
15 mars 2017, par user3182473I would like to create a process, which kills blocked processes in a queue. These processes are actually ’ffmpeg’ command in my work, which are unstable and blocked occasionally.
For simplicity I use ’echo’ instead of ’ffmpeg’ as example here. I found that the alive process become ’finished’ from the queue, and the subprocess returncode is 0. Why ?
And can anyone tell how I can modify my code with python2.7 to fit this requirement ? Any suggestion would be appreciated.
import subprocess
import os
import multiprocessing
import time
cmds = ['echo "a" &sleep 10','echo "b"']
queue = multiprocessing.Queue(maxsize=3)
class ProcessKiller(multiprocessing.Process):
def __init__(self,queue):
multiprocessing.Process.__init__(self)
self.queue = queue
def run(self):
while True:
try:
proc = self.queue.get(block=False)
print 'bbbbb',proc.poll(),proc.pid #WHY HERE THE RETURNCODE=0?
if proc.poll() is None:
print 'tokill'
time.sleep(5)
if proc.poll() is None:
os.killpg(os.getpgid(proc.pid),signal,SIGTERM)
print 'killed'
except Exception as e:
time.sleep(0.5)
pk = ProcessKiller(queue)
pk.start()
for item in cmds:
cmd = subprocess.Popen(item,preexec_fn=os.setsid,shell=True)
print 'aaaaa',cmd.poll(), cmd.pid
queue.put(cmd,block=False)
time.sleep(3)
print 'cccc',cmd.poll()
time.sleep(10)
print 'dddd', cmd.poll()
cmd.communicate()
print 'finished'The result from this script :
aaaaa None 120748
a
bbbbb 0 120748
cccc None
dddd 0
finished
aaaaa None 120755
b
bbbbb 0 120755
cccc 0
dddd 0
finishedUPDATE : Now I use a while loop to monitor the status of the subprocess. It works. However, I am still curious why the status of the process changes from the queue.
-
Realtime recording in multiple encodings python
3 janvier 2015, par eripI am working on a project that requires audio recording and am using python. I would like to use a start button to begin recording and a stop button to stop it. Additionally, I’d like to support multiple filetypes like .wav, .mp3, .aiff.
As far as I know, there doesn’t exist something that can do this "in one go", meaning I could record something as a .wav and then post-process the file to encode it in different formats using ffmpeg or a similar library.
This presents a small problem because my project is web-based, so I would have to save the .wav and then save the .*.
Does anyone know of another solution to my problem ?
Thanks, erip
-
Live streaming doesnt work
13 février 2013, par John SmithIm using FFmpeg to capture my screen :
ffmpeg -f dshow -i video="UScreenCapture" -r 5 -s 640x480 -acodec libmp3lame -ac 1 -vcodec mpeg 4 -vtag divx -q 10 -f mpegts tcp://127.0.0.1:1234
so let it stream to somewhere. The accepter script :
error_reporting(E_ALL); /* Allow the script to hang around waiting for connections. */
set_time_limit(30); /* Turn on implicit output flushing so we see what we're getting as it comes in. */
ob_implicit_flush();
$address = '127.0.0.1';
$port = 1234;
$outfile = dirname(__FILE__)."/output.flv";
$ofp = fopen($outfile, 'wb');
if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) { echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n"; sleep (5); die; }
if (socket_bind($sock, $address, $port) === false) { echo "socket_bind() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"; sleep (5); die; }
if (socket_listen($sock, 5) === false) { echo "socket_listen() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"; sleep (5); die; }
if (($msgsock = socket_accept($sock)) === false) { echo "socket_accept() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n"; sleep (5); break; }
do {
$a = '';
socket_recv ($msgsock, $a, 65536, MSG_WAITALL);
fwrite ($ofp, $a);
//echo strlen($a)."\r\n";
} while (true);it seems to save the stuff to the disk OK. Now here comes the html :
I dont really know how to do this, but based on an example :
<video src="/output.flv"></video>
but it doesnt do anything. And if I want to stream the live incoming stuff, then whats the matter ?