Recherche avancée

Médias (91)

Autres articles (61)

  • 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 ;

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

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

  • Problems encoding to .MP4 using ffmpeg

    30 novembre 2013, par Erik Swansson

    So I'm kind of new to this, I'm writing a WIN32 app that records video to .AVI, then I planned to use ffmpeg to encode to .MP4. Based on a sample I found, I got this far. It compiles and says that it encoded and wrote the file but the output file can't be opened and played. I tried using MPEG1 encoding like the original sample was using but it only gives me weird colors for a few seconds.

    Am I missing something that should be done with the file ?

    Anyone with experience in encoding/ffmpeg, some pointers, advice or help would make me outmost grateful. Thanks in advance !

    int _tmain(int argc, _TCHAR* argv[])
    {

       AVFormatContext *pFormatCtx;
       int codec_id = CODEC_ID_MPEG4;
       char filename [] ="C:\\wav\\test2.flv";
    // Open video file
        AVCodec *codec;
        AVCodecContext *c= NULL;
        int i, out_size, x, y, outbuf_size;
       FILE *f;
        AVFrame *picture;
       uint8_t *outbuf;
        int had_output=0;

       av_register_all();
      printf("Encode video file %s\n", filename);

       codec = avcodec_find_encoder(CODEC_ID_H264);
       if (!codec) {
            fprintf(stderr, "codec not found\n");
           exit(1);
       }

       c = avcodec_alloc_context3(codec);
       picture= avcodec_alloc_frame();

      /* put sample parameters */
      c->bit_rate = 40000;
      //c->bit_rate_tolerance=30;
        /* resolution must be a multiple of two */
       c->width = 352;
       c->height = 288;
       /* frames per second */

       c->time_base.den=  25;
       c->time_base.num= 1;
        c->gop_size = 10; /* emit one intra frame every ten frames */
      c->max_b_frames=1;
        c->pix_fmt = PIX_FMT_YUV420P;

       if(codec_id == CODEC_ID_H264)
           av_opt_set(c->priv_data, "preset", "slow", 0);
    /* open it */
       if (avcodec_open2(c, codec, NULL) < 0) {
           fprintf(stderr, "could not open codec\n");
          exit(1);
       }


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

       /* alloc image and output buffer */
       outbuf_size = 100000 + 12*c->width*c->height;
        outbuf = (uint8_t*)malloc(outbuf_size); //CHANGED

        /* the image can be allocated by any means and av_image_alloc() is
         * just the most convenient way if av_malloc() is to be used */
       av_image_alloc(picture->data, picture->linesize,
                      c->width, c->height, c->pix_fmt, 1);

        /* encode 1 second of video */
        for(i=0;i<25;i++) {
            fflush(stdout);
            /* prepare a dummy image */
           /* Y */
            for(y=0;yheight;y++) {
               for(x=0;xwidth;x++) {
                   picture->data[0][y * picture->linesize[0] + x] = x + y + i * 3;
               }
            }

           /* Cb and Cr */
           for(y=0;yheight/2;y++) {
               for(x=0;xwidth/2;x++) {
                   picture->data[1][y * picture->linesize[1] + x] = 128 + y + i * 2;
                   picture->data[2][y * picture->linesize[2] + x] = 64 + x + i * 5;
               }
           }

            /* encode the image */
           out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
            had_output |= out_size;
           printf("encoding frame %3d (size=%5d)\n", i, out_size);
           fwrite(outbuf, 1, out_size, f);
        }

        /* get the delayed frames */
        for(; out_size || !had_output; i++) {
            fflush(stdout);

           out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
           had_output |= out_size;
            printf("write frame %3d (size=%5d)\n", i, out_size);
          fwrite(outbuf, 1, out_size, f);
        }

        /* add sequence end code to have a real mpeg file */
        outbuf[0] = 0x00;
        outbuf[1] = 0x00;
        outbuf[2] = 0x01;
      outbuf[3] = 0xb7;
        fwrite(outbuf, 1, 4, f);
        fclose(f);
           fclose(p);
       free(outbuf);

        avcodec_close(c);
        av_free(c);
        av_free(picture->data[0]);
       av_free(picture);
        printf("\n");

       return 0;
    }
  • FFmpeg build error pkg-config can't find x265 /usr/bin/ld : cannot find -lnuma : No such file or directory

    1er janvier 2023, par slyfox1186

    I am trying to build ffmpeg with custom libraries from source code.

    


    Every package in my script builds as it should but when it gets time to run the ffmpeg build using all of the packages it fails with a weird error code shown at the bottom of the ffmpeg build log.

    


    BEGIN /home/jman/tmp/ffconf.JouXp6kg/test.c
    1   #include 
    2   #include 
    3   long check_x265_api_get(void) { return (long) x265_api_get; }
    4   int main(void) { int ret = 0;
    5    ret |= ((intptr_t)check_x265_api_get) & 0xFFFF;
    6   return ret; }
