Recherche avancée

Médias (2)

Mot : - Tags -/media

Autres articles (53)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

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

Sur d’autres sites (7469)

  • How to make audio sound better ? (C + FFMpeg audio generation example)

    21 février 2017, par Rella

    So I found this great C FFMpeg official example which I simplified :

    #include
    #include
    #include

    #ifdef HAVE_AV_CONFIG_H
    #undef HAVE_AV_CONFIG_H
    #endif

    #include "libavcodec/avcodec.h"
    #include "libavutil/mathematics.h"

    #define INBUF_SIZE 4096
    #define AUDIO_INBUF_SIZE 20480
    #define AUDIO_REFILL_THRESH 4096

    /*
    * Audio encoding example
    */
    static void audio_encode_example(const char *filename)
    {
       AVCodec *codec;
       AVCodecContext *c= NULL;
       int frame_size, i, j, out_size, outbuf_size;
       FILE *f;
       short *samples;
       float t, tincr;
       uint8_t *outbuf;

       printf("Audio encoding\n");

       /* find the MP2 encoder */
       codec = avcodec_find_encoder(CODEC_ID_MP2);
       if (!codec) {
           fprintf(stderr, "codec not found\n");
           exit(1);
       }

       c= avcodec_alloc_context();

       /* put sample parameters */
       c->bit_rate = 64000;
       c->sample_rate = 44100;
       c->channels = 2;

       /* open it */
       if (avcodec_open(c, codec) < 0) {
           fprintf(stderr, "could not open codec\n");
           exit(1);
       }

       /* the codec gives us the frame size, in samples */
       frame_size = c->frame_size;
       samples = malloc(frame_size * 2 * c->channels);
       outbuf_size = 10000;
       outbuf = malloc(outbuf_size);

       f = fopen(filename, "wb");
       if (!f) {
           fprintf(stderr, "could not open %s\n", filename);
           exit(1);
       }

       /* encode a single tone sound */
       t = 0;
       tincr = 2 * M_PI * 440.0 / c->sample_rate;
       for(i=0;i<200;i++) {
           for(j=0;j* encode the samples */
           out_size = avcodec_encode_audio(c, outbuf, outbuf_size, samples);
           fwrite(outbuf, 1, out_size, f);
       }
       fclose(f);
       free(outbuf);
       free(samples);

       avcodec_close(c);
       av_free(c);
    }

    int main(int argc, char **argv)
    {

       /* must be called before using avcodec lib */
       avcodec_init();

       /* register all the codecs */
       avcodec_register_all();

       audio_encode_example("test.mp2");

       return 0;
    }

    How should it sound like ? May be I don’t get something but it sounds awful =( how to make audio generation sound better/ more interesting/ melodical in a wary shourt way (no special functions just how to change this code to make it sound better) ?

  • avcodec/proresenc_aw : use for frame flag in the header the same value than the offic...

    8 octobre 2018, par Martin Vignali
    avcodec/proresenc_aw : use for frame flag in the header the same value than the official encoder
    
    • [DH] libavcodec/proresenc_anatoliy.c
    • [DH] tests/ref/vsynth/vsynth1-prores
    • [DH] tests/ref/vsynth/vsynth2-prores
    • [DH] tests/ref/vsynth/vsynth3-prores
    • [DH] tests/ref/vsynth/vsynth_lena-prores
  • FFmpeg API example (encode_video.c) does not work correctly

    30 janvier 2023, par NewbieCoder

    I am using the official encode_video.c example to test if FFmpeg works correctly for me. 
I got the pre-built windows edition from ffmpeg.zeranoe.com/builds. It is built already with libx264 and other external libraries. I got both dev and shared editions and added the DLLs, header files and libs accordingly in Visual Studio.

    



    Now the encode_video.c example does not work correctly.

    



    



    What I tried :

    



    I compiled the example and run it on many different file formats and codecs such as the following.

    



    First I tried all of these file formats (.mp4, .m4v, .h264, .x264, .avi, .flv) with codec name as libx264. The code executed without errors but the output video file did not play in VLC or Windows 10 default player.

    



    Next, I tried all of those above file formats but with codec name as mpeg4. The code executed without errors but the output video file played only for .m4v in VLC.

    



    



    What is expected :

    



    All of those combinations should have produced a video file which could be played in VLC. None of them worked except for .m4v as file format and mpeg4 as codec name.

    



    



    Please tell me how to make this work for h264. I mainly want it to work for h264 as that is only important for now.

    



    I am running the code like ./encode_video.exe test.mp4 libx264 where first argument is output filename and second argument is codec name.

    



    This is the output for test.mp4 and libx264 as command line arguments https://imgur.com/a/AHLQwuK

    



    It seems that in the encode function, it goes over the below code and returns because of AVERROR(EAGAIN) or AVERROR_EOF. Please tell me what is happening.

    



    while (ret >= 0) {
        ret = avcodec_receive_packet(enc_ctx, pkt);
        if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
            return;
        else if (ret < 0) {
            fprintf(stderr, "Error during encoding\n");
            exit(1);
        }

        printf("Write packet %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
        fwrite(pkt->data, 1, pkt->size, outfile);
        av_packet_unref(pkt);
    }


    



    I used DepenciesGUI to find out the DLLs linked and it shows that the DLLs are correctly linked. Please help me figure out what the problem is now !!