Recherche avancée

Médias (29)

Mot : - Tags -/Musique

Autres articles (62)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

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

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

Sur d’autres sites (9742)

  • ffmpeg ask for intsall

    12 juin 2015, par Ritesh Gupta

    I am trying to create an image/thumbnail from the video stored in local folder.
    Here is what I am doing is-

        Process p;
        ProcessStartInfo info = new ProcessStartInfo();
        info.FileName = Server.MapPath("~/FFMPEG/ffmpeg.exe");
        info.RedirectStandardOutput = false;
        info.CreateNoWindow = false;
        info.Arguments = " -i " + videopath  + " -vframes 1 " + imagepath + "%d.jpg";
        info.UseShellExecute = false;
        p = Process.Start(info);
       while (!p.HasExited) { Thread.Sleep(10); }

    When I execute above code a popup box comes to install ffmpeg.exe
    If I install the software, for the next time it asks again.

    Am I doing some mistake ?

  • WASAPI resampling

    30 juin 2013, par magingax

    I am trying to play 24bit/48000 Hz audio on PC. my PC seems not support 32bit sample (event GetMixFormat return 32bit/44100Hz device)
    So I'm trying to convert 24bit/4800Hz audio into 16bit/44100Hz
    but It sound like noise.
    sample audio file 'titan.wav' is 24bit/48000Hz s32 format
    below is sample code

    #define WINVER 0x0600
    #define _WIN32_WINNT 0x0600

    #include
    #include <iostream>
    #include "Mmdeviceapi.h"
    #include "Audioclient.h"
    #include "Endpointvolume.h"
    using namespace std;

    extern "C"
    {
    #include <libavformat></libavformat>avformat.h>
    #include <libavcodec></libavcodec>avcodec.h>
    #include <libswscale></libswscale>swscale.h>
    #include <libavutil></libavutil>opt.h>
    #include <libavutil></libavutil>channel_layout.h>
    #include <libavutil></libavutil>samplefmt.h>
    #include <libswresample></libswresample>swresample.h>
    }

    #define MAX_AUDIO_FRAME_SIZE    192000
    #define REFTIMES_PER_SEC      10000000  // 1 sec   100ns
    #define REFTIMES_PERMILLISEC     10000
    const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
    const IID   IID_IMMDeviceEnumerator  = __uuidof(IMMDeviceEnumerator);
    const IID   IID_IAudioClient         = __uuidof(IAudioClient);
    const IID   IID_IAudioRenderClient   = __uuidof(IAudioRenderClient);


    int alloc_samples_array_and_data(uint8_t*** data, int *linesize, int nb_channels,int nb_samples, enum AVSampleFormat sample_fmt, int align)
    {
       int nb_planes = av_sample_fmt_is_planar(sample_fmt) ? nb_channels : 1;
       *data = (uint8_t**)av_malloc(sizeof(*data) * nb_planes);
       return av_samples_alloc(*data, linesize, nb_channels,nb_samples, sample_fmt, align);
    }



    int main()
    {
       HRESULT hr;
       REFERENCE_TIME       buf_duration_request = REFTIMES_PER_SEC;
       REFERENCE_TIME       buf_duration_actual;
       IMMDeviceEnumerator  *pEnumerator      = NULL;
       IMMDevice            *pDevice          = NULL;
       IAudioClient         *pAudioClient     = NULL;
       IAudioRenderClient   *pRenderClient    = NULL;
       IAudioEndpointVolume *endpoint_vol     = NULL;
       WAVEFORMATEX         *fmt              = NULL;
       UINT32               frame_total       = 0;   // total frames in buffer
       UINT32               frame_avail       = 0;   // available frame number in buffer
       UINT32               frame_fill        = 0;   // filled frames
       BYTE                 *pData            = NULL;
       FILE                 *file_audio       = NULL;
       BYTE                 *buf              = NULL;
       DWORD                flags             = 0;


       CoInitializeEx(NULL,COINIT_MULTITHREADED);
       CoCreateInstance (CLSID_MMDeviceEnumerator,NULL,CLSCTX_ALL,IID_IMMDeviceEnumerator, (void**)&amp;pEnumerator);
       pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &amp;pDevice);
       pDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&amp;pAudioClient);
       pDevice->Activate(__uuidof(IAudioEndpointVolume),CLSCTX_ALL,NULL,(void**)&amp;endpoint_vol);
       pAudioClient->GetMixFormat((WAVEFORMATEX**)&amp;fmt);


       fmt->wFormatTag      = WAVE_FORMAT_PCM;
       fmt->nChannels       = 2 ;
       fmt->nSamplesPerSec  = 44100;
       fmt->wBitsPerSample  = 16;
       fmt->nBlockAlign     = fmt->nChannels * (fmt->wBitsPerSample/8);
       fmt->nAvgBytesPerSec = fmt->nSamplesPerSec * fmt->nBlockAlign;  
       fmt->cbSize          = 0;

       WAVEFORMATEX* closest_format = NULL;
       hr = pAudioClient->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, fmt ,&amp;closest_format);
       hr = pAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, NULL ,buf_duration_request,0, fmt ,NULL);
       hr = pAudioClient->GetBufferSize(&amp;frame_total);
       hr = pAudioClient->GetService(IID_IAudioRenderClient,(void**)&amp;pRenderClient);

       int file_size = 0;  
       int buf_size  = 44100 * 4;  
       int read_ret  = 0;
       int read_acc  = 0;

       fopen_s(&amp;file_audio,"E:\\MOVIE\\titan.wav","rb");
       fseek (file_audio , 0 , SEEK_END);
       file_size = ftell (file_audio);
       rewind (file_audio);
       buf  = (BYTE*) malloc(buf_size);

       pRenderClient->GetBuffer(frame_total,&amp;pData);
       read_ret  = fread(buf,1,buf_size,file_audio);
       read_acc += read_ret;
       memcpy(pData,buf,buf_size);
       pRenderClient->ReleaseBuffer(frame_total,flags);

       buf_duration_actual = (double) REFTIMES_PER_SEC * frame_total / fmt->nSamplesPerSec;
       pAudioClient->Start();


       //-- resample
       uint8_t** src_data;
       uint8_t** dst_data;
       int       src_bufsize        = 0;
       int       dst_bufsize        = 0;
       int       src_linesize       = 0;
       int       dst_linesize       = 0;
       int       src_nb_channels    = 0;
       int       dst_nb_channels    = 0;
       int       src_nb_samples     = 1024;
       int       dst_nb_samples     = 0;
       int       max_dst_nb_samples = 0;
       int       ret = 0;
       SwrContext* swr_ctx = NULL;
       swr_ctx = swr_alloc();
       av_opt_set_int        (swr_ctx,"in_channel_layout" , AV_CH_LAYOUT_MONO,   0);
       av_opt_set_int        (swr_ctx,"in_sample_rate"    , 48000,0);
       av_opt_set_sample_fmt (swr_ctx,"in_sample_fmt"     , AV_SAMPLE_FMT_S32,   0);
       av_opt_set_int        (swr_ctx,"out_channel_layout", AV_CH_LAYOUT_STEREO, 0);
       av_opt_set_int        (swr_ctx,"out_sample_rate"   , 44100,0);
       av_opt_set_sample_fmt (swr_ctx,"out_sample_fmt"    , AV_SAMPLE_FMT_S16, 0);
       ret = swr_init(swr_ctx);

       src_nb_channels    = av_get_channel_layout_nb_channels(AV_CH_LAYOUT_MONO);
       src_nb_samples     = src_nb_channels * 48000;
       dst_nb_samples     = av_rescale_rnd(src_nb_samples, 44100,48000,AV_ROUND_UP);
       max_dst_nb_samples = dst_nb_samples;
       alloc_samples_array_and_data(&amp;src_data,&amp;src_linesize,src_nb_channels,src_nb_samples, AV_SAMPLE_FMT_S32,0);  

       dst_nb_channels    = av_get_channel_layout_nb_channels(AV_CH_LAYOUT_STEREO);
       alloc_samples_array_and_data(&amp;dst_data,&amp;dst_linesize,dst_nb_channels,dst_nb_samples, AV_SAMPLE_FMT_S16,0);
       //-- end resample


       while (read_acc &lt; file_size)
       {
       Sleep(buf_duration_actual/REFTIMES_PERMILLISEC/2);          
           pAudioClient->GetCurrentPadding(&amp;frame_fill);
           frame_avail    = frame_total - frame_fill;
           dst_nb_samples = frame_avail;      
           src_nb_samples = av_rescale_rnd(dst_nb_samples,48000,44100,AV_ROUND_UP);
           src_bufsize    = av_samples_get_buffer_size(&amp;src_linesize,src_nb_channels,src_nb_samples,AV_SAMPLE_FMT_S32,1);

           cout&lt;&lt;"FILLED:"&lt;GetBuffer(frame_avail, &amp;pData );    
           read_ret    = fread(src_data[0],1,src_bufsize,file_audio);
           read_acc   += read_ret;
           ret         = swr_convert(swr_ctx,dst_data,dst_nb_samples,(const uint8_t**)src_data,src_nb_samples);
           dst_bufsize = av_samples_get_buffer_size(&amp;dst_linesize,dst_nb_channels,ret,AV_SAMPLE_FMT_S16,1);
           memcpy(pData, dst_data[0], dst_bufsize);        
           hr = pRenderClient->ReleaseBuffer(frame_avail,flags);                  

       }


       pAudioClient->Stop();
       CoTaskMemFree(fmt);
       pEnumerator->Release();
       pDevice->Release();
       pAudioClient->Release();
       pRenderClient->Release();
       CoUninitialize();

       return 0;
    }
    </iostream>
  • Error in ffmpeg when reading from UDP stream

    24 juillet 2013, par six6and1one

    I'm trying to process frames from a UDP stream using ffmpeg. Everything will run fine for a while but av_read_frame() will always eventually return either AVERROR_EXIT (Immeditate exit requested) or -5 (Error number -5 occurred) while the stream should still be running fine. Right before the error it always prints the following message to the console

    [mpeg2video @ 0caf6600] ac-tex damaged at 14 10
    [mpeg2video @ 0caf6600] Warning MVs not available
    [mpeg2video @ 0caf6600] concealing 800 DC, 800 AC, 800 MV errors in I frame

    (the numbers in the message vary from run to run)

    I have a suspicion that the error is related to calling av_read_frame too quickly. If I have it run as fast as possible, I usually get an error within 10-20 frames, but if I put a sleep before reading it will run fine for a minute or so and then exit with an error. I realize this is hacky and assume there is a better solution. Bottom line : is there a way to dynamically check if 'av_read_frame()' is ready to be called ? or a way to supress the error ?

    Psuedo code of what I'm doing below. Thanks in advance for the help !

    void getFrame()
    {
       //wait here?? seems hacky...
       //boost::this_thread::sleep(boost::posix_time::milliseconds(25));  

       int av_read_frame_error = av_read_frame(m_input_format_context, &amp;m_input_packet);          
       if(av_read_frame_error == 0){      
           //DO STUFF - this all works fine when it gets here
       }
       else{              
           //error
           char errorBuf[AV_ERROR_MAX_STRING_SIZE];
           av_make_error_string(errorBuf, AV_ERROR_MAX_STRING_SIZE, av_read_frame_error);
           cout &lt;&lt; "FFMPEG Input Stream Exit Code: " &lt;&lt; av_read_frame_error &lt;&lt; "   Message: " &lt;&lt; errorBuf &lt;&lt; endl;            
       }
    }