
Recherche avancée
Autres articles (17)
-
Soumettre améliorations et plugins supplémentaires
10 avril 2011Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...) -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)
Sur d’autres sites (7485)
-
Anomalie #2448 (Résolu) : affectation de variables directement depuis la query-string sans filtrag...
9 décembre 2011, par cy_altern -à priori réglé avec http://zone.spip.org/trac/spip-zone/changeset/55304
-
avdevice/decklink_enc : use 64bit format string for BMD timebase instead of long long
2 juillet 2023, par Marton Balintavdevice/decklink_enc : use 64bit format string for BMD timebase instead of long long
BMDTimeValue is defined as LONGLONG on Windows, but int64_t on Linux/Mac.
Fixes format string warnings :
libavdevice/decklink_enc.cpp : In function ‘void construct_cc(AVFormatContext*, decklink_ctx*, AVPacket*, klvanc_line_set_s*)’ :
libavdevice/decklink_enc.cpp:424:48 : warning : format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘BMDTimeValue aka long int’ [-Wformat=]
ctx->bmd_tb_num, ctx->bmd_tb_den) ;
^
libavdevice/decklink_enc.cpp:424:48 : warning : format ‘%lld’ expects argument of type ‘long long int’, but argument 5 has type ‘BMDTimeValue aka long int’ [-Wformat=]Signed-off-by : Marton Balint <cus@passwd.hu>
-
Convert an h264 byte string to OpenCV images
27 novembre 2017, par Fred DufresneIn Python, how do I convert an h264 byte string to images OpenCV can read, only keeping the latest image ?
Long version :
Hi everyone.
Working in Python, I’m trying to get the output from adb screenrecord piped in a way that allows me to capture a frame whenever I need it and use it with OpenCV. As I understand, I need to constantly read the stream because it’s h264.
I’ve tried multiple things to get it working and concluded that I needed to ask for specific help.
The following gets me the stream I need and works very well when I print stream.stdout.read(n).
import subprocess as sp
adbCmd = ['adb', 'exec-out', 'screenrecord', '--output-format=h264', '-']
stream = sp.Popen(adbCmd, stdout = sp.PIPE, universal_newlines = True)Universal newlines was necessary to get it to work on Windows.
Doing :
sp.call(['ffplay', '-'], stdin = stream.stdout, universal_newlines = True)
Works.
The problem is I am now trying to use ffmpeg to take the input h264 stream and output as many frames as possible, overwriting the last frame if needed.
ffmpegCmd = ['ffmpeg', '-f', 'image2pipe', '-pix_fmt', 'bgr24', '-vcodec', 'h264', 'fps=30', '-']
ffmpeg = sp.Popen(ffmpegCmd, stdin = stream.stdout, stdout = sp.PIPE, universal_newlines = True)This is what I think should be used, but I always get the error "Output file #0 does not contain any stream".
Edit :
Final Answer
Turns out the universal_newlines option was ruining the line endings and gradually corrupting the output. Also, the ffmpeg command was wrong, see LordNeckbeard’s answer.
Here’s the correct ffmpeg command to achieve what was used :
ffmpegCmd = ['ffmpeg', '-i', '-', '-f', 'rawvideo', '-vcodec', 'bmp', '-vf', 'fps=5', '-']
ffmpeg = sp.Popen(ffmpegCmd, stdin = stream.stdout, stdout = sp.PIPE)And then to convert the result into an OpenCV image, you do the following :
fileSizeBytes = ffmpeg.stdout.read(6)
fileSize = 0
for i in xrange(4):
fileSize += fileSizeBytes[i + 2] * 256 ** i
bmpData = fileSizeBytes + ffmpeg.stdout.read(fileSize - 6)
image = cv2.imdecode(np.fromstring(bmpData, dtype = np.uint8), 1)This will get every single frame of a stream as an OpenCV image.