Recherche avancée

Médias (3)

Mot : - Tags -/pdf

Autres articles (48)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

Sur d’autres sites (7782)

  • Resque does not find ffmpeg

    17 décembre 2012, par d33pika

    I am using resque to queue some encoding jobs. I have workers that pick up these jobs and do some transcoding.
    The issue is system "mencoder .." works fine but system "ffmpeg .." throws not found and the same to with system "qt-faststart .."
    I installed mencoder using sudo apt-get install.
    ffmpeg and qt-faststart were built from source.
    So mencoder was in /usr/bin and the other two in /usr/local/bin.
    So, the next thing I tried was using full path in the system command, that also returned not found.
    Then I copied ffmpeg and qt-faststart into /usr/bin.. Still got "Not Found"
    My worker code runs standalone but when god runs it, ffmpeg and qt-fasstart fail to execute. Yes, I have god configured to watch resque. Now, I don't know what else to try ! Any ideas ?

  • building voice recorder using ffmpeg and html5

    15 juillet 2014, par user3789242

    I’m building a voice recorder program using html5 I have managed so far to record the voice and save the audio file as .wav I also can convert that file to a selected file format using ffmpeg. what I want to do is to let the user choose the format before recording so that when saving the audio file will be converted directly using ffmpeg into the selected format.I have been looking for demos for weeks and can’t find anything if someone can help me with a demo please.
    thank you in advance
    this is my javascript code for uploading the saved audio as .wav in a folder named upload, and the fmpeg conversion, i’m missing the call of the file saved in the folder please :

    function handleWAV(blob) {

    if (currentEditedSoundIndex !== -1) {
    $('#inFile2 tr:nth-child(' + (currentEditedSoundIndex + 1) + ')').remove();

    }

    var url = URL.createObjectURL(blob);

    var li = document.createElement('li');
    var au = document.createElement('audio');
    var hf = document.createElement('a');

    au.controls = true;
    au.src = url;
    hf.href = url;
    hf.download = 'audio_recording_' + new Date().getTime() + '.wav';
    hf.innerHTML = hf.download;
    li.appendChild(au);
    li.appendChild(hf);
    inFile2.appendChild(li);


    fileName=hf.download;

    var reader = new FileReader();
    reader.onload = function(event){
       var fd = new FormData();
       var Name = encodeURIComponent('audio_recording_' + new Date().getTime() + '.wav');
       console.log("name = " + Name);
       fd.append('fname', Name);
       fd.append('data', event.target.result);
       $.ajax({
           type: 'POST',
           url: 'upload.php',
           data: fd,
           processData: false,
           contentType: false,
           success: function(data){
               //console.log(data);
           }
       });
    };      
    reader.readAsDataURL(blob);



    var fileBuffer;



    // create ffmpeg worker
    function getFFMPEGWorker() {


        var ffmpegWorker = new Worker('worker.js');

        ffmpegWorker.addEventListener('message', function(event) {
            var message = event.data;
            console.log(message.type);
            if (message.type === "ready" && window.File && window.FileList && window.FileReader) {
                // script loaded, hide loader

            } else if (message.type == "stdout") {
                console.log(message.data);
            } else if (message.type == "stderr") {
                console.log(message.data);
            } else if (message.type == "done") {
                var code = message.data.code;
                console.log(code);
                console.log(message.data);
                var outFileNames = Object.keys(message.data.outputFiles);

                console.log(outFileNames);
                if (code == 0 && outFileNames.length) {
                    var outFileName = outFileNames[0];
                    console.log(outFileName);
                    var outFileBuffer = message.data.outputFiles[outFileName];
                    console.log(outFileBuffer);
                    var src = url;
                    console.log(url);
                    $("#downloadLink2").attr('href', src);
                    $("#download2").show();
                } else {
                    $("#error").show();
                }

            }
        }, false);
        return ffmpegWorker;
    }

    // create ffmpeg worker
    var ffmpegWorker = getFFMPEGWorker();
    var ffmpegRunning = false;
    if (ffmpegRunning) {
        ffmpegWorker.terminate();
        ffmpegWorker = getFFMPEGWorker();
    }
    ffmpegRunning = true;



    // hide download div
    $("#download2").hide();

    // change download file name
    var fileNameExt = fileName.substr(fileName.lastIndexOf('.') + 1);

    var outFileName = fileName.substr(0, fileName.lastIndexOf('.')) + "." + getOutFormat();

    $("#downloadLink2").attr("download2", outFileName);
    $("#downloadLink2").text(outFileName);

    var arguments = [];
    arguments.push("-i");
    arguments.push(fileName);

    arguments.push("-b:a");
    arguments.push(getBitrate());

    switch (getOutFormat()) {
        case "mp3":
            arguments.push("-acodec");
            arguments.push("libmp3lame");
            arguments.push("out.mp3");
            break;

        case "wma":
            arguments.push("-acodec");
            arguments.push("wmav1");
            arguments.push("out.asf");
            break;

        case "pcm":
            arguments.push("-f");
            arguments.push("s16le");
            arguments.push("-acodec");
            arguments.push("pcm_s16le");
            arguments.push("out.pcm");
    }

    ffmpegWorker.postMessage({
        type: "command",
        arguments: arguments,
        files: [
            {
                "name": fileName,
                "buffer": fileBuffer
            }
        ]
    });


    function getOutFormat() {
    return $('input[name=format]:checked').val();
    }

    function getBitrate() {
    return $('input[name=bitrate]:checked').val();
    }

    function readInputFile(file) {


    // load file content
    var reader = new FileReader();
    reader.onload = function(e) {

        fileName = file.name;
        console.log(fileName);
        fileBuffer = e.target.result;
    }
    reader.readAsArrayBuffer(file);

    }



    function handleFileSelect(event) {
    var files = event.target.files; // FileList object
    console.log(files);
    // files is a FileList of File objects. display first file name
    file = files[0];
    console.log(file);
    if (file) {

        readInputFile(file);
        console.log(file);

    }
    }

    // setup input file listeners
    el=document.getElementById('inFile2');

    el.addEventListener('change',handleFileSelect, true);

    }

    note that this code was taken from a demo where the user upload the file to be converted by browisng it, I just want to cancel the browsing process and upload the saved file directly

  • ffmpeg - escaping single quotes doesn't work [duplicate]

    18 septembre 2022, par XorOrNor

    I've written a small python script for mass converting audio files. It uses ffmpeg. The problem is it doesn't work for files with single quotes in their filenames.

    


    script :

    


    
