
Recherche avancée
Autres articles (83)
-
Submit enhancements and plugins
13 avril 2011If you have developed a new extension to add one or more useful features to MediaSPIP, let us know and its integration into the core MedisSPIP functionality will be considered.
You can use the development discussion list to request for help with creating a plugin. As MediaSPIP is based on SPIP - or you can use the SPIP discussion list SPIP-Zone. -
Participer à sa traduction
10 avril 2011Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
Actuellement MediaSPIP n’est disponible qu’en français et (...) -
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 (...)
Sur d’autres sites (7888)
-
Why the output of the ffmpeg-python doesn't match the image shape ?
9 novembre 2019, par Swi JasonI used the
ffmpeg-python
module to convert video to images. Specifically, I used the code provided by the official git repo offfmpeg-python
, as belowout, _ = (
ffmpeg
.input(in_filename)
.filter('select', 'gte(n,{})'.format(frame_num))
.output('pipe:', vframes=1, format='image2', vcodec='mjpeg')
.run(capture_stdout=True)
)
im = np.frombuffer(out, 'uint8')
print(im.shape[0]/3/1080)
# 924.907098765432The original video is of size (1920, 1080) and pix_fmt ’yuv420p’, but the outputs of the above code is not 1920.
I have figured out by myself that the output of ffmpeg.run() is not a decoded image array, but a byte string encoded by JPEG format. To restore the image into a numpy array, simply use the cv2.imdecode() function. For example,
im = cv2.imdecode(im, cv2.IMREAD_COLOR)
However, I can’t use
opencv
on my embeded Linux system. So my question now is that, can I get numpy output fromffmpeg-python
directly, without the need of converting it by opencv ? -
How to match the video bitrate of opencv with ffmpeg ?
24 avril 2019, par user10890282I am trying to read three cameras simultaneously one of which is done through a video grabber card. I want to be able to stream the data and also write out videos from these sources. I used FFmpeg to write out the data from the video grabber card and OpenCV writer for the normal USB cameras. But the bit rates of the files do not match nor does the size. This becomes a problem as I post-process the files. I tried to convert the OpenCV written files using FFmpeg later but the duration of the files still remain different though the bit rates have changed. I really would appreciate pointers to know how to go about this from the script itself. The ideal case would be that I use FFmpeg for all the three sources with the same settings. But how can I do this without spitting out all the information on the console as writing out the files, since there would have to be three sources written out simultaneously ? Could someone tell me how to have multiple FFmpeg threads going on for writing out files while streaming videos using OpenCV ?
I have attached my current code with OpenCV writer and FFmpeg for one source :
from threading import Thread
import cv2
import time
import sys
import subprocess as sp
import os
import datetime
old_stdout=sys.stdout
maindir= "E:/Trial1/"
os.chdir(maindir)
maindir=os.getcwd()
class VideoWriterWidget(object):
def __init__(self, video_file_name, src=0):
if (src==3):
self.frame_name= "Cam_"+str(src)+"(Right)"
if(src==2):
self.frame_name= "Cam_"+str(src)+"(Left)"
# Create a VideoCapture object
#self.frame_name =str(src)
self.video_file = video_file_name+"_"
self.now=datetime.datetime.now()
self.ts=datetime.datetime.now()
self.video_file_nameE="{}.avi".format("Endo_"+self.ts.strftime("%Y%m%d_%H-%M-%S"))
self.video_file_name = "{}.avi".format(video_file_name+self.ts.strftime("%Y%m%d_%H-%M-%S"))
self.FFMPEG_BIN = "C:/ffmpeg/bin/ffmpeg.exe"
self.command=[self.FFMPEG_BIN,'-y','-f','dshow','-rtbufsize','1024M','-video_size','640x480','-i', 'video=Datapath VisionAV Video 01','-pix_fmt', 'bgr24', '-r','60', self.video_file_name]
self.capture = cv2.VideoCapture(src)
# Default resolutions of the frame are obtained (system dependent)
self.frame_width = int(self.capture.get(3))#480
self.frame_height = int(self.capture.get(4))# 640
# Set up codec and output video settings
if(src==2 or src==3):
self.codec = cv2.VideoWriter_fourcc('M','J','P','G')
self.output_video = cv2.VideoWriter(self.video_file_name, self.codec, 30, (self.frame_width, self.frame_height))
# Start the thread to read frames from the video stream
self.thread = Thread(target=self.update, args=(src,))
self.thread.daemon = True
self.thread.start()
# Start another thread to show/save frames
self.start_recording()
print('initialized {}'.format(self.video_file))
if (src==0):
self.e_recording_thread = Thread(target=self.endo_recording_thread, args=())
self.e_recording_thread.daemon = True
self.e_recording_thread.start()
print('initialized endo recording')
def update(self,src):
# Read the next frame from the stream in a different thread
while True:
if self.capture.isOpened():
(self.status, self.frame) = self.capture.read()
if (src==3):
self.frame= cv2.flip(self.frame,-1)
def show_frame(self):
# Display frames in main program
if self.status:
cv2.namedWindow(self.frame_name, cv2.WINDOW_NORMAL)
cv2.imshow(self.frame_name, self.frame)
# Press Q on keyboard to stop recording0000
key = cv2.waitKey(1)
if key == ord('q'):#
self.capture.release()
self.output_video.release()
cv2.destroyAllWindows()
exit(1)
def save_frame(self):
# Save obtained frame into video output file
self.output_video.write(self.frame)
def start_recording(self):
# Create another thread to show/save frames
def start_recording_thread():
while True:
try:
self.show_frame()
self.save_frame()
except AttributeError:
pass
self.recording_thread = Thread(target=start_recording_thread, args=())
self.recording_thread.daemon = True
self.recording_thread.start()
def endo_recording_thread(self):
self.Pr1=sp.call(self.command)
if __name__ == '__main__':
src1 = 'Your link1'
video_writer_widget1 = VideoWriterWidget('Endo_', 0)
src2 = 'Your link2'
video_writer_widget2 = VideoWriterWidget('Camera2_', 2)
src3 = 'Your link3'
video_writer_widget3 = VideoWriterWidget('Camera3_', 3)
# Since each video player is in its own thread, we need to keep the main thread alive.
# Keep spinning using time.sleep() so the background threads keep running
# Threads are set to daemon=True so they will automatically die
# when the main thread dies
while True:
time.sleep(5) -
Generating thumbnails from multiple videos on Desktop, using ffmpeg, or something similar
6 février 2013, par BirkHi guys this is a long shot but here goes...
I basically have what I mentioned in the title running on my server. When I upload a video ffmpeg decomplies it and gives me screenshots, then I pick a screenshot that I want to use for that video. Currently, my server can process 3 videos at a time. The down side is that this uses up A LOT of the server processing power. :(
Is there a way, or a program, that can process several video at a time and generate me screenshots on my Desktop ? If this is possible then I can just use my spare computer here to process everything then upload the screenshots/video to my server.
This is what I basically have running now on the server. kayweb.com.au/blogs/Web-Development/Generating-screenshots-using-FFmpeg
Something like this, But this thumbnail generator puts everything into one image. I need to be able to choose with thumbnail I want to use.
http://www.tothepc.com/archives/make-movie-caps-screenshots-with-free-video-thumbnails-maker/Anyone have any suggestions ?