Recherche avancée

Médias (91)

Autres articles (63)

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

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

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (9485)

  • Could you please guide me on how to play a single sample of an audio file in C# using FFmpeg ?

    11 juillet 2023, par hello world

    What is the recommended approach for playing a single sample of an audio file in C# using FFmpeg ? I would like to incorporate FFmpeg into my C# application to play a specific sample from an audio file. Could someone provide an example or guide me on how to achieve this ? Any help would be appreciated.

    


    using System;
using System.Diagnostics;

public class AudioPlayer
{
    private string ffmpegPath;

    public AudioPlayer(string ffmpegPath)
    {
        this.ffmpegPath = ffmpegPath;
    }

    public void PlayAudioSample(string audioFilePath, TimeSpan samplePosition)
    {
        // Prepare FFmpeg process
        Process ffmpegProcess = new Process();
        ffmpegProcess.StartInfo.FileName = ffmpegPath;
        ffmpegProcess.StartInfo.Arguments = $"-ss {samplePosition} -i \"{audioFilePath}\" -t 1 -acodec pcm_s16le -f wav -";
        ffmpegProcess.StartInfo.RedirectStandardOutput = true;
        ffmpegProcess.StartInfo.RedirectStandardError = true;
        ffmpegProcess.StartInfo.UseShellExecute = false;
        ffmpegProcess.StartInfo.CreateNoWindow = true;

        // Start FFmpeg process
        ffmpegProcess.Start();

        // Play audio sample
        using (var audioOutput = new NAudio.Wave.WaveOutEvent())
        {
            using (var audioStream = new NAudio.Wave.RawSourceWaveStream(ffmpegProcess.StandardOutput.BaseStream, new NAudio.Wave.WaveFormat(44100, 16, 2)))
            {
                audioOutput.Init(audioStream);
                audioOutput.Play();
                while (audioOutput.PlaybackState == NAudio.Wave.PlaybackState.Playing)
                {
                    System.Threading.Thread.Sleep(100);
                }
            }
        }

        // Wait for FFmpeg process to exit
        ffmpegProcess.WaitForExit();
    }
}


    


  • How to Play AVI file in a Loop

    10 octobre 2019, par sam

    I am using ffMpeg to play AVI file.

    This is my code where i am reading the frame..

    i define my structure

    typedef struct {

       AVFormatContext *fmt_ctx;
       int stream_idx;
       AVStream *video_stream;
       AVCodecContext *codec_ctx;
       AVCodec *decoder;
       AVPacket *packet;
       AVFrame *av_frame;
       AVFrame *gl_frame;
       struct SwsContext *conv_ctx;
       GLuint frame_tex;
    }AppData;

    This is how i read frame.

    bool readFrame(AppData *data)
    {
       do {
           if (av_read_frame(data->fmt_ctx, data->packet) < 0) {
               av_free_packet(data->packet);
               return false;
           }

           if (data->packet->stream_index == data->stream_idx)
           {
               int frame_finished = 0;

               if (avcodec_decode_video2(data->codec_ctx, data->av_frame, &frame_finished,
                   data->packet) < 0) {
                   av_free_packet(data->packet);
                   return false;
               }

               if (frame_finished)
               {
                   if (!data->conv_ctx)
                   {
                       data->conv_ctx = sws_getContext(data->codec_ctx->width,
                           data->codec_ctx->height, data->codec_ctx->pix_fmt,
                           data->codec_ctx->width, data->codec_ctx->height, AV_PIX_FMT_RGBA,
                           SWS_BICUBIC, NULL, NULL, NULL);
                   }

                   sws_scale(data->conv_ctx, data->av_frame->data, data->av_frame->linesize, 0,
                       data->codec_ctx->height, data->gl_frame->data, data->gl_frame->linesize);

                   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, data->codec_ctx->width,
                       data->codec_ctx->height, GL_RGBA, GL_UNSIGNED_BYTE,
                       data->gl_frame->data[0]);

               }

           }
           av_free_packet(data->packet);

       } while (data->packet->stream_index != data->stream_idx);

       return true;

    }
    1. Currently the video plays and stops at the last frame, how can I reset the frame number to start frame once the whole video is played.
    2. How can I play the video by passing the frame number instead of automatic loop ?
  • Save video from rtsp and play in exoplayer simultaneously [closed]

    25 janvier 2024, par Julian Peña Gallego

    I am trying to receive a live stream via RTSP from an IP camera in Android Kotlin, I am recording the video to a local file with ffmpegkit but I must additionally view the live stream.

    


    When I record the live stream with ffmpeg without playing the stream through exoplayer it works fine, but when both processes are running there is packet loss in the video recording or in the exoplayer.

    


    Then I tried to get exoplayer to play the video that ffmpeg was recording, but it gave me an error since the file has not been closed yet.

    


    Could you provide me with a solution ? I have found on the internet that it is possible with server sockets but they do not indicate how to do it.