Recherche avancée

Médias (91)

Autres articles (81)

  • Configuration spécifique pour PHP5

    4 février 2011, par

    PHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
    Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
    Modules spécifiques
    Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...)

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang 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.

Sur d’autres sites (4507)

  • fluent-ffmpeg from an array of input files

    15 décembre 2016, par leonard vertighel

    I want to use fluent-ffmpeg to create a video of last n images of a directory, or database entries.

    Which is the correct syntax ?

    These are my tries :

    Mimic shell command

    ffmpeg()
     .addInput('ls *png | tail -n 17')
     .inputOptions("-pattern_type glob")
     .output("output.mp4").run()

    but it does not accept shell commands ;

    space - separated paths

    ffmpeg()
     .addInput('a*.png b*.png ')
     .inputOptions("-pattern_type glob")
     .output("output.mp4").run()

    but it does not accept list of files separated by spaces ;

    Array of image paths

    ffmpeg()
     .addInput(array) // ['aa.png', 'a1.png',,,'bbb.png']
     .inputOptions("-pattern_type glob")
     .output("output.mp4").run()

    but it does not accept arrays.

    EDIT :

    Also, from Merge Multiple Videos using node fluent ffmpeg, I am able to add multiple inputs using an array of files as

    var ffmpeg= require('fluent-ffmpeg');
    var f=ffmpeg()
    pngarr.forEach(p => f.input(p)) /// pngarr is my array of png paths

    But running

    f.output("./output.mp4").run()

    I obtain just a video of 0 seconds containing the first png of the list.

  • fluent-ffmpeg from an array of input files

    30 juillet 2017, par leonard vertighel

    I want to use fluent-ffmpeg to create a video of last n images of a directory, or database entries.

    Which is the correct syntax ?

    These are my tries :

    Mimic shell command

    ffmpeg()
     .addInput('ls *png | tail -n 17')
     .inputOptions("-pattern_type glob")
     .output("output.mp4").run()

    but it does not accept shell commands ;

    space - separated paths

    ffmpeg()
     .addInput('a*.png b*.png ')
     .inputOptions("-pattern_type glob")
     .output("output.mp4").run()

    but it does not accept list of files separated by spaces ;

    Array of image paths

    ffmpeg()
     .addInput(array) // ['aa.png', 'a1.png',,,'bbb.png']
     .inputOptions("-pattern_type glob")
     .output("output.mp4").run()

    but it does not accept arrays.

    EDIT :

    Also, from Merge Multiple Videos using node fluent ffmpeg, I am able to add multiple inputs using an array of files as

    var ffmpeg= require('fluent-ffmpeg');
    var f=ffmpeg()
    pngarr.forEach(p => f.input(p)) /// pngarr is my array of png paths

    But running

    f.output("./output.mp4").run()

    I obtain just a video of 0 seconds containing the first png of the list.

  • Run python ffmpeg audio convertion code file from subprocess.call() within a flask server

    11 novembre 2019, par Kasun

    I 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 e

    The 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.