Recherche avancée

Médias (17)

Mot : - Tags -/wired

Autres articles (65)

  • 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 (...)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

Sur d’autres sites (8763)

  • FFmpeg-kit : Unknown encoder 'libx264' / 'mediacodec' and Gradle dependency issues in Android Studio

    15 mai, par Izzet dönertaş

    I'm working on a video editor app in Android Studio using ffmpeg-kit. My goal is to export video segments with fade transitions and audio using FFmpeg.

    


    This implementation line works fine :

    


    implementation("com.arthenica:ffmpeg-kit-full:6.0-2")


    


    What doesn't work (Encoding) :
When I try to export a video segment using :

    


    -c:v libx264 -c:a aac


    


    I get this error in the logs :

    


    [vost#0:0 @ ...] Unknown encoder 'libx264'


    


    After checking the build configuration, it turns out libx264 is not enabled in the current FFmpeg-kit build :

    


    --disable-libx264 (or rather: --enable-libx264 is missing)


    


    Tried replacing libx264 with mediacodec :
Then I tried using :

    


    -c:v mediacodec -c:a aac


    


    But again I got :

    


    Unknown encoder 'mediacodec'


    


    Apparently, mediacodec is supported for decoding, but not as an encoder in FFmpeg-kit.

    


    Tried to compile my own FFmpeg binary :
I attempted building FFmpeg manually using the following flags :

    


    --enable-libx264 --enable-gpl --enable-shared ...


    


    My plan was to access it via JNI or ProcessBuilder.

    


    But the process is extremely frustrating :

    


      

    • Missing file errors
    • 


    • Configuration conflicts
    • 


    • Dependency hell (especially on macOS/Linux NDK toolchains)
    • 


    


    Tried other ffmpeg-kit variants :
I also tried switching to :

    


    implementation 'com.arthenica:ffmpeg-kit-full-gpl:6.0'


    


    and other variants like ffmpeg-kit-min-gpl, etc.
But in all of them I got the same Gradle error :

    


    Caused by: org.gradle.api.internal.artifacts.ivyservice.TypedResolveException:  Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

    


    My build.gradle setup (yes, mavenCentral + google are already included) :

    


    pluginManagement {
    repositories {
        google()
        mavenCentral()
    }
}

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}



    


    I also tried enabling offline mode, clearing cache, adding jetpack.io, nothing helped.

    


    I asked ChatGPT-4o, Gemini 2.5 Pro. None could provide a working solution for this combination of :

    


      

    • Working implementation
    • 


    • Proper video encoding (with libx264 or mediacodec)
    • 


    • Without breaking Gradle dependency resolution
    • 


    


    I just want one of the following :

    


      

    1. A working FFmpeg-kit implementation (that supports libx264) and doesn’t crash Gradle

      


    2. 


    3. A reliable guide or build.gradle snippet that lets me use GPL version (with libx264) without resolve errors

      


    4. 


    5. (Ideally) A prebuilt safe LGPL-compatible alternative that allows encoding and is Google Play compliant

      


    6. 


    


    Any help or suggestions would be highly appreciated.
Thanks in advance

    


  • Single-threaded demuxer with FFmpeg API

    7 décembre 2023, par yaskovdev

    I am trying to create a demuxer using FFmpeg API with the next interface :

    


    interface IDemuxer
{
    void WriteMediaChunk(byte[] chunk);

    byte[] ReadAudioOrVideoFrame();
}


    


    The plan is to use it in a single thread like this :

    


    IDemuxer demuxer = new Demuxer();

