Recherche avancée

Médias (91)

Autres articles (76)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (8638)

  • Android FFmpeg export of the Video in SurfaceView with Pinch/Scale/Zoom/Bg Color Operation

    31 mai 2024, par CoderDev

    I'm working on a feature in which I need to perform some actions on the selected video from the gallery and then upload it on the Backend server, on this selected video I can pinch it to scale up/down/zoom in/out and place it anywhere on the screen (even out side the screen), just like the Instagram app.
I can apply a background color which will be applied to the whole space of the outer of the video frame.

    


    After all the above changes I'm exporting the changes to the output video that will contain all the changes that I've mentioned above. I'm using the FFMpeg for the same :

    


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



    


    Basically the operation is being achieved with this solution (Except Export Video) : Android SurfaceView operation on Video to Pinch/Scale/Zoom/Bg Color

    


    I've tried numerous FFmpeg commands but not getting the adequate output, I've tried below solution :

    


        private fun exportVideo() {
        val outputVideoPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path + "/ffmpegoutput.mp4"
        val inputVideoPath = selectedFilePath
        val bgColor = getColorHexCode()

        // Load the input video dimensions
        val retriever = MediaMetadataRetriever()
        retriever.setDataSource(inputVideoPath)
        val videoWidth = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH)?.toInt() ?: 0
        val videoHeight = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT)?.toInt() ?: 0
        retriever.release()

        // Calculate the scaled dimensions
        val scaledWidth = (videoWidth * scaleFactor).toInt()
        val scaledHeight = (videoHeight * scaleFactor).toInt()

        // Calculate the new translation
        val translatedX = translationX.toInt()
        val translatedY = translationY.toInt()

         // Ensure the output dimensions are at least as large as the scaled dimensions
        val outputWidth = maxOf(deviceWidth, scaledWidth + abs(translatedX) * 2)
        val outputHeight = maxOf(deviceHeight, scaledHeight + abs(translatedY) * 2)

        // Calculate padding positions
        val xPad = (outputWidth - scaledWidth) / 2 + translatedX
        val yPad = (outputHeight - scaledHeight) / 2 + translatedY

        // Create the filter string for FFmpeg
        val filter = "scale=$scaledWidth:$scaledHeight," +
                "pad=$diagonal:$diagonal:(ow-iw)/2:(oh-ih)/2:$bgColor," +
                "pad=$outputWidth:$outputHeight:$xPad:$yPad:$bgColor"


        val command = ("-i $inputVideoPath " +
                "-vf $filter " +
                "-c:a copy " + // Copy the audio stream without re-encoding
                "-y $outputVideoPath"
                )

        // Execute FFMPEG command
        executeFFmpegKitCommand(command)
    }


    private fun executeFFmpegKitCommand(command: String) {
        FFmpegKit.executeAsync(command) { session ->
            println("FFMPEG executeAsync, session: $session")
            val returnCode = session.returnCode
            if (returnCode.isValueSuccess) {
                // Handle success
                runOnUiThread {
                    Toast.makeText(this, "Video saved successfully!", Toast.LENGTH_SHORT).show()
                }
            } else {
                // Handle failure
                runOnUiThread {
                    Toast.makeText(this, "Failed to save video", Toast.LENGTH_SHORT).show()
                }
            }
        }
    }


    


    But this not giving me the adequate output, it's not creating the output with the Screen's height/width (Tried passing the same), and the original video position is also not correct on the canvas which I've placed with the touch event.

    


  • NodeJS - efficiently and correctly convert from raw PCM to WAV at scale (without FFMPEG ?)

    13 juillet 2024, par Royi Bernthal

    I have a stream of raw PCM buffers I need to convert to playable WAV buffers.

    


    @ffmpeg.wasm can convert an individual buffer in the stream well, but it's limited to executing 1 command at a time, so it won't work in a real-life streaming scenario (streams x concurrent users). We can use it as a reference to a conversion that outputs a good playable wav.

    


    import { FFmpeg, createFFmpeg, fetchFile } from '@ffmpeg.wasm/main';

async pcmToWavFFMPEG(buffer: Buffer) {
    // bitDepth - PCM signed 16-bit little-endian
    const options = { sampleRate: '24k', channels: '1', bitDepth: 's16le' };

    this.ffmpeg.FS('writeFile', 'input.pcm', await fetchFile(buffer));

    await this.ffmpeg.run(
      '-f',
      options.bitDepth,
      '-ar',
      options.sampleRate,
      '-ac',
      options.channels,
      '-i',
      'input.pcm',
      'output.wav',
    );

    const wavBuffer = this.ffmpeg.FS('readFile', 'output.wav');

    this.ffmpeg.FS('unlink', `input.pcm`);
    this.ffmpeg.FS('unlink', `output.wav`);

    return Buffer.from(wavBuffer);
  }


    


    In order to get over the command execution limit, I've tried fluent-ffmpeg. I couldn't find a way to convert a single buffer, so I'm just passing the whole readable stream so that ffmpeg can convert all of its buffers to wav. The buffers I'm getting in on('data') aren't playable wav. The same is true for concatting the accumulated buffers in on('complete') - the result is not a playable wav.

    


    import ffmpeg from 'fluent-ffmpeg';
import internal from 'stream';

async pcmToWavFluentFFMPEG(
    readable: internal.Readable,
    callback: (chunk: Buffer) => void,
  ) {
    const options = { sampleRate: 24000, channels: 1, bitDepth: 's16le' };

    ffmpeg(readable)
      .inputFormat(options.bitDepth)
      .audioFrequency(options.sampleRate)
      .audioChannels(options.channels)
      .outputFormat('wav')
      .pipe()
      .on('data', callback);
  }


    


    I've also tried using node-wav to convert each buffer individually. It manages to convert everything to playable wavs that sound close to the desired result, however for some reason they're extremely loud and sound a bit weird.

    


    import wav from 'node-wav';

pcmToWavBad(buffer: Buffer) {
    const pcmData = new Int16Array(
      buffer.buffer,
      buffer.byteOffset,
      buffer.byteLength / Int16Array.BYTES_PER_ELEMENT,
    );

    const channelData = [pcmData]; // assuming mono channel

    return wav.encode(channelData, { sampleRate: 24000, bitDepth: 16 });
  }


    


    I've also tried wrapping the PCM as a WAV with wavefile without any actual conversion (which is redundant as PCM is contained as is in WAV), but it results in white noise :

    


    import { WaveFile } from 'wavefile';

pcmToWav(buffer: Buffer) {
    const wav = new WaveFile();

    wav.fromScratch(1, 24000, '16', buffer); // 's16le' is invalid

    return Buffer.from(wav.toBuffer());
  }


    


  • fate/vcodec : add missing scale filter dependency to ffv1-2pass10 vsynth tests

    29 septembre 2024, par James Almer
    fate/vcodec : add missing scale filter dependency to ffv1-2pass10 vsynth tests
    

    Also, add sws_flags matching other similar tests while at it.

    Signed-off-by : James Almer <jamrial@gmail.com>

    • [DH] tests/fate/vcodec.mak
    • [DH] tests/ref/vsynth/vsynth1-ffv1-2pass10
    • [DH] tests/ref/vsynth/vsynth2-ffv1-2pass10
    • [DH] tests/ref/vsynth/vsynth3-ffv1-2pass10
    • [DH] tests/ref/vsynth/vsynth_lena-ffv1-2pass10