Recherche avancée

Médias (91)

Autres articles (13)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce 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" ;

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (3402)

  • Problem playing a sound with pydub Error : pydub.exceptions.CouldntDecodeError : Decoding failed. ffmpeg returned error code : 1

    28 mai 2020, par studioDKR

    I have a problem getting a file played in the browser with pydub. I think the function is working, but I just don't get the right file path to it, or something else is missing. Would love to get your help !

    



    I get the pydob error message : pydub.exceptions.CouldntDecodeError : Decoding failed. ffmpeg returned error code : 1

    



    Here is the error I get :

    



    [2020-05-28 16:04:33,023] ERROR in app: Exception on /overview [POST]
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/Micha/Documents/GitHub/podprod/app.py", line 109, in overview
    sound = AudioSegment.from_file(filepath)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pydub/audio_segment.py", line 723, in from_file
    raise CouldntDecodeError(
pydub.exceptions.CouldntDecodeError: Decoding failed. ffmpeg returned error code: 1

Output from ffmpeg/avlib:

b'ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers\n  built with Apple clang version 11.0.3 (clang-1103.0.32.59)\n  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.3 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags=-fno-stack-check --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack\n  libavutil      56. 31.100 / 56. 31.100\n  libavcodec     58. 54.100 / 58. 54.100\n  libavformat    58. 29.100 / 58. 29.100\n  libavdevice    58.  8.100 / 58.  8.100\n  libavfilter     7. 57.100 /  7. 57.100\n  libavresample   4.  0.  0 /  4.  0.  0\n  libswscale      5.  5.100 /  5.  5.100\n  libswresample   3.  5.100 /  3.  5.100\n  libpostproc    55.  5.100 / 55.  5.100\n/Users/Micha/documents/github/podprod/uploads/test2.wav: Invalid data found when processing input\n'


    



    This is the Flask route with the function I am writing.

    



    @app.route("/overview", methods=["GET", "POST"])
def overview():

    entries = []

    # Open a file
    path = app.config["FILE_UPLOADS"]

    with os.scandir(path) as dirs:
        for entry in dirs:
            entries.append(entry.name)

    if request.method == "POST":
        filename = request.form['filename']

        filepath = os.path.join(app.config["FILE_UPLOADS"], filename)

        # Play the sound
        sound = AudioSegment.from_file(filepath)
        play(sound)

        return render_template('overview.html', entries=entries)


    



    Here is the HTML template :

    



        {% extends &#x27;main_template.html&#x27; %}&#xA;&#xA;    {% block title %}PodProd Podcast Overview{% endblock %}&#xA;&#xA;    {% block main %}&#xA;&#xA;    <div class="container">&#xA;&#xA;        <h1>Here is an overview of your files</h1>&#xA;&#xA;        <table class="table table-striped">&#xA;            <tr>&#xA;                <th>Filename</th>&#xA;                <th>Action</th>&#xA;            </tr>&#xA;        {% for result in entries %}&#xA;            {% if ".wav" in result %}&#xA;                <tr>&#xA;                    <td>{{ result }}</td>&#xA;                    <td><form action="" method="POST"> <button type="submit" class="btn btn-primary" value="{{" result="result">Play</button></form>&#xA;                </td></tr>&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;        </table>&#xA;&#xA;    </div>&#xA;&#xA;    {% endblock %}&#xA;

    &#xA;

  • Error -138 returns "Error number -138 occurred"

    29 avril 2016, par bot1131357

    I am trying to create a program that listens for a period of time, and then times out so that it can return to work on other tasks and retry again later. Here is the code I am testing with :

    AVFormatContext *pFormatCtx = NULL;
    AVCodecContext *codecCtx = NULL;
    AVCodec *codec;
    int ret = 0;

    // Register all formats and codecs
    av_register_all();
    avformat_network_init(); // for network streaming

    AVDictionary *d = NULL;           // "create" an empty dictionary
    av_dict_set(&amp;d, "timeout", "5", 0); // add an entry
    av_dict_set(&amp;d, "rtsp_flags", "listen", 0); // add an entry

    char filename[100];
    sprintf_s(filename, sizeof(filename), "%s", "rtsp://127.0.0.1:8554/demo");


    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    printf_s("Open video file.\n");
    // Open video file
    ret = avformat_open_input(&amp;pFormatCtx, filename, NULL, &amp;d);   // Returns -138 here
    if (ret &lt;0)
    {
       printf_s("Failed: cannot open input.\n");
       av_strerror(ret, errbuf, ERRBUFFLEN);
       fprintf(stderr, "avformat_open_input() fail: %s\n", errbuf);
       continue;
       //return -1; // Couldn't find stream information
    }

    In the listening mode, avformat_open_input() returns -138. Using av_strerror() gives the following explanation : "Error number -138 occurred"

    Is this an Easter egg ? What does -138 stand for ?

  • Error : ffmpeg exited with code 1 : Error initializing complex filters. Not yet implemented in FFmpeg, patches welcome

    12 juin 2023, par Mutahhir Khan

    I got this objective

    &#xA;

    &#xA;

    write a function in typescript which takes images array of type

    &#xA;

    &#xA;

    interface Image {&#xA;    buffer: Buffer;&#xA;    start: number;&#xA;    end: number;&#xA;}&#xA;

    &#xA;

    &#xA;

    and audio file of Buffer type, videoLength of type number.The function&#xA;should use fluent-ffmpeg to create a video by combining these images&#xA;based on their start and end time with a transition of fade filter.&#xA;the audio should be placed on video. the code will be running on ab&#xA;ubuntu linux distro. after the video generation is completed, saved&#xA;the video in root directory of project.

    &#xA;

    &#xA;

    import ffmpeg from "fluent-ffmpeg";&#xA;import * as fs from "fs";&#xA;&#xA;interface Image {&#xA;    buffer: Buffer;&#xA;    start: number;&#xA;    end: number;&#xA;}&#xA;&#xA;/**&#xA; *&#xA; * @param images contains the image buffers and their start and end times&#xA; * @param audio  contains the audio buffer, save before use it&#xA; * @param videoLength  contains the video length&#xA; * @objective write a function in typescript which takes images array and audio file of Buffer type, videoLength of type number.&#xA; * the function should use `fluent-ffmpeg` to create a video by combining these images&#xA; * based on their start and end time with a transition of fade filter. the audio should be placed on video.&#xA; * The code will be running on ab ubuntu linux distro. after the video generation is completed, saved the video in root directory of project.&#xA; */&#xA;&#xA;function createVideo(images: Image[], audio: Buffer, videoLength: number) {&#xA;    const command = ffmpeg();&#xA;&#xA;    const audioPath = "audio.mp3";&#xA;    const durations: number[] = [];&#xA;&#xA;    // Add images with start and end times&#xA;    images.forEach((image, index) => {&#xA;        const frameDuration = image.end - image.start; // Calculate duration of each frame&#xA;        durations.push(frameDuration);&#xA;        const imagePath = `image-${index}.png`;&#xA;        fs.writeFileSync(imagePath, image.buffer); // Create temporary image files from buffers&#xA;&#xA;        command.input(imagePath).inputOptions(`-loop 1`).inputOptions(`-t ${frameDuration}`);&#xA;    });&#xA;&#xA;    command.input(audioPath);&#xA;&#xA;    fs.writeFileSync(audioPath, audio); // Create temporary audio file from buffer&#xA;&#xA;    // Add audio&#xA;    command.input(audioPath).inputOptions(`-stream_loop -1`).inputOptions(`-t ${videoLength}`);&#xA;&#xA;    // Add fade filter&#xA;    command.complexFilter([&#xA;        {&#xA;            filter: "fade",&#xA;            options: {&#xA;                enable: `&#x27;between(t,0,1)&#x27;`, // Notice the single quotes around the expression&#xA;                x: "810",&#xA;                y: "465",&#xA;            },&#xA;            inputs: `0:v`,&#xA;            outputs: `fade0`,&#xA;        },&#xA;        {&#xA;            filter: "fade",&#xA;            options: {&#xA;                enable: `&#x27;between(t,1,2)&#x27;`, // Notice the single quotes around the expression&#xA;                x: "810",&#xA;                y: "465",&#xA;            },&#xA;            inputs: `1:v`,&#xA;            outputs: `fade1`,&#xA;        },&#xA;        {&#xA;            filter: "fade",&#xA;            options: {&#xA;                enable: `&#x27;between(t,2,3)&#x27;`, // Notice the single quotes around the expression&#xA;                x: "810",&#xA;                y: "465",&#xA;            },&#xA;            inputs: `2:v`,&#xA;            outputs: `fade2`,&#xA;        },&#xA;    ]);&#xA;&#xA;&#xA;    // Add output options&#xA;    command.outputOptions([&#xA;        "-map [outv]",&#xA;        "-map [outa]",&#xA;        "-shortest",&#xA;    ]);&#xA;&#xA;    // Add output file&#xA;    command.output("output.mp4");&#xA;&#xA;    // Run ffmpeg&#xA;    command.run();&#xA;&#xA;    // Delete temporary files&#xA;    // fs.unlinkSync(audioPath);&#xA;    // images.forEach((image, index) => {&#xA;    //     fs.unlinkSync(`image-${index}.png`);&#xA;    // });&#xA;}&#xA;&#xA;export async function fluentFFmpeg() {&#xA;    try {&#xA;        // Usage example&#xA;        const images: Image[] = [&#xA;            { buffer: fs.readFileSync("image-0.png"), start: 0, end: 5 },&#xA;            { buffer: fs.readFileSync("image-1.png"), start: 6, end: 10 },&#xA;            { buffer: fs.readFileSync("image-2.png"), start: 11, end: 15 },&#xA;        ];&#xA;&#xA;        const audioBuffer: Buffer = fs.readFileSync("audio.mp3");&#xA;        const videoLength: number = 15; // Duration of the resulting video&#xA;        const response = createVideo(images, audioBuffer, videoLength);&#xA;        console.log("response", response);&#xA;    } catch (error) {&#xA;        console.log("error", error);&#xA;    }&#xA;}&#xA;&#xA;&#xA;

    &#xA;