
Recherche avancée
Autres articles (50)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
Sur d’autres sites (8667)
-
Python - check subprocess activity every n seconds
22 novembre 2017, par hlaborI’m trying to make python script (currently on windows) which will open some sub-processes (which will run infinitely) and script should periodically check do all of opened sub-processes still work correctly. So it should be done with while loop, I guess.
The sub-processes are about FFMPEG livestreaming.
The problem is when I do
time.sleep(n)
in my loop, because then every FFMPEG livestream stops, so I supposetime.sleep
affect on all of child subprocesses.I have no idea how to make it work.
Here is my python code :
import os, time, sys, datetime, smtplib, configparser, logging, subprocess, psutil
import subprocess
def forwardudpstream(channel_number, ip_input, ip_output):
try:
ffmpeg_command = 'ffmpeg -i udp://' + ip_input + ' -vcodec copy -acodec copy -f mpegts "udp://' + ip_output + '?pkt_size=1316"'
ffmpeg_output = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False)
return str(ffmpeg_output.pid)
except:
print ("Exception!")
return '0'
while True:
configuration = 'config.ini'
channel_list_file = 'CHANNEL_LIST.conf'
pid_folder = "D:\\Forward_UDP_Stream\\pids\\"
channel_list = [line.rstrip('\n') for line in open(channel_list_file)]
for line in channel_list:
if not line.startswith('#') and ('|' in line):
channel_number, ip_input, ip_output = line.split('|')
print('----------')
print("Channel number = ", channel_number)
print("IP Input = ", ip_input)
print("IP Output = ", ip_output)
pid_file_found = False
print("Checking if pid file exists...")
for pidfile in os.listdir(pid_folder):
if pidfile.startswith(channel_number + '-'):
print("Pid file is found for this channel.")
pid_file_found = True
pid = int(pidfile.split('-')[1].split('.')[0])
print("PID = ", str(pid))
print("Checking if corresponding process is active...")
if not psutil.pid_exists(pid):
print("Process is not active.")
print("Removing old pid file.")
os.remove(pid_folder + pidfile)
print("Starting a new process...")
pid_filename = channel_number + '-' + forwardudpstream(channel_number, ip_input, ip_output) + '.pid'
pid_file = open(pid_folder + pid_filename, "a")
pid_file.write("Process is running.")
pid_file.close()
else:
print("Process is active!")
break
if pid_file_found == False:
print("Pid file is not found. Starting a new process and creating pid file...")
pid_filename = channel_number + '-' + forwardudpstream(channel_number, ip_input, ip_output) + '.pid'
pid_file = open(pid_folder + pid_filename, "a")
pid_file.write("Process is running.")
pid_file.close()
time.sleep(10)Here is my CHANNEL_LIST.conf file example :
1|239.1.1.1:10000|239.1.1.2:10000
2|239.1.1.3:10000|239.1.1.4:10000Perhaps there is some other solution to put waiting and sub-processes to work together. Does anyone have an idea ?
UPDATE :
I finally make it work when I removedstdout=subprocess.PIPE
part from the subprocess command.
Now it looks like this :ffmpeg_output = subprocess.Popen(ffmpeg_command, stderr=subprocess.STDOUT, shell=False)
So now I’m confused why previous command was making a problem...?
Any explanation ? -
NodeJs : How to pipe two streams into one spawned process stdin (i.e. ffmpeg) resulting in a single output
20 juin 2018, par Keyne VianaIn order to convert PCM audio to MP3 I’m using the following :
function spawnFfmpeg() {
var args = [
'-f', 's16le',
'-ar', '48000',
'-ac', '1',
'-i', 'pipe:0',
'-acodec', 'libmp3lame',
'-f', 'mp3',
'pipe:1'
];
var ffmpeg = spawn('ffmpeg', args);
console.log('Spawning ffmpeg ' + args.join(' '));
ffmpeg.on('exit', function (code) {
console.log('FFMPEG child process exited with code ' + code);
});
ffmpeg.stderr.on('data', function (data) {
console.log('Incoming data: ' + data);
});
return ffmpeg;
}Then I pipe everything together :
writeStream = fs.createWriteStream( "live.mp3" );
var ffmpeg = spawnFfmpeg();
stream.pipe(ffmpeg.stdin);
ffmpeg.stdout.pipe(/* destination */);The thing is... Now I want to merge (overlay) two streams into one. I already found how to do it with ffmpeg : How to overlay two audio files using ffmpeg
But, the ffmpeg command expects two inputs and so far I’m only able to pipe one input stream into the
pipe:0
argument. How do I pipe two streams in the spawned command ? Would something likeffmpeg -i pipe:0 -i pipe:0...
work ? How would I pipe the two incoming streams with PCM data (since the command expects two inputs) ? -
FFmpeg Capture remote screen
29 août 2018, par ricardoI am trying capture a remote screen via ffmpeg and x11grab, I run in my machine this command
xpra start-desktop :20 --start-child=fluxbox
this machine have the ip
192.168.1.15
and in the remote capture I try run this
/usr/local/bin/ffmpeg -f pulse -server 192.168.1.15 -i tarjeta01.monitor -f x11grab -framerate 25 -r 25 -i 192.168.1.15:20.0 -fflags nobuffer -f rtp -c:v h264_nvenc -preset llhp -profile:v baseline -level 4 -delay 0 -b:v 1500k -threads 4 -cbr 1 -r 25 -an udp://:5008 -f rtp -vn -c:a libopus -ar 48000 -ac 2 -ab 96k -application lowdelay -compression_level 0 -frame_duration 2.5 -cutoff 20000 -vbr constrained udp://localhost:5006
I make xhost + and xhost + 192.168.1.16 in the machine where run xpra but always receive this error
[x11grab @ 0x23e4ea0] Cannot open display 192.168.1.15:20, error 1.
192.168.1.15:20: Input/output errorI try xpra, Xephyr and xfvb but always get the same error
Thanks for all best regards