
Recherche avancée
Autres articles (25)
-
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
Monitoring de fermes de MediaSPIP (et de SPIP tant qu’à faire)
31 mai 2013, parLorsque l’on gère plusieurs (voir plusieurs dizaines) de MediaSPIP sur la même installation, il peut être très pratique d’obtenir d’un coup d’oeil certaines informations.
Cet article a pour but de documenter les scripts de monitoring Munin développés avec l’aide d’Infini.
Ces scripts sont installés automatiquement par le script d’installation automatique si une installation de munin est détectée.
Description des scripts
Trois scripts Munin ont été développés :
1. mediaspip_medias
Un script de (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;
Sur d’autres sites (4895)
-
FFMpeg Command work in command line, but in python script the image is blueish ? (Semi Solved)
17 juin 2015, par FooldjOkay, kind of a weird problem. But I’m not sure whether it’s python, ffmpeg, or some stupid thing I’m doing wrong.
I’m trying to take a video, and take 1 frame a second, and output that frame to an image. Right now, if i use the command line with ffmpeg :
ffmpeg -i test.avi -r 1 -f image2 image-%3d.jpeg -pix_fmt rgb24 -vcodec rawrvideo
It outputs about 10 images, the images look fine, awesome. Now I have this code (right now some code from some github, as I wanted stuff that i was relatively sure would work, and mine is allll convoluted)
import subprocess as sp
import numpy as np
import re
import cv2
import time
FFMPEG_BIN = r'ffmpeg.exe'
INPUT_VID = 'test.avi'
def getInfo():
command = [FFMPEG_BIN,'-i', INPUT_VID, '-']
pipe = sp.Popen(command, stdout=sp.PIPE, stderr=sp.PIPE)
pipe.stdout.readline()
pipe.terminate()
infos = pipe.stderr.read()
infos_list = infos.split('\r\n')
res = re.search(' \d+x\d+ ',infos)
res = [int(x) for x in res.group(0).split('x')]
return res
res = getInfo()
command = [ FFMPEG_BIN,
'-i', INPUT_VID,
'-f', 'image2pipe',
'-pix_fmt', 'rgb24',
'-vcodec', 'rawvideo', '-']
pipe = sp.Popen(command, stdout = sp.PIPE, bufsize=10**8)
n = 0
im2 = []
try:
mog = cv2.BackgroundSubtractorMOG2(120,2,True)
while True:
raw_image = pipe.stdout.read(res[0]*res[1]*3)
# transform the byte read into a numpy array
image = np.fromstring(raw_image, dtype='uint8')
image = image.reshape((res[1],res[0],3))
rgbImg = image.copy()
fname = ('_tmp%03d.png'%time.time())
cv2.imwrite(fname, rgbImg)
# throw away the data in the pipe's buffer.
#pipe.stdout.flush()
n += 1
print n
except:
print 'done',n
pipe.kill()
cv2.destroyAllWindows()When I run this, I get 10 images, but they all have a Blue Tint ! I cannot for the life of me figure out why. I’ve done tons of searches, I’ve tried quite a few different codecs (usually just messes things up worse). The media info for the video file is here :
General
Complete name : test.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 85.0 KiB
Duration : 133ms
Overall bit rate : 5 235 Kbps
Video
ID : 0
Format : JPEG
Codec ID : MJPG
Duration : 133ms
Bit rate : 1 240 Kbps
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate : 30.000 fps
Color space : YUV
Chroma subsampling : 4:2:2
Bit depth : 8 bits
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.135
Stream size : 20.1 KiB (24%)Any suggestions ? It seems like it should be an RGB mixup...just not sure where at...
EDIT : So I fixed the problem by switching the blue and red channels with this code :
bChannel = rgbImg[ :, :,0]
rChannel = rgbImg[ :, :,2]
gChannel = rgbImg[ :, :,1]rgbArray = np.zeros((res[1],res[0],3), 'uint8')
rgbArray[...,0] = rChannel
rgbArray[...,1] = gChannel
rgbArray[...,2] = bChannelSo I guess this is now a question of, why is python mixing up these channels ? Is it a problem with python, or ffmpeg, the codec ?
Thanks !
-
FFMPEG - How to replace a specifed set of colors in a video with another specified set of colors ?
18 juillet 2022, par pixerstoodiosFor example, I have a video of red, yellow, green, cyan, blue, and magenta objects. I have a list of hex codes consisting of those colors and i want to replace each of those specific hex colors with another, completely different arbitrary color (i.e. brown, royal purple, navy blue, burgundy, tan, and white, respectively.)




What would be a command that can efficiently accomplish this task ?


-
How to extract a video snippet from a video file that is being written in by ffmpeg in realtime
26 février 2015, par alex.bAt the moment i am recording a LIVE stream video from youtube with youtube-dl (https://github.com/rg3/youtube-dl)
The command i use for this :
youtube-dl --id -f 92 https://www.youtube.com/watch?v=VYlQJbsVs48
92 is a format code that i got after executing a command to get the formats, that gave me this list :
format code extension resolution note
140 m4a audio only DASH audio 144k , m4a_dash container, aac @128k (48000Hz)
141 m4a audio only DASH audio 272k , m4a_dash container, aac @256k (48000Hz)
160 mp4 256x144 DASH video 124k , 15fps, video only
133 mp4 426x240 DASH video 258k , 30fps, video only
134 mp4 640x360 DASH video 616k , 30fps, video only
135 mp4 854x480 DASH video 1116k , 30fps, video only
136 mp4 1280x720 DASH video 2216k , 30fps, video only
137 mp4 1920x1080 DASH video 4141k , 30fps, video only
151 mp4 72p HLS
132 mp4 240p HLS
92 mp4 240p HLS
93 mp4 360p HLS
94 mp4 480p HLS
95 mp4 720p HLS
96 mp4 1080p HLS (best)This is creating a file called VYlQJbsVs48.mp4.part that gets bigger and bigger of course.
Is there a way to extract a video snippet from that live stream or form the part file ? Or maybe there is a better way of doing this ?
What i have noticed is that if i force quit iTerm2 while youtube-dl is running the .part file it creates wont contain any index information (something to do with an moov atom not being present in the mp4 file - which is the information about the number of frames and other things - metadata i think), so it makes me think i cannot extract from the file.
Maybe if there would be a way that youtube-dl can write the index information at all times or maybe another way that i can record the live stream and get video snippets while its recording.
I forgot to mention i am doing this on OSX Yosemite. I have FFMPEG installed with homebrew and youtoube-dl
I am more than happy to try stuff on UBUNTU if there is a solution.
Any help would be greatly appreciated.
Thank you.
Alex