Recherche avancée

Médias (0)

Mot : - Tags -/interaction

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (20)

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

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

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

Sur d’autres sites (4228)

  • SDL Audio - Plays only Static Noise

    19 août 2019, par bcpermafrost

    Im having an issue with playing audio.

    Im new to the SDL World of things so im learning from a tutorial.

    http://dranger.com/ffmpeg/tutorial03.html

    As far as audio goes, i have exactly what he put down and didnt get the result he says I should get. In the end of the lesson he specifies that the audio should play normally. However all i get is excessively loud static noise. This leads me to believe that the packets arent being read correctly. However I have no idea how to debug or look for the issue.

    Here is my main loop for parsing the packets :

    while (av_read_frame(pFormatCtx, &packet) >= 0) {

            if (packet.stream_index == videoStream) {
                avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);

                if (frameFinished){

                    AVPicture pict;

                    pict.data[0] = yPlane;
                    pict.data[1] = uPlane;
                    pict.data[2] = vPlane;
                    pict.linesize[0] = pCodecCtx->width;
                    pict.linesize[1] = uvPitch;
                    pict.linesize[2] = uvPitch;

                    sws_scale(sws_ctx,
                        pFrame->data, pFrame->linesize,
                        0, pCodecCtx->height,
                        pict.data, pict.linesize);

                    //SDL_UnlockTexture(bmp);

                    SDL_UpdateYUVTexture(bmp, 0,
                        yPlane, pCodecCtx->width,
                        uPlane, uvPitch,
                        vPlane, uvPitch);


                    SDL_RenderClear(renderer);
                    SDL_RenderCopy(renderer, bmp, NULL, NULL);
                    SDL_RenderPresent(renderer);


                    av_free_packet(&packet);


                }

            }
            else if (packet.stream_index == audioStream) {
                packet_queue_put(&audioq, &packet);

            }
            else
                av_free_packet(&packet);



            SDL_PollEvent(&event);

            switch (event.type) {
            case SDL_QUIT:
                quit = 1;
                SDL_DestroyTexture(bmp);
                SDL_DestroyRenderer(renderer);
                SDL_DestroyWindow(screen);
                SDL_Quit();
                exit(0);
                break;
            default:
                break;

            }

        }

    this is my initialization of the audio device :

    aCodecCtxOrig = pFormatCtx->streams[audioStream]->codec;
       aCodec = avcodec_find_decoder(aCodecCtxOrig->codec_id);
       if (!aCodec) {
           fprintf(stderr, "Unsupported codec!\n");
           return -1;
       }

       // Copy context
       aCodecCtx = avcodec_alloc_context3(aCodec);
       if (avcodec_copy_context(aCodecCtx, aCodecCtxOrig) != 0) {
           fprintf(stderr, "Couldn't copy codec context");
           return -1; // Error copying codec context
       }


       wanted_spec.freq = aCodecCtx->sample_rate;
       wanted_spec.format = AUDIO_U16SYS;
       wanted_spec.channels = aCodecCtx->channels;
       wanted_spec.silence = 0;
       wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;
       wanted_spec.callback = audio_callback;
       wanted_spec.userdata = aCodecCtx;


       if (SDL_OpenAudio( &wanted_spec, &spec) < 0) {
           fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError());
           return -1;
       }

       avcodec_open2(aCodecCtx, aCodec, NULL);

       // audio_st = pFormatCtx->streams[index]
       packet_queue_init(&audioq);
       SDL_PauseAudio(0);

    The Call back (same as the tutorial) :|

    void audio_callback(void *userdata, Uint8 *stream, int len) {

       AVCodecContext *aCodecCtx = (AVCodecContext *)userdata;
       int len1, audio_size;

       static uint8_t audio_buf[(MAX_AUDIO_FRAME_SIZE * 3) / 2];
       static unsigned int audio_buf_size = 0;
       static unsigned int audio_buf_index = 0;

       while (len > 0) {
           if (audio_buf_index >= audio_buf_size) {
               /* We have already sent all our data; get more */
               audio_size = audio_decode_frame(aCodecCtx, audio_buf, sizeof(audio_buf));
               if (audio_size < 0) {
                   /* If error, output silence */
                   audio_buf_size = 1024; // arbitrary?
                   memset(audio_buf, 0, audio_buf_size);
               }
               else {
                   audio_buf_size = audio_size;
               }
               audio_buf_index = 0;
           }
           len1 = audio_buf_size - audio_buf_index;
           if (len1 > len)
               len1 = len;
           memcpy(stream, (uint8_t *)audio_buf + audio_buf_index, len1);
           len -= len1;
           stream += len1;
           audio_buf_index += len1;
       }
    }
  • FFMPEG audio plays faster then video after conversion

    14 septembre 2019, par Yevhen Nalisnyi

    I have code which geting raw videos from one folder and adding intro and outro videos individually to each of them. There is only one issue. After convertion audio plays faster then video. What should I change or apply ?


    ffmpeg -i intro.mp4 -r 30 -c:v libx264 -c:a libmp3lame -crf 22 -preset ultrafast -c:a libmp3lame intro-converted.mp4
    ffmpeg -i outro.mp4 -r 30 -c:v libx264 -c:a libmp3lame -crf 22 -preset ultrafast -c:a libmp3lame outro-converted.mp4
    cd input
    for %%f in (*.mp4) do (
    echo %%f
    ffmpeg -i %%f -i ..\overlay.png -filter_complex "[1:v]scale=320:-1,format=rgba,colorchannelmixer=aa=1[fg];[0][fg]overlay=950:645:enable='between(t,0,240)'" -r 30 -pix_fmt yuv420p -c:v libx264 -preset ultrafast -crf 22  -c:a libmp3lame ..\temp-%%f
    echo file '..\intro-converted.mp4' > ..\list.txt
    echo file '..\temp-%%f' >> ..\list.txt
    echo file '..\outro-converted.mp4' >> ..\list.txt
    ffmpeg -f concat -safe 0 -i ..\list.txt -r 30 -pix_fmt yuv420p -c:v libx264 -preset ultrafast -crf 22  -c:a libmp3lame ..\output\%%f
    del ..\temp-%%f
    )
    cd ..
  • Timelimit plays for twice the duration [on hold]

    26 septembre 2019, par the_new_james

    I am using the following command to stream to a test an endpoint :

    ffmpeg -loglevel debug -f lavfi -re -i testsrc=size=hd720:rate=30
          -f lavfi -re -i anoisesrc
          -vf "drawtext=fontfile=\'/Library/Fonts/Arial.ttf\': text=\'Local time %{localtime\: %Y\/%m\/%d %H.%M.%S} (%{n})\': x=50: y=50: fontsize=48: fontcolor=white: box=1: boxcolor=0x00000099"
          -pix_fmt yuv420p -c:v libx264 -b:v 1000k -g 30 -profile:v baseline -preset veryfast
          -c:a libfdk_aac -b:a 96k -timelimit 60 -f flv $RTMP_OUTPUT/$NAME

    Because I’m adding this command to my automation, I would like to protect it from running indefinitely in case something goes wrong with my script (I start the ffmpeg job in a background process that is detached from the script). Therefore, I added the flag -timelimit 60, that, according to the documentation, the job should exit after duration seconds.

    I can see that the command is being parsed correctly

    Reading option '-timelimit' ... matched as option 'timelimit' (set max runtime in seconds) with argument '60'.
    ...
    Finished splitting the commandline.
    ...
    Applying option timelimit (set max runtime in seconds) with argument 60.
    ...

    Here’s an example output

    enter image description here

    The issue is that I noticed that the stream runs for longer than the specified time. After a couple of tests, I noticed that it is running for double the time, which got me thinking if it is taking the number of frames (assuming 2-second frames).

    Can someone clarify the timelimit option, please ? And the possible causes for running longer than specified.

    PS : I’m using ffmpeg version 4.1.4 on a MAC OS Mojave (10.14.6)