Recherche avancée

Médias (2)

Mot : - Tags -/map

Autres articles (35)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

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

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

Sur d’autres sites (5773)

  • Android ffmpeg Command not executing

    22 juin 2020, par MoTahir

    I am using this FFMPEG library,

    


    first I am playing the video inside my videoView to make sure that the video path is correct

    


    videoView.setVideoURI(Uri.parse(getExternalFilesDir(null)?.absolutePath + "videoToBeEdit"))


    


    then I am calling the code written below to crop the video then put it inside the videoView again just to see the result

    


    val ff = FFmpeg.getInstance(this@EditVideoActivity)
if (ff.isSupported){

  val inFile = File(getExternalFilesDir(null)?.absolutePath ,"videoToBeEdit")
  val outFile = File(getExternalFilesDir(null)?.absolutePath , "result")

  val command = arrayOf("ffmpeg","-i", inFile.absolutePath , "-filter:v", "crop=100:100:0:0", outFile.absolutePath)

  ff.execute(command, object : ExecuteBinaryResponseHandler() {
    override fun onSuccess(message: String?) {
      super.onSuccess(message)
      videoView.setVideoURI(Uri.parse(getExternalFilesDir(null)?.absolutePath + "videoToBeEdit"))
    }

    override fun onProgress(message: String?) {
      super.onProgress(message)
    }

    override fun onFailure(message: String?) {
      super.onFailure(message)
      Log.e("error", "failed")
    }

    override fun onStart() {
      super.onStart()
      Log.e("start", "started the process")
    }

    override fun onFinish() {
      super.onFinish()
      Log.e("finish", "done")
    }
  })
}


    


    but my code above goes from start to error then finish, it doesn't show any error messages and that's making it really hard to know what's actually wrong :( I tried to write my command in different ways following those tutorials tutorial1 tutorial2 link
