
Recherche avancée
Autres articles (99)
-
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela. -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (9606)
-
OpenCV Python, reading video from named-pipe
29 février 2020, par BlueNutI am trying to achieve results as shown on the video (Method 3 using netcat) https://www.youtube.com/watch?v=sYGdge3T30o
It is to stream video from raspberry pi to PC and process it using openCV and python.I use command
raspivid -vf -n -w 640 -h 480 -o - -t 0 -b 2000000 | nc 192.168.1.137 8000
to stream the video to my PC and then on the PC I created name pipe ’fifo’ and redirected the output
nc -l -p 8000 -v > fifo
then i am trying to read the pipe and display the result in the python script
import cv2
import subprocess as sp
import numpy
FFMPEG_BIN = "ffmpeg.exe"
command = [ FFMPEG_BIN,
'-i', 'fifo', # fifo is the named pipe
'-pix_fmt', 'bgr24', # opencv requires bgr24 pixel format.
'-vcodec', 'rawvideo',
'-an','-sn', # we want to disable audio processing (there is no audio)
'-f', 'image2pipe', '-']
pipe = sp.Popen(command, stdout = sp.PIPE, bufsize=10**8)
while True:
# Capture frame-by-frame
raw_image = pipe.stdout.read(640*480*3)
# transform the byte read into a numpy array
image = numpy.frombuffer(raw_image, dtype='uint8')
image = image.reshape((480,640,3)) # Notice how height is specified first and then width
if image is not None:
cv2.imshow('Video', image)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
pipe.stdout.flush()
cv2.destroyAllWindows()But I got this error :
Traceback (most recent call last):
File "C:\Users\Nick\Desktop\python video stream\stream.py", line 19, in <module>
image = image.reshape((480,640,3)) # Notice how height is specified first and then width
ValueError: cannot reshape array of size 0 into shape (480,640,3)
</module>It seems that the numpy array is empty, so any ideas to fix this ?
-
FFmpeg with Pipe - how can I periodically grab real-time frames out of live streams in C# ?
2 mars 2020, par BByI am new to FFmpeg and C# and I want grab frames to do image processing with IP Camera.
I have made the following C# class and I could get a single frame from IP Camera.
class FFmpegHandler
{
public Process ffmpeg = new Process();
public Image image;
public Image init()
{
ffmpeg = new Process()
{
StartInfo =
{
FileName = @"./ffmpeg/ffmpeg.exe",
//Arguments = "-i http://admin:@192.168.10.1/videostream.asf -an -f image2pipe -preset ultrafast -tune zerolatency -s 320x240 pipe:1", // Hangs
Arguments = "-i http://admin:@192.168.10.1/videostream.asf -vframes 1 -an -f image2pipe -preset ultrafast -tune zerolatency -s 320x240 pipe:1",
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true,
WorkingDirectory = "./ffmpeg/"
}
};
ffmpeg.EnableRaisingEvents = true;
ffmpeg.Start();
var stream = ffmpeg.StandardOutput.BaseStream;
var img = Image.FromStream(stream);
//ffmpeg.WaitForExit();
return img;
}
}The problem is that I want to grab real-time (latest) images when I request.
If I run FFmpegHandler.init(), it will take 2 seconds to give me delayed image output.
I have tried removing argument -vframes 1, then it will hang after image = Image.FromStream(stream) ;.
When I check the ffmpeg output directly, it looks like ffmpeg is keep building the stream
frame= 6 fps=0.0 q=2.2 size= 25kB time=00:00:00.24 bitrate= 861.9kbits/s dup=4 drop=0 speed=0.435x
frame= 65 fps= 60 q=24.8 size= 140kB time=00:00:02.60 bitrate= 440.9kbits/s dup=4 drop=0 speed=2.41x
frame= 77 fps= 49 q=24.8 size= 161kB time=00:00:03.08 bitrate= 428.0kbits/s dup=4 drop=0 speed=1.95x
frame= 89 fps= 43 q=24.8 size= 182kB time=00:00:03.56 bitrate= 418.6kbits/s dup=4 drop=0 speed= 1.7x
frame= 102 fps= 39 q=24.8 size= 205kB time=00:00:04.08 bitrate= 410.7kbits/s dup=4 drop=0 speed=1.57x
frame= 116 fps= 37 q=24.8 size= 229kB time=00:00:04.64 bitrate= 404.2kbits/s dup=4 drop=0 speed=1.49x
frame= 128 fps= 35 q=24.8 size= 250kB time=00:00:05.12 bitrate= 399.8kbits/s dup=4 drop=0 speed=1.41x
frame= 142 fps= 34 q=24.8 size= 274kB time=00:00:05.68 bitrate= 395.7kbits/s dup=4 drop=0 speed=1.36x
frame= 156 fps= 33 q=24.8 size= 299kB time=00:00:06.24 bitrate= 392.3kbits/s dup=4 drop=0 speed=1.32x
frame= 169 fps= 32 q=24.8 size= 322kB time=00:00:06.76 bitrate= 389.7kbits/s dup=4 drop=0 speed=1.29x
frame= 182 fps= 32 q=24.8 size= 344kB time=00:00:07.28 bitrate= 387.4kbits/s dup=4 drop=0 speed=1.26x
frame= 195 fps= 31 q=24.8 size= 367kB time=00:00:07.80 bitrate= 385.5kbits/s dup=4 drop=0 speed=1.24x
frame= 208 fps= 31 q=24.8 size= 390kB time=00:00:08.32 bitrate= 383.8kbits/s dup=4 drop=0 speed=1.22x
frame= 221 fps= 30 q=24.8 size= 413kB time=00:00:08.84 bitrate= 382.3kbits/s dup=4 drop=0 speed=1.21xHow can I grab the latest frames out of this live-stream image ? (OR is there a thread-safe way to clean the stream and only get the latest frame when I request ?)
-
Python gets stuck at pipe.stdin.write(image.tostring())
10 mars 2020, par Vandana RajanI am reading each frame of video and adding time stamp to it as given below.
command = ['ffmpeg',
'-y', # (optional) overwrite output file if it exists
'-f', 'rawvideo', #Input is raw video
'-pix_fmt', 'bgr24', #Raw video format
'-s', str(int(width)) + 'x' + str(int(height)), # size of one frame
'-i', '-', # The input comes from a pipe
'-an', # Tells FFMPEG not to expect any audio
'-vcodec', 'mpeg4',
'-b:v', '10M', #Sets a maximum bit rate
Output_name]
#Open the pipe
pipe = sp.Popen(command, stdin=sp.PIPE, stderr=sp.PIPE)
print('Processing....')
print(' ')
#Reads through each frame, calculates the timestamp, places it on the frame and exports the frame to the output video.
#import pdb
#pdb.set_trace()
while current_frame < total_frames:
success, image = video.read()
if success:
elapsed_time = video.get(cv2.CAP_PROP_POS_MSEC)
current_frame = video.get(cv2.CAP_PROP_POS_FRAMES)
timestamp = initial + dt.timedelta(microseconds = elapsed_time*1000)
cv2.putText(image, 'Date: ' + str(timestamp)[0:10], (50,int(height-150)), cv2.FONT_HERSHEY_COMPLEX_SMALL, 2, (255, 255, 255), 3)
cv2.putText(image, 'Time: ' + str(timestamp)[11:-4], (50,int(height-100)), cv2.FONT_HERSHEY_COMPLEX_SMALL, 2, (255, 255, 255), 3)
pipe.stdin.write(image.tostring())
print('frame number',current_frame)
else:
print('video reader fail')
video.release()
pipe.stdin.close()
pipe.stderr.close()However, after around 18k frames, Python gets stuck at ’pipe.stdin.write(image.tostring())’. It does not produce any error, but simply hangs. How to resolve this issue ?
Thanks in advance.