
Recherche avancée
Autres articles (64)
-
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
(Dés)Activation de fonctionnalités (plugins)
18 février 2011, parPour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...) -
Le plugin : Podcasts.
14 juillet 2010, parLe problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
Types de fichiers supportés dans les flux
Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)
Sur d’autres sites (12992)
-
How to use ffmpeg in flask server to convert between audio formats without writing files to disk ?
14 avril 2020, par AthwulfI have successfully managed to use ffmpeg in python to convert the format of some audio files like this :



command = "ffmpeg -i audio.wav -vn -acodec pcm_s16le output.wav"
subprocess.call(command, shell=True)




However I want to do this in memory and avoid saving the input and output files to disk.



I have found the follwing code to do such a thing (Passing python’s file like object to ffmpeg via subprocess) :



command = ['ffmpeg', '-y', '-i', '-', '-f', 'wav', '-']
process = subprocess.Popen(command, stdin=subprocess.PIPE)
wav, errordata = process.communicate(file)




But I am struggeling to use this in my context.



I am receiving the file on a server as part of a multipart/form-data request.



@server.route("/api/getText", methods=["POST"])
def api():
 if "multipart/form-data" not in request.content_type:
 return Response("invalid content type: {}".format(request.content_type))
 # check file format
 file = request.files['file']
 if file:
 print('**found file', file.filename)




Now I have the file as a FileStorage Object (https://tedboy.github.io/flask/generated/generated/werkzeug.FileStorage.html). This object has a stream, which can be accessed by using the read method. So I thought I might be able to use this as input for ffmpeg like so :



f = file.read()
command = ['ffmpeg', '-y', '-i', '-', '-f', 'wav', '-']
process = subprocess.Popen(command, stdin=subprocess.PIPE)
wav, errordata = process.communicate(f)




However this yields the the following error :



AssertionError: Given audio file must be a filename string or a file-like object




I have also tried another approach which I found online, using io.BytesIO, to which I can't find the source anymore :



memfile = io.BytesIO() # create file-object
memfile.write(file.read()) # write in file-object
memfile.seek(0) # move to beginning so it will read from beginning




And then trying this again :



command = ['ffmpeg', '-y', '-i', '-', '-f', 'wav', '-']
process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
wav, errordata = process.communicate(memfile)




This gets me the following error :



TypeError: a bytes-like object is required, not '_io.BytesIO'




Does anyone have an idea of how to do this ?



Update



The first error message is actually not a error message thrown by ffmpeg. As v25 pointed out correctly in his answer the first approach also returns a bytes object and is also a valid solution.



The error message got thrown by a library (speech_recognition) when trying to work with the modified file. In the unlikely case of someone coming across the same problem here the solution :



The bytes objected returned by ffmpeg (variable wav) has to be turned into a file-like object as the error message implies. This can easily be done like this :



memfileOutput = io.BytesIO(wav)


-
OpenCV videocapture() not opening video file from hard disk
8 janvier 2020, par Rossi RiccardoDespite being a lot of threads on the issue of open CV not being able to open videos i still can’t manage to solve it.
I’m trying to open and extract frames using openCV with spyder (os : windows 10, python 3.7.4). As far as i know (provided the file path is correct) cv2.read returns a 0 if either the codec is unsupported (converted the video to H264 to be sure and also downloaded a test avi used to test out this very issue in an older post ) or if there is a problem with the ffmpeg dependency.
Since i thought this was the source of the issue i added conda and phyton to the PATH with the SETX command and, after that, ended up copying ffmpeg dll and cv2 folders everywhere since i couldn’t understand well were i was supposed to paste it. Results is that i still can’t make it work and can’t even opt to try to make the frame extractor directly with ffmpeg since even that one gives me an error with a copypasted function from it’s site.
Here is the code :
import os
import ffmpeg
def read_frame_as_jpeg(in_filename, frame_num):
out, err = (
ffmpeg
.input(in_filename)
.filter('select', 'gte(n,{})'.format(frame_num))
.output('pipe:', vframes=1, format='image2', vcodec='mjpeg')
.run(capture_stdout=True)
)
# Read the video from specified path
#cam = cv2.VideoCapture(r'C:\MY\folder\264H.mp4')
cam = cv2.VideoCapture(r'C:\Users\name\Downloads\drop.avi')
fps=60
vid_start=371
vid_end=377
sens=20
out_dir=r"C:\MY\folder"
out_dir=out_dir+'\\'
print(out_dir)
stri="drop.avi"#even tried putting the fiel in the same directory, no change
read_frame_as_jpeg(stri, 1)
# frame
currentframe = 0
while(True):
# reading from frame
ret,frame = cam.read()
print(currentframe)
if ret and currentframe>= (fps*vid_start)-sens and currentframe<= (fps*vid_end)+sens:
# if video is still left continue creating images
name = out_dir+ str(currentframe) + '.bmp'
print ('Creating...' + name)
# writing the extracted images
cv2.imwrite(name, frame)
# increasing counter so that it will
# show how many frames are created
currentframe += 1
else:
break
# Release all space and windows once done
cam.release()
cv2.destroyAllWindows()The ffpeg error that i get is
[WinError 2] Impossible to find the specified file
while on the other hand since videocapture returns a 0 it doesn’t even enter the loop so i get just a "0" print
-
How to use ffmpeg in flask server to convert audio format without writing files to disk ?
6 janvier 2020, par AthwulfI have successfully managed to use ffmpeg in python to convert the format of some audio files like this :
command = "ffmpeg -i audio.wav -vn -acodec pcm_s16le output.wav"
subprocess.call(command, shell=True)However I want to do this in memory and avoid saving the input and output files to disk.
I have found the follwing code to do such a thing (Passing python’s file like object to ffmpeg via subprocess) :
command = ['ffmpeg', '-y', '-i', '-', '-f', 'wav', '-']
process = subprocess.Popen(command, stdin=subprocess.PIPE)
wav, errordata = process.communicate(file)But I am struggeling to use this in my context.
I am receiving the file on a server as part of a multipart/form-data request.
@server.route("/api/getText", methods=["POST"])
def api():
if "multipart/form-data" not in request.content_type:
return Response("invalid content type: {}".format(request.content_type))
# check file format
file = request.files['file']
if file:
print('**found file', file.filename)Now I have the file as a FileStorage Object (https://tedboy.github.io/flask/generated/generated/werkzeug.FileStorage.html). This object has a stream, which can be accessed by using the read method. So I thought I might be able to use this as input for ffmpeg like so :
f = file.read()
command = ['ffmpeg', '-y', '-i', '-', '-f', 'wav', '-']
process = subprocess.Popen(command, stdin=subprocess.PIPE)
wav, errordata = process.communicate(f)However this yields the the following error :
AssertionError: Given audio file must be a filename string or a file-like object
I have also tried another approach which I found online, using io.BytesIO, to which I can’t find the source anymore :
memfile = io.BytesIO() # create file-object
memfile.write(file.read()) # write in file-object
memfile.seek(0) # move to beginning so it will read from beginningAnd then trying this again :
command = ['ffmpeg', '-y', '-i', '-', '-f', 'wav', '-']
process = subprocess.Popen(command, stdin=subprocess.PIPE)
wav, errordata = process.communicate(memfile)This gets me the following error :
TypeError: a bytes-like object is required, not '_io.BytesIO'
Does anyone have an idea of how to do this ?