import os
import subprocess
import sys
from multiprocessing.pool import ThreadPool as Pool

source_dir="/home/kris/Music/test"
output_dir="/home/kris/Music/test_opus"

def worker(file):

    try:    
        dirname=os.path.dirname(file)
        file=file.replace("'","\\\\'")
        filename=file.split('.flac')[0]
        
        input_file=f"'{source_dir}/{file}'"
        output_file=f"'{output_dir}/{filename}.opus'"
        cmd="ffmpeg -n -i "+input_file+" -c:a libopus -b:a 320k "+output_file
        print(cmd)
        result = subprocess.call(cmd,stdout=subprocess.PIPE,shell=True)
    except:
        print('item error')
        

def start():    
    threads=os.cpu_count()  
    pool = Pool(threads)
    files=os.listdir(source_dir)
    for item in files:
        pool.apply_async(worker, (item,))

    pool.close()
    pool.join()
        
start()



    


    Testing :

    


      

    1. Filename : I'm a file.flac

      


    2. 


    3. When escaping single quote ' with double backslashes \\ - file=file.replace("'","\\\\'") the cmd for ffmpeg is :

      


    4. 


    


    ffmpeg -n -i '/home/kris/Music/test/I\\'m a file.flac' -c:a libopus -b:a 320k '/home/kris/Music/test_opus/I\\'m a file.opus'


    


    ffmpeg returns an error : /home/kris/Music/test/I\\m: No such file or directory

    


      

    1. When escaping single quote ' with a single backslash \ - file=file.replace("'","\\'") the cmd for ffmpeg is :
    2. 


    


    ffmpeg -n -i '/home/kris/Music/test/I\'m a file.flac' -c:a libopus -b:a 320k '/home/kris/Music/test_opus/I\'m a file.opus'


    


    I got an error :

    


    /bin/sh: 1: Syntax error: Unterminated quoted string


    


    According to ffmpeg docs : https://ffmpeg.org/ffmpeg-utils.html#toc-Examples escaping with single backslash should work.