Recherche avancée

Médias (91)

Autres articles (79)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • MediaSPIP Player : problèmes potentiels

    22 février 2011, par

    Le lecteur ne fonctionne pas sur Internet Explorer
    Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
    Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)

  • MediaSPIP Player : les contrôles

    26 mai 2010, par

    Les contrôles à la souris du lecteur
    En plus des actions au click sur les boutons visibles de l’interface du lecteur, il est également possible d’effectuer d’autres actions grâce à la souris : Click : en cliquant sur la vidéo ou sur le logo du son, celui ci se mettra en lecture ou en pause en fonction de son état actuel ; Molette (roulement) : en plaçant la souris sur l’espace utilisé par le média (hover), la molette de la souris n’exerce plus l’effet habituel de scroll de la page, mais diminue ou (...)

Sur d’autres sites (7126)

  • Remove audio from specific audio track

    9 août 2024, par Ronaldo Júdice

    I have this code, and i would like to remove audio from tracks 5 and 6. I had tried everything but is not working, I can mute the audio tracks but on edition program i can see the waves, can you help me ?

    


    if (conv.format === 'mxf') {
        // Add 8 audio tracks
        ffmpeg(inputFile)
            .audioCodec('pcm_s16le') // Codec de áudio para MXF
            .outputOptions([
                '-c:v mpeg2video', // Codec de vídeo para MXF
                '-q:v 2', // Qa  vídeo
                '-map 0:v:0', 
                '-map 0:a:0', 
                '-map 0:a:0',
                '-map 0:a:0', 
                '-map 0:a:0', 
                '-map 0:a:0', // this track i want to remove the audio but keep the track
                '-map 0:a:0', //this track i want to remove the audio but keep the track
                '-map 0:a:0', 
                '-map 0:a:0', 
                '-disposition:a:0 default' // Marcar trilha 1 como padrão
            ])
            .save(outputFile)
            .on('start', commandLine => console.log(`FFmpeg comando iniciado: ${commandLine}`))
            .on('progress', progress => console.log(`Progresso: ${progress.percent}%`))
            .on('end', () => console.log(`Conversão concluída: ${outputFile}`))
            .on('error', err => console.error(`Erro na conversão de ${inputFile} para ${outputFile}: ${err.message}`));
    } else {
        // Outras conversões
        ffmpeg(inputFile)
            .outputOptions(conv.options)
            .save(outputFile)
            .on('start', commandLine => console.log(`FFmpeg comando iniciado: ${commandLine}`))
            .on('progress', progress => console.log(`Progresso: ${progress.percent}%`))
            .on('end', () => console.log(`Conversão concluída: ${outputFile}`))
            .on('error', err => console.error(`Erro na conversão de ${inputFile} para ${outputFile}: ${err.message}`));
    }


    


    I tried to use ffmpeg comands to remove audio from track.

    


  • How to write silent audio data to an audio stream ?

    14 juin 2019, par LeFrosch

    I am writing some images to an AVStream and after that I am reading an mp3 file and writing it to an diffrent AVStream. The propblem is that the audio stream is a bit shorter then the video stream, so if I add more images and another audio file the audio is not in sync with the video any more. So my idear was to write silent audio data to the audio stream before I write another audio file to the audio stream. But I can not figure out how to write the silent data to the audio stream.

    I found this post but I don’t know how to calculate the packet size or how to write the packet to the audio stream.

    This was my most "successfully" approach so far, but the result (audioTest(0xff).mp4) is far from silent.

       /* set up the audio convert context */
       libffmpeg::SwrContext* audioConvertContext = libffmpeg::swr_alloc();
       libffmpeg::av_opt_set_int(audioConvertContext, "in_channel_count", data->audioCodecContext->channels, 0);
       libffmpeg::av_opt_set_int(audioConvertContext, "out_channel_count", data->audioCodecContext->channels, 0);
       libffmpeg::av_opt_set_int(audioConvertContext, "in_channel_layout", data->audioCodecContext->channel_layout, 0);
       libffmpeg::av_opt_set_int(audioConvertContext, "out_channel_layout", data->audioCodecContext->channel_layout, 0);
       libffmpeg::av_opt_set_int(audioConvertContext, "in_sample_rate", data->audioCodecContext->sample_rate, 0);
       libffmpeg::av_opt_set_int(audioConvertContext, "out_sample_rate", data->audioCodecContext->sample_rate, 0);
       libffmpeg::av_opt_set_sample_fmt(audioConvertContext, "in_sample_fmt", libffmpeg::AV_SAMPLE_FMT_S16, 0);
       libffmpeg::av_opt_set_sample_fmt(audioConvertContext, "out_sample_fmt", data->audioCodecContext->sample_fmt, 0);
       int ret = libffmpeg::swr_init(audioConvertContext);
       if (ret < 0)
       {
           Helper::ThrowError("Failed to allocate audio reformat context.", ret);
       }

       /* set up silent frame */
       libffmpeg::AVFrame* silentFrame = libffmpeg::av_frame_alloc();
       if (!silentFrame)
       {
           Helper::ThrowError("Failed to allocate audio encode frame.");
       }

       silentFrame->nb_samples = data->audioCodecContext->frame_size;
       silentFrame->format = data->audioCodecContext->sample_fmt;
       silentFrame->channel_layout = data->audioCodecContext->channel_layout;
       silentFrame->channels = data->audioCodecContext->channels;
       silentFrame->sample_rate = data->audioCodecContext->sample_rate;

       /* alloc the frame buffer */
       ret = libffmpeg::av_frame_get_buffer(silentFrame, 0);
       if (ret < 0)
       {
           Helper::ThrowError("Could not allocate audio data buffers.");
       }

       int got_output;
       int samples_count;
       double duration = 4 * (double)data->audioStream->time_base.den / (double)data->audioStream->time_base.num;
       while (av_stream_get_end_pts(data->audioStream) < duration)
       {
           libffmpeg::AVPacket pkt;
           libffmpeg::av_init_packet(&pkt);

           ret = libffmpeg::av_frame_make_writable(silentFrame);
           if (ret < 0)
           {
               Helper::ThrowError("Could not make frame writable.");
           }

           for (int j = 0; j < data->audioCodecContext->frame_size; j++)
           {
               silentFrame->data[0][2 * j] = 0xff;

               for (int k = 1; k < data->audioCodecContext->channels; k++)
               {
                   silentFrame->data[0][2 * j + k] = silentFrame->data[0][2 * j];
               }
           }

           int dst_nb_samples = libffmpeg::av_rescale_rnd(
               libffmpeg::swr_get_delay(audioConvertContext, data->audioCodecContext->sample_rate) + silentFrame->nb_samples,
               data->audioCodecContext->sample_rate, data->audioCodecContext->sample_rate,
               libffmpeg::AV_ROUND_UP);

           ret = libffmpeg::swr_convert(
               audioConvertContext,
               silentFrame->data, dst_nb_samples,
               (const libffmpeg::uint8_t * *) & silentFrame->data,
               silentFrame->nb_samples);

           if (ret < 0)
           {
               Helper::ThrowError("Error while converting audio frame.", ret);
           }

           silentFrame->pts = libffmpeg::av_rescale_q(samples_count, libffmpeg::AVRational{ 1, data->audioCodecContext->sample_rate }, data->audioCodecContext->time_base);
           samples_count += dst_nb_samples;

           ret = libffmpeg::avcodec_encode_audio2(data->audioCodecContext, &pkt, silentFrame, &got_output);
           if (ret < 0)
           {
               Helper::ThrowError("Error while encoding audio frame.", ret);
           }

           if (got_output)
           {
               pkt.stream_index = data->audioStream->index;

               if (ret = av_write_frame(data->formatContext, &pkt))
               {
                   Helper::ThrowError("Error while writing audio frame.", ret);
               }

               libffmpeg::av_packet_unref(&pkt);
           }
       }

       libffmpeg::av_frame_free(&silentFrame);
  • ffmpeg - Video longer than audio after having combined image and audio to video

    21 octobre 2017, par Grant SYNKOP

    I wrote code to combine several audio files with 1 image, into WebM video. (audio1 combined with default jpg, audio2 combined with default jpg, etc).

    The problem is that after this, video length is 25 seconds superior to audio length (so audio cuts 25 seconds before the end of the video).

    Is there a way to stop the video at the exact same time of the audio ? Here is the code I used (I launch a BAT command file)

    @echo off  
    for %%F in (*.ogg) do (  
     ffmpeg -loop 1 -framerate 1 -i "default.jpg" -i "%%F" -acodec libopus -b:a 384k -vcodec libvpx-vp9 -lossless 1 -speed 4 -vf scale=1280x720 -shortest "%%F.webm"
    )