
Recherche avancée
Médias (21)
-
1,000,000
27 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Demon Seed
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Four of Us are Dying
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Corona Radiata
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Lights in the Sky
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Head Down
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (72)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (9918)
-
Run python ffmpeg audio convertion code file from subprocess.call() within a flask server
11 novembre 2019, par KasunI have build a small flask server to handle the request. I have 3 parameters in the api function that i want to get. those are
type
,user_id
,audio_file
, One is a file. Since it’s used for the audio file conversion. I have to get a file.. I have tested with this in Postman audio file get saved but the subprocess.call(command) in the api function doesn’t work..this is the flask server code
@app.route('/voice', methods=['GET','POST'])
def process_audio():
try:
if request.method == 'POST':
input_type = request.form['type']
user_id = request.form['user_id']
static_file = request.files['audio_file']
audio_name = secure_filename(static_file.filename)
path = 't/'
status = static_file.save(path + audio_name)
full_file = path + audio_name
if input_type == 1:
cmd = "python t/convert_english.py --audio " + full_file
res = subprocess.call([cmd],shell=True)
f = open('t/ress.txt', 'w')
f.write(str(res))
f.close()
return "true"
else:
cmd = "python t/convert_sinhala.py --audio " + full_file
os.system(cmd)
return "true"
else:
return "false"
except Exception as e:
print(e)
logger.error(e)
return eThe audio file get saved in the directory as expected..
this is the
convert_english.py
import subprocess
import argparse
import os
import logging
import speech_recognition as sr
from tqdm import tqdm
from multiprocessing.dummy import Pool
#subprocess.call('pip install pydub',shell=True)
from os import path
from pydub import AudioSegment
logging.basicConfig(filename='/var/www/img-p/t/ee.log', level=logging.DEBUG,
format='%(asctime)s %(levelname)s %(name)s %(message)s')
logger=logging.getLogger(__name__)
ap = argparse.ArgumentParser()
ap.add_argument("-a", "--audio", required=True,
help="path to input audio file")
args = vars(ap.parse_args())
src = args["audio"]
dst = "audio.wav"
sound = AudioSegment.from_mp3(src)
sound.export(dst, format="wav")
#subprocess.call('pip install ffmpeg-python',shell=True)
subprocess.call('mkdir parts',shell=True)
subprocess.call('ffmpeg -i audio.wav -f segment -segment_time 30 -c copy parts/out%09d.wav',shell=True)
#subprocess.call('pip install SpeechRecognition',shell=True)
pool = Pool(8) # Number of concurrent threads
with open("api-key.json") as f:
GOOGLE_CLOUD_SPEECH_CREDENTIALS = f.read()
r = sr.Recognizer()
files = sorted(os.listdir('parts/'))
def transcribe(data):
idx, file = data
name = "parts/" + file
print(name + " started")
# Load audio file
with sr.AudioFile(name) as source:
audio = r.record(source)
# Transcribe audio file
text = r.recognize_google_cloud(audio, credentials_json=GOOGLE_CLOUD_SPEECH_CREDENTIALS)
print(name + " done")
return {
"idx": idx,
"text": text
}
all_text = pool.map(transcribe, enumerate(files))
pool.close()
pool.join()
transcript = ""
for t in sorted(all_text, key=lambda x: x['idx']):
total_seconds = t['idx'] * 30
# Cool shortcut from:
# https://stackoverflow.com/questions/775049/python-time-seconds-to-hms
# to get hours, minutes and seconds
m, s = divmod(total_seconds, 60)
h, m = divmod(m, 60)
# Format time as h:m:s - 30 seconds of text
transcript = transcript + "{:0>2d}:{:0>2d}:{:0>2d} {}\n".format(h, m, s, t['text'])
print(transcript)
with open("transcript.txt", "w") as f:
f.write(transcript)
f = open("transcript.txt")
lines = f.readlines()
f.close()
f = open("transcript.txt", "w", encoding="utf-8")
for line in lines:
f.write(line[8:])
f.close()The thing is above code works when i manually run the command -> python t/convert_english.py —audio t/tttttttttt.mp3 like this in the terminal..
But when i try to run from the flask server itself it doesn’t works.. And I’m not getting an error either.
-
ffmpeg code not working aws lambda environment
5 janvier 2021, par Akash DasI followed this article and deployed the Lambda functions and layers and set it up all fine.


But I am facing a problem when I try converting the mp4 video into a 720p video, the ffmpeg commands that work in my Ubuntu 20.04 are not working in the Lambda and gives me error in the form of 0kb files in the destination folder.


Can someone explain why this is happening ? The command that I used was :


ffmpeg -i input.mp4 -s 1280x720 -c:a copy output.mp4



I use this command in the Python file


ffmpeg_cmd = "/opt/bin/ffmpeg -i \"" + s3_source_signed_url + "\" -f mp4 -s 1280x720 -c:a copy -" ___ . 



This is the error I get :




The problem is that I used a code like this to get only the audio


ffmpeg_cmd = "/opt/bin/ffmpeg -i \"" + s3_source_signed_url + "\" -f mp3 -ab 192000 -vn -" ___ . 



And it works as expected.


-
Anomalie #4697 (Nouveau) : Mauvaise redirection d’article virtuel si [] dans l’url
17 mars 2021Bonjour,
Utilisant le plugin critère mots, j’ai des url du type :
?rubrique21&mots[]=124
J’ai eu besoin de faire une redirection via un article virtuel sur cette url.
Mais elle est interprétée dasn l’admin en :- à l’affichage : ?rubrique21&mots[=124]
- en tant que code html :
?rubrique21&mots[=124]
donc :
- lien : ?rubrique21&mots[
- suivi de =124]
Mais, curieusement, si je clique non pas sur ce lien (qui donne une 404), mais sur [Voir en ligne], j’arrive bien au bon endroit.
C’est contusionnant.
Testé sur SPIP 3.2.9 (avec des plugins) et 3.3 (sans aucun plugin)