END /home/jman/tmp/ffconf.JouXp6kg/test.c
gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -I/home/jman/Documents/ffmpeg-build/workspace/include -I/home/jman/Documents/ffmpeg-build/workspace/include/lilv-0 -I/usr/local/cuda/include -std=c11 -fomit-frame-pointer -fPIC -I/home/jman/Documents/ffmpeg-build/workspace/include -pthread -DLILV_STATIC -DSRATOM_STATIC -DSORD_STATIC -DSERD_STATIC -I/home/jman/Documents/ffmpeg-build/workspace/include/lilv-0 -I/home/jman/Documents/ffmpeg-build/workspace/include/sratom-0 -I/home/jman/Documents/ffmpeg-build/workspace/include -I/home/jman/Documents/ffmpeg-build/workspace/include/sord-0 -I/home/jman/Documents/ffmpeg-build/workspace/include/serd-0 -I/home/jman/Documents/ffmpeg-build/workspace/include -I/home/jman/Documents/ffmpeg-build/workspace/include/opus -I/home/jman/Documents/ffmpeg-build/workspace/include/opus -I/home/jman/Documents/ffmpeg-build/workspace/include -I/home/jman/Documents/ffmpeg-build/workspace/include/srt -I/home/jman/Documents/ffmpeg-build/workspace/include/svt-av1 -I/home/jman/Documents/ffmpeg-build/workspace/include -I/home/jman/Documents/ffmpeg-build/workspace/include -I/home/jman/Documents/ffmpeg-build/workspace/include -I/home/jman/Documents/ffmpeg-build/workspace/include -I/home/jman/Documents/ffmpeg-build/workspace/include -I/home/jman/Documents/ffmpeg-build/workspace/include -I/home/jman/Documents/ffmpeg-build/workspace/include -I/home/jman/Documents/ffmpeg-build/workspace/include -L/usr/lib/x86_64-linux-gnu -c -o /home/jman/tmp/ffconf.JouXp6kg/test.o /home/jman/tmp/ffconf.JouXp6kg/test.c
gcc -L/home/jman/Documents/ffmpeg-build/workspace/lib -L/usr/local/cuda/lib64 -Wl,--as-needed -Wl,-z,noexecstack -L/usr/lib/x86_64-linux-gnu -o /home/jman/tmp/ffconf.JouXp6kg/test /home/jman/tmp/ffconf.JouXp6kg/test.o -lx265 -lstdc++ -lm -lgcc_s -lgcc -lgcc_s -lgcc -lrt -ldl -lnuma -ldl -lpthread -lm -lz
/usr/bin/ld: cannot find -lnuma: No such file or directory
collect2: error: ld returned 1 exit status
ERROR: x265 not found using pkg-config


    


    Does anyone know what this -lnuma is referring to ?

    


    I had no issues just a few days ago when I last ran my build script and then all of a sudden this issue appeared.

    


    This is my build script in its entirety : FFmpeg-build.sh

    


    Update : Per Allan Winds' instructions here is the output of :

    


    find /usr/lib -name libnuma\* -ls

    


      4987897     48 -rw-r--r--   1 root     root        48152 Mar 24  2022 /usr/lib/x86_64-linux-gnu/libnuma.so.1.0.0
  4992286     76 -rw-r--r--   1 root     root        77086 Mar 24  2022 /usr/lib/x86_64-linux-gnu/libnuma.a
  4987896      0 lrwxrwxrwx   1 root     root           16 Dec 29 12:03 /usr/lib/x86_64-linux-gnu/libnuma.so.1 -> libnuma.so.1.0.0
  4992287      0 lrwxrwxrwx   1 root     root           16 Mar 24  2022 /usr/lib/x86_64-linux-gnu/libnuma.so -> libnuma.so.1.0.0


    


  • Creating a shared library that statically includes ffmpeg

    10 octobre 2017, par El Sampsa

    I’m having hard time trying to create a shared library that has ffmpeg libraries "baked in" as static ones.

    Consider the following directory schema :

    include/
     my own .h files
     ext/
       ffmpeg .h files
    lib/
     libav*.a archive files (softlinks to the actual .a files)
     libValkka.so (my shared library)
    test/
     mytest.cpp
    bin/
     (binaries appear here)

    I’ve come a long way (see Including objects to a shared library from a C++ archive (.a) ) and the library compiles ok with this : ([STUFF] has been omitted for brevity)

    /usr/bin/c++ -fPIC -std=c++14 -pthread -Iinclude/ext -I/usr/include/libdrm -g -shared -Wl,-soname,libValkka.so -o lib/libValkka.so CMakeFiles/Valkka.dir/src/avthread.cpp.o CMakeFiles/Valkka.dir/src/opengl.cpp.o CMakeFiles/Valkka.dir/src/openglthread.cpp.o [STUFF] CMakeFiles/Valkka.dir/src/filters.cpp.o -lX11 -lGLEW -lGLU -lGL -Wl,—allow-multiple-definition -Wl,-Bsymbolic -Wl,—whole-archive -Wreorder lib/libavdevice.a lib/libavfilter.a lib/libavformat.a lib/libavcodec.a lib/libavutil.a lib/libswscale.a lib/libswresample.a -Wl,—no-whole-archive

    However, when creating executables - their source code does not use any ffmpeg api (just my own api) - with :

    c++ -std=c++14 -pthread -Iinclude -Iinclude/ext -Llib test/mytest.cpp -lValkka -g -o bin/mytest

    I get a hoard of errors about missing ffmpeg dependencies. Not everything is missing, just some weird stuff :

    lib/libValkka.so: undefined reference to `pa_stream_get_index'
    lib/libValkka.so: undefined reference to `deflateInit_'
    lib/libValkka.so: undefined reference to `pa_stream_get_state'
    lib/libValkka.so: undefined reference to `lzma_stream_decoder'
    lib/libValkka.so: undefined reference to `BZ2_bzDecompress'
    lib/libValkka.so: undefined reference to `vaInitialize'
    lib/libValkka.so: undefined reference to `pa_stream_unref'
    lib/libValkka.so: undefined reference to `deflateInit2_'
    lib/libValkka.so: undefined reference to `snd_pcm_close'
    ...
    lib/libValkka.so: undefined reference to `vaGetDisplayDRM'
    lib/libValkka.so: undefined reference to `vaMaxNumEntrypoints'
    lib/libValkka.so: undefined reference to `uncompress'
    lib/libValkka.so: undefined reference to `pa_stream_drop'
    lib/libValkka.so: undefined reference to `pa_context_connect'
    lib/libValkka.so: undefined reference to `FT_Get_Kerning'
    lib/libValkka.so: undefined reference to `ass_free_track'
    lib/libValkka.so: undefined reference to `pa_operation_unref'
    lib/libValkka.so: undefined reference to `FT_Stroker_Done'
    lib/libValkka.so: undefined reference to `vaTerminate'
    lib/libValkka.so: undefined reference to `ass_new_track'
    lib/libValkka.so: undefined reference to `jack_client_close'
    ...
    lib/libValkka.so: undefined reference to `xcb_xfixes_query_version'
    lib/libValkka.so: undefined reference to `xcb_shape_rectangles'
    lib/libValkka.so: undefined reference to `pa_mainloop_free'
    lib/libValkka.so: undefined reference to `snd_device_name_hint'
    lib/libValkka.so: undefined reference to `vaCreateImage'
    lib/libValkka.so: undefined reference to `vaBeginPicture'
    lib/libValkka.so: undefined reference to `DtsSetColorSpace'
    lib/libValkka.so: undefined reference to `vaDestroyConfig'
    lib/libValkka.so: undefined reference to `pa_stream_writable_size'
    lib/libValkka.so: undefined reference to `snd_pcm_hw_params_get_buffer_size_max'
    lib/libValkka.so: undefined reference to `ass_read_file'

    This is pretty frustrating, especially when I can see that those names are included in the shared library..!

    nm lib/libValkka.so | grep "vaBeginPicture"

    gives

    U vaBeginPicture

    etc. I thought it might be a problem regarding the dependency order the archive .a files, and also tried with :

    ..... -Wl,—allow-multiple-definition -Wl,-Bsymbolic -Wl,—start-group -Wl,—whole-archive -Wreorder lib/libavdevice.a lib/libavfilter.a lib/libavformat.a lib/libavcodec.a lib/libavutil.a lib/libswscale.a lib/libswresample.a -Wl,—no-whole-archive -Wl,—end-group

    But the problem persists.

    I have succesfully created a shared library that does not "bake in" those .a archives, i.e. that just depends dynamically on ffmpeg libraries, and there are no such problems.

    I am baffled.. Have I misunderstood something fundamental, forgot some annoying linked option, or both ? Help appreciated !