while (true)
{
    byte[] chunk = ReceiveNextChunkFromInputStream();
    
    if (chunk.Length == 0) break; // Reached the end of the stream, exiting.
    
    demuxer.WriteMediaChunk(chunk);
    
    while (true)
    {
        var frame = demuxer.ReadAudioOrVideoFrame()

        if (frame.Length == 0) break; // Need more chunks to produce the frame. Let's add more chunks and try produce it again.

        WriteFrameToOutputStream(frame);
    }
}


    


    I.e., I want the demuxer to be able to notify me (by returning an empty result) that it needs more input media chunks to produce the output frames.

    


    It seems like FFmpeg can read the input chunks that I send to it using the read callback.

    


    The problem with this approach is that I cannot handle a situation when more input chunks are required using only one thread. I can handle it in 3 different ways in the read callback :

    


      

    1. Simply be honest that there is no data yet and return an empty buffer to FFmpeg. Then add more data using WriteMediaChunk(), and then retry ReadAudioOrVideoFrame().
    2. 


    3. Return AVERROR_EOF to FFmpeg to indicate that there is no data yet.
    4. 


    5. Block the thread and do not return anything. Once the data arrives, unblock the thread and return the data.
    6. 


    


    But all these options are far from ideal :

    


    The 1st one leads to FFmpeg calling the callback again and again in an infinite loop hoping to get more data, essentially blocking the main thread and not allowing me to send the data.

    


    The 2nd leads to FFmpeg stopping the processing at all. Even if the data appears finally, I won't be able to receive more frames. The only option is to start demuxing over again.

    


    The 3rd one kind of works, but then I need at least 2 threads : first is constantly putting new data to a queue, so that FFmpeg could then read it via the callback, and the second is reading the frames via ReadAudioOrVideoFrame(). The second thread may occasionally block if the first one is not fast enough and there is no data available yet. Having to deal with multiple threads makes implementation and testing more complex.

    


    Is there a way to implement this using only one thread ? Is the read callback even the right direction ?

    


  • Failed to convert web-saved .wemb audio to .wav by using php "shell_exec" and javascript

    30 mai 2022, par Anirbasgnaw

    I'm working on an online experimenter which could record participants' audio from the browser. The audio data I get has an extension of .wemb, so I plan to use ffmpeg to convert it to .wav while I save the data.

    


    I tried to use PHP's shell_exec but nothing happens when I run the scripts. Then I found that my echo and print_r also did not work. I'm new to PHP and javascript, so I''m really confused now.

    


    Below are the relevant codes, I really appreciate it if you could help !

    


    write_data.php :

    


    <?php
  $post_data = json_decode(file_get_contents('php://input'), true); 
  // the directory "data" must be writable by the server
  $name = "../".$post_data['filename'];
  $data = $post_data['filedata'];
   // write the file to disk
  file_put_contents($name, $data);
  
  $INPUT = trim($name) . ".webm";
  $OUTPUT = trim($name) . ".wav";
  echo "start converting...";

  // check if ffmprg is available
  $ffmpeg = trim(shell_exec('which ffmpeg'));
  print_r($ffmpeg);
  // call ffmpeg
  shell_exec("ffmpeg -i '$INPUT' -ac 1 -f wav '$OUTPUT' 2>&1 ");
?>


    


    javascript :

    


      saveData: function(fileName,format){
    // save  as json by default
    if (!format){ format = 'json';}
    // add extension to filename
    fileName = `${fileName}.${format}`
    // create saveData object using fetch
    let saveData = [];
    if (format == 'json') {
        saveData = {
          type: 'call-function',
          async: true,
          func: async function(done) {
            let data = jsPsych.data.get().json();
            const response = await fetch("../write_data.php", {
              method: "POST",
              headers: {
                "content-type": "application/json"
              },
              body: JSON.stringify({ filename: fileName, filedata: data })
            });
            if (response.ok) {
              const responseBody = await response.text();
              done(responseBody);
            }
          }
        }
    } else {
        saveData = {
          type: 'call-function',
          async: true,
          func: async function(done) {
            let data = jsPsych.data.get().csv();
            const response = await fetch("../write_data.php", {
              method: "POST",
              headers: {
                "content-type": "application/json"
              },
              body: JSON.stringify({ filename: fileName, filedata: data })
            });
            if (response.ok) {
              const responseBody = await response.text();
              done(responseBody);
            }
          }
        }
    }
    return saveData;
  },