
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (111)
-
Dépôt de média et thèmes par FTP
31 mai 2013, parL’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...) -
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 (...) -
Selection of projects using MediaSPIP
2 mai 2011, parThe examples below are representative elements of MediaSPIP specific uses for specific projects.
MediaSPIP farm @ Infini
The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)
Sur d’autres sites (9511)
-
Exception in Tkinter callback while saving animation with matplotlib
24 août 2017, par paulI’m a little hesitant about asking this, since there seem to be many "Exception in Tkinter callback" questions, but I cannot find one that fits the problem I have here.
I am trying to save an MP4 animation (of a percolation simulation) using matplotlib with ffmpeg. The code works fine on my home laptop, but not on my work PC. It also works fine if I replace the
anim.save
line withplt.show()
, but I do want to save the animation. I’m using Python 3.5.2 on Ubuntu 17.04 (and I have ffmpeg installed).Here is the error :
>>> Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.5/tkinter/__init__.py", line 1558, in __call__
return self.func(*args)
File "/usr/lib/python3.5/tkinter/__init__.py", line 604, in callit
func(*args)
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_tkagg.py", line 373, in idle_draw
self.draw()
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_tkagg.py", line 354, in draw
FigureCanvasAgg.draw(self)
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_agg.py", line 474, in draw
self.figure.draw(self.renderer)
File "/usr/lib/python3/dist-packages/matplotlib/artist.py", line 62, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1165, in draw
self.canvas.draw_event(renderer)
File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 1809, in draw_event
self.callbacks.process(s, event)
File "/usr/lib/python3/dist-packages/matplotlib/cbook.py", line 563, in process
proxy(*args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/cbook.py", line 430, in __call__
return mtd(*args, **kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/animation.py", line 661, in _start
self._init_draw()
File "/usr/lib/python3/dist-packages/matplotlib/animation.py", line 1221, in _init_draw
self._draw_frame(next(self.new_frame_seq()))
StopIterationThe code producing the error is :
def percolate():
# initialize an instance of the Percolator class
perc = Percolator(1, 100, 0.1)
# initialize the image
fig, ax = plt.subplots()
im = plt.imshow(perc.states)
anim = animation.FuncAnimation(fig, perc.update, perc.update_iter, repeat=False, fargs=(im, ), save_count=perc.n**2)
anim.save("perc.mp4")I can reproduce the code for the
Percolator
class if necessary, but that part is working fine. It has two functions :update_iter
, a generator function that yieldsTrue
as long as the animation should continue, andupdate
, which takes (the result of the iterator and)im
as inputs, and its last two lines areim.set_array(self.states)
return im,UPDATE :
Here’s an MWE.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
class Percolator:
def __init__(self):
self.i = 0
self.states = np.zeros((10, 10))
self.end = False
def update(self, garbage=None, im=None):
self.i += 1
if self.i == 10:
self.end = True
im.set_array(self.states)
return im,
def update_iter(self):
while self.end == False:
yield True
def percolate():
perc = Percolator()
fig, ax = plt.subplots()
im = plt.imshow(perc.states)
anim = animation.FuncAnimation(fig, perc.update, perc.update_iter, repeat=False, \
fargs=(im, ), save_count=100)
anim.save("perc.gif", writer="imagemagick")In this example, the
Percolator
class doesn’t do anything interesting - it sets up a 10x10 grid of 0s, and each call to itsupdate
function sets the image to the same 10x10 grid.If the
frames
attribute of FuncAnimation is set to 50 (say), rather than toperc.update_iter
, then there is no error and the image is saved correctly. So the problem seems to be with my generator function. I want to use the generator function because I want to keep creating new frames until some condition onperc.states
is met - here, boringly, I’ve just asked it to keep going for 10 iterations.System details : Python 3.5.3, matplotlib 2.0.0, Ubuntu 17.04.
UPDATE 2 :
Same problem after upgrading to matplotlib 2.0.2. Also, printing some output along the way reveals that the error occurs at the end of the iterations. In fact, if
update_iter
is changed to :def update_iter(self):
print(self.end)
while self.end == False:
yield True... then the output is :
False
False
False
False
False
False
False
False
False
False
False
True
>>> True
Exception in Tkinter callback
Traceback (most recent call last):
etc. -
Live streaming doesn't work
18 octobre 2017, par John SmithI’m 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 doesn’t do anything. And if I want to stream the live incoming stuff, then what’s the matter ?
-
How to play back a video stream on website ?
11 juillet 2012, par John SmithLets suppose I have a streaming generated from ffmpeg :
ffmpeg -f dshow -i video="UScreenCapture" -vcodec libx264 -g 30 -f mpegts tcp://127.0.0.1:1234
on the server Im catching the stuffes like this :
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);
fclose ($ofp);
$ofp = fopen($outfile, 'ab');
//echo strlen($a)."\r\n";
} while (true);now Im stuck replaying this. VCL player can replay this so its got to be good, but how to put it onto a site ? I know theres HTML5 video tags, but lets not use it, because it might unsupported, and I also failed make it work every way. Is there a flash solution ? Its a dymanic stream, so no start-end !