please help, thank you in advance...

    


  • Add support for playing Audible AAXC (.aaxc) files [PATCH v4]

    1er janvier 2000, par Vesselin Bontchev
    Add support for playing Audible AAXC (.aaxc) files [PATCH v4]
    

    The AAXC container format is the same as the (already supported) Audible
    AAX format but it uses a different encryption scheme.

    Note : audible_key and audible_iv values are variable (per file) and are
    externally fed.

    It is possible to extend https://github.com/mkb79/Audible to derive the
    audible_key and audible_key values.

    Relevant code :

    def decrypt_voucher(deviceSerialNumber, customerId, deviceType, asin, voucher) :
    buf = (deviceType + deviceSerialNumber + customerId + asin).encode("ascii")
    digest = hashlib.sha256(buf).digest()
    key = digest[0:16]
    iv = digest[16 :]

    # decrypt "voucher" using AES in CBC mode with no padding
    cipher = AES.new(key, AES.MODE_CBC, iv)
    plaintext = cipher.decrypt(voucher).rstrip(b"\x00") # improve this !
    return json.loads(plaintext)

    The decrypted "voucher" has the required audible_key and audible_iv
    values.

    Update (Nov-2020) : This patch has now been tested by multiple folks -
    details at the following URL :

    https://github.com/mkb79/Audible/issues/3

    Signed-off-by : Vesselin Bontchev <vesselin.bontchev@yandex.com>

    • [DH] libavformat/isom.h
    • [DH] libavformat/mov.c
  • Write EPIPE after upgrade NodeJS

    28 juillet, par Rougher

    I am using this code for detecting audio replay gain. It was working well with NodeJs 16, but after upgrading to NodeJs 22, it started crashing a few times in an hour with this error :

    &#xA;

    write EPIPE&#xA;    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:87:19) {&#xA;  errno: -32,&#xA;  code: &#x27;EPIPE&#x27;,&#xA;  syscall: &#x27;write&#x27;&#xA;}&#xA;

    &#xA;

    My original code was

    &#xA;

    static getReplayGainVolume(audioData: Buffer) {&#xA;        // Calculate the mean volume of the audio file at the given filePath&#xA;        var ffmpeg = spawn(&#x27;ffmpeg&#x27;, [&#xA;            &#x27;-i&#x27;, &#x27;-&#x27;,&#xA;            &#x27;-af&#x27;, &#x27;replaygain&#x27;,&#xA;            &#x27;-f&#x27;, &#x27;null&#x27;, &#x27;/dev/null&#x27;,&#xA;            &#x27;-hide_banner&#x27;, &#x27;-nostats&#x27;&#xA;        ]);&#xA;&#xA;        var output = &#x27;&#x27;;&#xA;&#xA;        ffmpeg.stdin.write(audioData);&#xA;        ffmpeg.stdin.end();&#xA;&#xA;        return new Promise((resolve,reject)=>{&#xA;            ffmpeg.on(&#x27;error&#x27;, function (err: any) {&#xA;                reject(err);&#xA;            });&#xA;            &#xA;            ffmpeg.on(&#x27;close&#x27;, function (_code: any) {&#xA;                // [Parsed_replaygain_0 @ 0000000002a2b5c0] track_gain = &#x2B;6.53 dB&#xA;                if (!output.includes("track_gain")) {&#xA;                    reject(output);&#xA;&#xA;                    return;&#xA;                }&#xA;&#xA;                const gainWithDb = output.split("track_gain = ")[1];&#xA;                if (!gainWithDb) {&#xA;                    reject(output);&#xA;&#xA;                    return;&#xA;                }&#xA;&#xA;                const gain = gainWithDb.split(" dB")[0];&#xA;                if (!gain) {&#xA;                    reject(output);&#xA;&#xA;                    return;&#xA;                }&#xA;&#xA;                resolve(parseFloat(gain));&#xA;            });&#xA;            &#xA;            ffmpeg.stderr.on(&#x27;data&#x27;, function (data: any) {&#xA;                // ffmpeg sends all output to stderr. It is not a bug, it is a feature :)&#xA;                var tData = data.toString(&#x27;utf8&#x27;);&#xA;                output &#x2B;= tData;&#xA;            });&#xA;        });&#xA;    }&#xA;

    &#xA;

    Then after search in forums and Google, I improved (I hope I improved it with cleanups)

    &#xA;

    static getReplayGainVolume(audioData: Buffer): Promise<number> {&#xA;        return new Promise((resolve, reject) => {&#xA;            const FFMPEG_PATH = &#x27;ffmpeg&#x27;; // Adjust this if ffmpeg is not in system PATH&#xA;            const FFMPEG_TIMEOUT_MS = 30 * 1000; // 30 seconds timeout for FFmpeg execution&#xA;&#xA;            let ffmpeg: ChildProcessWithoutNullStreams;&#xA;            let output = &#x27;&#x27;; // Accumulate all stderr output&#xA;&#xA;            // Timeout for the FFmpeg process itself&#xA;            const ffmpegTimeout = setTimeout(() => {&#xA;                log.error(`[FFmpeg] FFmpeg process timed out after ${FFMPEG_TIMEOUT_MS / 1000} seconds. Killing process.`);&#xA;                if (ffmpeg &amp;&amp; !ffmpeg.killed) {&#xA;                    ffmpeg.kill(&#x27;SIGKILL&#x27;); // Force kill&#xA;                    reject(new Error(`FFmpeg process timed out and was killed.`));&#xA;                }&#xA;            }, FFMPEG_TIMEOUT_MS);&#xA;&#xA;            // --- Define cleanup function to be called on process exit/error ---&#xA;            const cleanup = (shouldReject = false, error?: Error | string) => {&#xA;                clearTimeout(ffmpegTimeout); // Ensure timeout is cleared&#xA;&#xA;                // Remove all listeners to prevent leaks&#xA;                // This is CRITICAL for long-running bots that spawn many child processes&#xA;                ffmpeg.stdin.removeAllListeners();&#xA;                ffmpeg.stdout.removeAllListeners();&#xA;                ffmpeg.stderr.removeAllListeners();&#xA;                ffmpeg.removeAllListeners(); // Remove process listeners&#xA;&#xA;                if (ffmpeg &amp;&amp; !ffmpeg.killed) { // Ensure ffmpeg process is killed if still alive&#xA;                    ffmpeg.kill(); // Graceful kill (SIGTERM), then wait for exit. If not, then SIGKILL.&#xA;                }&#xA;&#xA;                if (shouldReject) {&#xA;                    reject(error instanceof Error ? error : new Error(String(error)));&#xA;                }&#xA;            };&#xA;&#xA;            try {&#xA;                ffmpeg = spawn(FFMPEG_PATH, [&#xA;                    &#x27;-i&#x27;, &#x27;pipe:0&#x27;, // Read input from stdin (pipe:0)&#xA;                    &#x27;-af&#x27;, &#x27;replaygain&#x27;,&#xA;                    &#x27;-f&#x27;, &#x27;null&#x27;, &#x27;/dev/null&#x27;, // Write output to null device (discard audio output)&#xA;                    &#x27;-hide_banner&#x27;, &#x27;-nostats&#x27; // Suppress ffmpeg&#x27;s initial info and progress stats&#xA;                ], { stdio: [&#x27;pipe&#x27;, &#x27;pipe&#x27;, &#x27;pipe&#x27;] }); // Explicitly pipe stdin, stdout, stderr&#xA;&#xA;                // --- CRITICAL: Event Handlers for ffmpeg process ---&#xA;&#xA;                // 1. Handle errors during spawning or execution (e.g., ffmpeg not found)&#xA;                ffmpeg.on(&#x27;error&#x27;, (err: any) => {&#xA;                    log.error(`[FFmpeg] Failed to spawn or execute FFmpeg process:`, err);&#xA;                    cleanup(true, new Error(`FFmpeg process error: ${err.message}`));&#xA;                });&#xA;&#xA;                // 2. Accumulate stderr output (where replaygain results and ffmpeg errors are printed)&#xA;                ffmpeg.stderr.on(&#x27;data&#x27;, (data: Buffer) => {&#xA;                    output &#x2B;= data.toString(&#x27;utf8&#x27;);&#xA;                });&#xA;&#xA;                // 3. Handle process exit (success or failure)&#xA;                ffmpeg.on(&#x27;close&#x27;, (code: number) => { // &#x27;close&#x27; indicates process has exited&#xA;                    log.debug(`[FFmpeg] FFmpeg process exited with code: ${code}.`);&#xA;                    if (code !== 0) { // Non-zero exit code means failure&#xA;                        log.error(`[FFmpeg] FFmpeg process exited with non-zero code ${code}. Output:\n${output}`);&#xA;                        cleanup(true, new Error(`FFmpeg process failed with exit code ${code}. Output: ${output}`));&#xA;                        return;&#xA;                    }&#xA;&#xA;                    // If successful exit (code 0), parse the output&#xA;                    if (!output.includes("track_gain")) {&#xA;                        log.error(`[FFmpeg] &#x27;track_gain&#x27; not found in FFmpeg output (exit code 0). Output:\n${output}`);&#xA;                        cleanup(true, new Error(`&#x27;track_gain&#x27; not found in FFmpeg output. Output: ${output}`));&#xA;                        return;&#xA;                    }&#xA;&#xA;                    try {&#xA;                        // Regex to parse track_gain (e.g., "&#x2B;6.53 dB" or "-12.00 dB")&#xA;                        const gainMatch = output.match(/track_gain\s*=\s*([&#x2B;-]?\d&#x2B;\.?\d*)\s*dB/);&#xA;                        if (gainMatch &amp;&amp; gainMatch[1]) {&#xA;                            const gain = parseFloat(gainMatch[1]);&#xA;                            log.debug(`[FFmpeg] Replay gain volume: ${gain} dB.`);&#xA;                            cleanup(); // Clean up on success&#xA;                            resolve(gain);&#xA;                        } else {&#xA;                            log.error(`[FFmpeg] Failed to parse gain from FFmpeg output. Output:\n${output}`);&#xA;                            cleanup(true, new Error(`Failed to parse gain from FFmpeg output. Output: ${output}`));&#xA;                        }&#xA;                    } catch (parseError: any) {&#xA;                        log.error(`[FFmpeg] Error parsing FFmpeg replay gain output:`, parseError);&#xA;                        cleanup(true, new Error(`Error parsing FFmpeg output: ${parseError.message}. Output: ${output}`));&#xA;                    }&#xA;                });&#xA;&#xA;                // 4. Write audio data to ffmpeg&#x27;s stdin&#xA;                // This is the only write operation that could throw EPIPE in this function.&#xA;                try {&#xA;                    ffmpeg.stdin.write(audioData);&#xA;                    ffmpeg.stdin.end(); // Close stdin to signal end of input&#xA;                } catch (stdinError: any) {&#xA;                    log.error(`[FFmpeg] Error writing audioData to FFmpeg stdin:`, stdinError);&#xA;                    // This error means ffmpeg&#x27;s stdin pipe closed unexpectedly.&#xA;                    // This is the direct equivalent of an EPIPE (Broken Pipe) at the child process level.&#xA;                    cleanup(true, new Error(`Failed to pipe audio data to FFmpeg stdin: ${stdinError.message}`));&#xA;                }&#xA;&#xA;            } catch (spawnError: any) { // Catch errors from the spawn call itself (e.g., FFMPEG_PATH is invalid)&#xA;                log.error(`[FFmpeg] Error spawning FFmpeg:`, spawnError);&#xA;                cleanup(true, new Error(`Failed to spawn FFmpeg process: ${spawnError.message}`));&#xA;            }&#xA;        });&#xA;    }&#xA;</number>

    &#xA;

    But unfortunately I still get the same error. Has anyone encountered this problem ? How can I solve it ?

    &#xA;

    I use ffmpeg version 4.2.7-0ubuntu0.1

    &#xA;

    Thanks.

    &#xA;