Recherche avancée

Médias (1)

Mot : - Tags -/censure

Autres articles (47)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

Sur d’autres sites (9678)

  • Statically built FFMPEG binary segmentation fault

    12 février 2020, par stevendesu

    I want to create a custom build of FFMPEG which rips out everything except for the ability to transmux HLS videos to MP4, and I need this build to be 100% static with no external dependencies

    I tried using the following configuration :

    ./configure \
       --extra-cflags='-static -static-libstdc++ -static-libgcc' \
       --extra-cxxflags='-static -static-libstdc++ -static-libgcc' \
       --extra-ldflags='-static -static-libstdc++ -static-libgcc' \
       --pkg-config-flags='--static' \
       --enable-static \
       --disable-shared \
       --disable-runtime-cpudetect \
       --disable-autodetect \
       --disable-ffplay \
       --disable-ffprobe \
       --disable-doc \
       --disable-avdevice \
       --disable-swresample \
       --disable-swscale \
       --disable-postproc \
       --disable-pthreads \
       --disable-w32threads \
       --disable-os2threads \
       --enable-network \
       --disable-dct \
       --disable-dwt \
       --disable-error-resilience \
       --disable-lsp \
       --disable-lzo \
       --disable-mdct \
       --disable-rdft \
       --disable-fft \
       --disable-faan \
       --disable-pixelutils \
       --disable-encoders \
       --disable-decoders \
       --disable-hwaccels \
       --disable-muxers \
       --enable-muxer=mov \
       --enable-muxer=mp4 \
       --disable-demuxers \
       --enable-demuxer=hls \
       --enable-demuxer=mpegts \
       --enable-demuxer=h264 \
       --enable-demuxer=aac \
       --disable-parsers \
       --enable-parser=h264 \
       --enable-parser=aac \
       --disable-bsfs \
       --disable-protocols \
       --enable-protocol=tcp \
       --enable-protocol=tls \
       --enable-protocol=http \
       --enable-protocol=https \
       --enable-protocol=hls \
       --disable-indevs \
       --disable-outdevs \
       --disable-devices \
       --disable-filters \
       --disable-alsa \
       --disable-appkit \
       --disable-avfoundation \
       --disable-bzlib \
       --disable-coreimage \
       --disable-iconv \
       --disable-lzma \
       --enable-openssl \
       --disable-sndio \
       --disable-sdl2 \
       --disable-securetransport \
       --disable-xlib \
       --disable-zlib \
       --disable-amf \
       --disable-audiotoolbox \
       --disable-cuda-llvm \
       --disable-cuvid \
       --disable-d3d11va \
       --disable-dxva2 \
       --disable-ffnvcodec \
       --disable-nvdec \
       --disable-nvenc \
       --disable-v4l2-m2m \
       --disable-vaapi \
       --disable-vdpau \
       --disable-videotoolbox \
       --disable-debug

    This looked about like what I wanted :

    install prefix            /usr/local
    source path               .
    C compiler                gcc
    C library                 glibc
    ARCH                      x86 (generic)
    big-endian                no
    runtime cpu detection     no
    standalone assembly       yes
    x86 assembler             nasm
    MMX enabled               yes
    MMXEXT enabled            yes
    3DNow! enabled            yes
    3DNow! extended enabled   yes
    SSE enabled               yes
    SSSE3 enabled             yes
    AESNI enabled             yes
    AVX enabled               yes
    AVX2 enabled              yes
    AVX-512 enabled           yes
    XOP enabled               yes
    FMA3 enabled              yes
    FMA4 enabled              yes
    i686 features enabled     yes
    CMOV is fast              yes
    EBX available             yes
    EBP available             yes
    debug symbols             no
    strip symbols             yes
    optimize for size         no
    optimizations             yes
    static                    yes
    shared                    no
    postprocessing support    no
    network support           yes
    threading support         no
    safe bitstream reader     yes
    texi2html enabled         no
    perl enabled              yes
    pod2man enabled           yes
    makeinfo enabled          no
    makeinfo supports HTML    no

    External libraries:
    openssl

    External libraries providing hardware acceleration:

    Libraries:
    avcodec                 avfilter                avformat                avutil

    Programs:
    ffmpeg

    Enabled decoders:

    Enabled encoders:

    Enabled hwaccels:

    Enabled parsers:
    aac                     h264

    Enabled demuxers:
    aac                     h264                    hls                     mpegts

    Enabled muxers:
    mov                     mp4

    Enabled protocols:
    hls                     http                    https                   tcp                     tls

    Enabled filters:
    aformat                 anull                   atrim                   format                  hflip                   null                    transpose               trim                    vflip

    Enabled bsfs:
    null

    Enabled indevs:

    Enabled outdevs:

    License: LGPL version 2.1 or later

    It included several filters which I won’t ever need or use, but these filters are pulled in automatically if you don’t specify --disable-avfilter, and specifying --disable-avfilter prevents the ffmpeg binary from being produced. So I’m stuck with those.

    Using these parameters and then running make, I received a binary that was about 5.9 MB in size and looked right :

    $> ldd ffmpeg
           not a dynamic executable

    But when I try to run it :

    $> ./ffmpeg -version
    Segmentation fault

    Using valgrind to try and inspect the cause of the segmentation fault :

    $> valgrind ./ffmpeg -version
    .... lots of stuff ...
    ==61362== Jump to the invalid address stated on the next line
    ==61362==    at 0x0: ???
    ==61362==    by 0x70BB1B: ??? (in /src/FFmpeg/ffmpeg)
    ==61362==    by 0x70B2E6: ??? (in /src/FFmpeg/ffmpeg)
    ==61362==    by 0x4033F9: ??? (in /src/FFmpeg/ffmpeg)
    ==61362==    by 0x1FFF000677: ???
    ==61362==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
    ==61362==
    ==61362==
    ==61362== Process terminating with default action of signal 11 (SIGSEGV)
    ==61362==  Bad permissions for mapped region at address 0x0
    ==61362==    at 0x0: ???
    ==61362==    by 0x70BB1B: ??? (in /src/FFmpeg/ffmpeg)
    ==61362==    by 0x70B2E6: ??? (in /src/FFmpeg/ffmpeg)
    ==61362==    by 0x4033F9: ??? (in /src/FFmpeg/ffmpeg)
    ==61362==    by 0x1FFF000677: ???
    ==61362==
    ==61362== HEAP SUMMARY:
    ==61362==     in use at exit: 0 bytes in 0 blocks
    ==61362==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
    ==61362==
    ==61362== All heap blocks were freed -- no leaks are possible
    ==61362==
    ==61362== For counts of detected and suppressed errors, rerun with: -v
    ==61362== Use --track-origins=yes to see where uninitialised values come from
    ==61362== ERROR SUMMARY: 93 errors from 90 contexts (suppressed: 0 from 0)
    Segmentation fault

    Attempting to access memory at location 0x0 sounds like trying to follow a null pointer. But I’m not sure how to fix this.

    gdb backtrace

    When I first ran gdb ./ffmpeg gdb immediately gave me a segmentation fault and I wasn’t kicked into the gdb REPL, so I couldn’t investigate

    After rebuilding ffmpeg I was able to get in this time :

    $> gdb ./ffmpeg

    GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
    Copyright (C) 2018 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later /gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    /www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    /www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from ffmpeg...done.
    (gdb) r
    Starting program: /src/FFmpeg/ffmpeg
    warning: Error disabling address space randomization: Operation not permitted

    Program received signal SIGSEGV, Segmentation fault.
    0x0000000000000000 in ?? ()
    (gdb) bt
    #0  0x0000000000000000 in ?? ()
    #1  0x0000000000f9a8d5 in __register_frame_info_bases.part.6 ()
    #2  0x00000000004445fd in frame_dummy ()
    #3  0x0000000000000001 in ?? ()
    #4  0x0000000000ebd20c in __libc_csu_init ()
    #5  0x0000000000ebc9d7 in __libc_start_main ()
    #6  0x000000000044451a in _start ()
    (gdb)

    I tried grep’ing the code base for __register_frame_info_bases and found nothing. So I’m not really sure where to go from here

    A fix, but not an explanation

    By randomly removing configuration parameters and rebuilding I discovered that --disable-pthreads was causing the segmentation fault. When I remove this, ffmpeg runs just fine

    I don’t know why this is the case, though. Why would they make it possible to remove something that you need to run ?

  • Random segmentation fault with avcodec_encode_video2()

    10 août 2015, par Seba Arriagada

    this is my first question so i hope i did it correctly. If not, please let me know to fix it.

    I’m trying to convert a short (10 secs) mp4 video file into a gif using ffmpeg libraries (I’m pretty new using ffmpeg). The program works pretty well converting to gif, but some times it randomly crash.

    This is the version of the ffmpeg libraries I’m using :

    libavutil      54. 27.100
    libavcodec     56. 41.100
    libavformat    56. 36.100
    libavdevice    56.  4.100
    libavfilter     5. 16.101
    libavresample   2.  1.  0
    libswscale      3.  1.101
    libswresample   1.  2.100
    libpostproc    53.  3.100

    I’m using a 1920x1080p video, so in order to generate the gif I’m doing a pixel format convertion, from AV_PIX_FMT_YUV420P to AV_PIX_FMT_RGB8 with a resizing from the initial resolution to 432x240p.

    Here is the code :

    int VideoManager::loadVideo(QString filename, bool showInfo)
    {
       if(avformat_open_input(&iFmtCtx, filename.toStdString().c_str(), 0, 0) < 0)
       {
           qDebug() << "Could not open input file " << filename;
           closeInput();
           return -1;
       }
       if (avformat_find_stream_info(iFmtCtx, 0) < 0)
       {
           qDebug() << "Failed to retrieve input stream information";
           closeInput();
           return -2;
       }

       videoStreamIndex = -1;
       for(unsigned int i = 0; i < iFmtCtx->nb_streams; ++i)
           if(iFmtCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
           {
               videoStreamIndex = i;
               break;
           }

       if(videoStreamIndex == -1)
       {
           qDebug() << "Didn't find any video stream!";
           closeInput();
           return -3;
       }
       iCodecCtx = iFmtCtx->streams[videoStreamIndex]->codec;

       iCodec = avcodec_find_decoder(iCodecCtx->codec_id);
       if(iCodec == NULL) // Codec not found
       {
           qDebug() << "Codec not found!";
           closeInput();
           return -4;
       }
       if(avcodec_open2(iCodecCtx, iCodec, NULL) < 0)
       {
           qDebug() << "Could not open codec!";
           closeInput();
           return -1;
       }

       if(showInfo)
           av_dump_format(iFmtCtx, 0, filename.toStdString().c_str(), 0);

       return 0;
    }

    void VideoManager::generateGif(QString filename)
    {
       int ret, frameCount = 0;
       AVPacket packet;
       packet.data = NULL;
       packet.size = 0;
       AVFrame *frame = NULL;
       unsigned int stream_index;
       int got_frame;

       gifHeight = iFmtCtx->streams[videoStreamIndex]->codec->height;
       gifWidth  = iFmtCtx->streams[videoStreamIndex]->codec->width;

       if(gifHeight > MAX_GIF_HEIGHT || gifWidth > MAX_GIF_WIDTH)
       {
           if(gifHeight > gifWidth)
           {
               gifWidth  = (float)gifWidth * ( (float)MAX_GIF_HEIGHT / (float)gifHeight );
               gifHeight = MAX_GIF_HEIGHT;
           }
           else
           {
               gifHeight = (float)gifHeight * ( (float)MAX_GIF_WIDTH / (float)gifWidth );
               gifWidth  = MAX_GIF_WIDTH;
           }
       }


       if(openOutputFile(filename.toStdString().c_str()) < 0)
       {
           qDebug() << "Error openning output file: " << filename;
           return;
       }

       while (1) {
           int ret = av_read_frame(iFmtCtx, &packet);
           if (ret < 0)
           {
               if(ret != AVERROR_EOF)
                   qDebug() << "Error reading frame: " << ret;
               break;
           }
           stream_index = packet.stream_index;

           if(stream_index == videoStreamIndex)
           {
               frame = av_frame_alloc();
               if (!frame) {
                   qDebug() << "Error allocating frame";
                   break;
               }
               av_packet_rescale_ts(&packet,
                                    iFmtCtx->streams[stream_index]->time_base,
                                    iFmtCtx->streams[stream_index]->codec->time_base);

               ret = avcodec_decode_video2(iFmtCtx->streams[stream_index]->codec, frame,
                       &got_frame, &packet);
               if (ret < 0) {
                   qDebug() << "Decoding failed";
                   break;
               }

               if(got_frame)
               {
                   qDebug() << ++frameCount;
                   nframes++;
                   frame->pts = av_frame_get_best_effort_timestamp(frame);

                   ////////////////////////////////////////////////////////////////////////////////
                   /// Pixel format convertion and resize
                   ////////////////////////////////////////////////////////////////////////////////
                   uint8_t *out_buffer = NULL;
                   SwsContext *img_convert_ctx = NULL;
                   AVFrame *pFrameRGB = av_frame_alloc();

                   if(pFrameRGB == NULL)
                   {
                       qDebug() << "Error allocating frameRGB";
                       break;
                   }

                   AVPixelFormat pixFmt;
                   switch (iFmtCtx->streams[stream_index]->codec->pix_fmt)
                   {
                   case AV_PIX_FMT_YUVJ420P : pixFmt = AV_PIX_FMT_YUV420P; break;
                   case AV_PIX_FMT_YUVJ422P : pixFmt = AV_PIX_FMT_YUV422P; break;
                   case AV_PIX_FMT_YUVJ444P : pixFmt = AV_PIX_FMT_YUV444P; break;
                   case AV_PIX_FMT_YUVJ440P : pixFmt = AV_PIX_FMT_YUV440P; break;
                   default:
                       pixFmt = iFmtCtx->streams[stream_index]->codec->pix_fmt;
                   }

                   out_buffer = (uint8_t*)av_malloc( avpicture_get_size( AV_PIX_FMT_RGB8,
                                                     gifWidth,
                                                     gifHeight ));
                   if(!out_buffer)
                   {
                       qDebug() << "Error alocatting out_buffer!";
                   }
                   avpicture_fill((AVPicture *)pFrameRGB, out_buffer, AV_PIX_FMT_RGB8,
                                  gifWidth,
                                  gifHeight);
                   img_convert_ctx = sws_getContext( iFmtCtx->streams[stream_index]->codec->width,
                                                     iFmtCtx->streams[stream_index]->codec->height,
                                                     pixFmt,
                                                     gifWidth,
                                                     gifHeight,
                                                     AV_PIX_FMT_RGB8,
                                                     SWS_ERROR_DIFFUSION, NULL, NULL, NULL );

                   if(!img_convert_ctx)
                   {
                       qDebug() << "error getting sws context";
                   }

                   sws_scale( img_convert_ctx, (const uint8_t* const*)frame->data,
                              frame->linesize, 0,
                              iFmtCtx->streams[stream_index]->codec->height,
                              pFrameRGB->data,
                              pFrameRGB->linesize );

                   pFrameRGB->format = AV_PIX_FMT_RGB8;
                   pFrameRGB->pts = frame->pts;
                   pFrameRGB->best_effort_timestamp = frame->best_effort_timestamp;
                   pFrameRGB->width = gifWidth;
                   pFrameRGB->height = gifHeight;
                   pFrameRGB->pkt_dts = frame->pkt_dts;
                   pFrameRGB->pkt_pts = frame->pkt_pts;
                   pFrameRGB->pkt_duration = frame->pkt_duration;
                   pFrameRGB->pkt_pos = frame->pkt_pos;
                   pFrameRGB->pkt_size = frame->pkt_size;
                   pFrameRGB->interlaced_frame = frame->interlaced_frame;
                   ////////////////////////////////////////////////////////////////////////////////
                   ret = encodeAndWriteFrame(pFrameRGB, stream_index, NULL);
                   //av_frame_free(&frame);
                   //av_free(out_buffer);
                   //sws_freeContext(img_convert_ctx);
                   if (ret < 0)
                   {
                       qDebug() << "Error encoding and writting frame";
                       //av_free_packet(&packet);
                       closeOutput();
                   }
               }
               else {
                   //av_frame_free(&frame);
               }
           }
           av_free_packet(&packet);
       }

       ret = flushEncoder(videoStreamIndex);
       if (ret < 0)
       {
           qDebug() << "Flushing encoder failed";
       }

       av_write_trailer(oFmtCtx);

       //av_free_packet(&packet);
       //av_frame_free(&frame);
       closeOutput();
    }


    void VideoManager::closeOutput()
    {
       if (oFmtCtx && oFmtCtx->nb_streams > 0 && oFmtCtx->streams[0] && oFmtCtx->streams[0]->codec)
           avcodec_close(oFmtCtx->streams[0]->codec);
       if (oFmtCtx && oFmt && !(oFmt->flags & AVFMT_NOFILE))
           avio_closep(&oFmtCtx->pb);
       avformat_free_context(oFmtCtx);
    }

    int VideoManager::openOutputFile(const char *filename)
    {
       AVStream *out_stream;
       AVStream *in_stream;
       AVCodecContext *dec_ctx, *enc_ctx;
       AVCodec *encoder;
       int ret;

       oFmtCtx = NULL;
       avformat_alloc_output_context2(&oFmtCtx, NULL, NULL, filename);
       if (!oFmtCtx) {
           qDebug() << "Could not create output context";
           return AVERROR_UNKNOWN;
       }

       oFmt = oFmtCtx->oformat;

       out_stream = avformat_new_stream(oFmtCtx, NULL);
       if (!out_stream) {
           qDebug() << "Failed allocating output stream";
           return AVERROR_UNKNOWN;
       }

       in_stream = iFmtCtx->streams[videoStreamIndex];
       dec_ctx = in_stream->codec;
       enc_ctx = out_stream->codec;

       encoder = avcodec_find_encoder(AV_CODEC_ID_GIF);
       if (!encoder) {
           qDebug() << "FATAL!: Necessary encoder not found";
           return AVERROR_INVALIDDATA;
       }

       enc_ctx->height = gifHeight;    
       enc_ctx->width = gifWidth;      
       enc_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio;
       enc_ctx->pix_fmt = AV_PIX_FMT_RGB8;
       enc_ctx->time_base = dec_ctx->time_base;
       ret = avcodec_open2(enc_ctx, encoder, NULL);
       if (ret < 0) {
           qDebug() << "Cannot open video encoder for gif";
           return ret;
       }

       if (oFmt->flags & AVFMT_GLOBALHEADER)
           enc_ctx->flags |= CODEC_FLAG_GLOBAL_HEADER;

       if (!(oFmt->flags & AVFMT_NOFILE)) {
           ret = avio_open(&oFmtCtx->pb, filename, AVIO_FLAG_WRITE);
           if (ret < 0) {
               qDebug() << "Could not open output file " << filename;
               return ret;
           }
       }

       ret = avformat_write_header(oFmtCtx, NULL);
       if (ret < 0) {
           qDebug() << "Error occurred when opening output file";
           return ret;
       }

       return 0;
    }


    int VideoManager::encodeAndWriteFrame(AVFrame *frame, unsigned int stream_index, int *got_frame) {
       int ret;
       int got_frame_local;
       AVPacket enc_pkt;

       if (!got_frame)
           got_frame = &got_frame_local;

       enc_pkt.data = NULL;
       enc_pkt.size = 0;
       av_init_packet(&enc_pkt);
       ret = avcodec_encode_video2(oFmtCtx->streams[stream_index]->codec, &enc_pkt,
               frame, got_frame);
       //av_frame_free(&frame);
       if (ret < 0)
           return ret;
       if (!(*got_frame))
           return 0;

       enc_pkt.stream_index = stream_index;
       av_packet_rescale_ts(&enc_pkt,
                            oFmtCtx->streams[stream_index]->codec->time_base,
                            oFmtCtx->streams[stream_index]->time_base);

       ret = av_interleaved_write_frame(oFmtCtx, &enc_pkt);
       return ret;
    }


    int VideoManager::flushEncoder(unsigned int stream_index)
    {
       int ret;
       int got_frame;

       if (!(oFmtCtx->streams[stream_index]->codec->codec->capabilities &
                   CODEC_CAP_DELAY))
           return 0;

       while (1) {
           ret = encodeAndWriteFrame(NULL, stream_index, &got_frame);
           if (ret < 0)
               break;
           if (!got_frame)
               return 0;
       }
       return ret;
    }

    I know there are a lot of memory leaks. I deleted/commented most of the free functions intentionality because i thought that was the problem.

    I’m using Qtcreator, so when i debug the programs this is the output :

    Level Function                            Line
    0     av_image_copy                       303
    1     frame_copy_video                    650    
    2     av_frame_copy                       687    
    3     av_frame_ref                        384    
    4     gif_encode_frame                    307    
    5     avcodec_encode_video2               2191    
    6     VideoManager::encodeAndWriteFrame   813    
    7     VideoManager::generateGif           375    
    8     qMain                               31    
    9     WinMain*16                          112    
    10    main

    I’ve checked if there is a specific frame the program crash at, but it’s a random frame too.

    Any idea of what i’m doing wrong ? Any help would be very appreciated.

    EDIT :

    After a few days of pain, suffering and frustation I decided to write the whole code from scratch. Both times i started from this example and modified it in order to works as I described before. And it works perfectly now :D ! The only error i could find in the old code (posted before) is when i try to access to the video stream in the output file I used videoStreamIndex, but that index is from the video stream in the input file. Some times it could be the same index and some times not. But it doesn’t explain why it crashed randomly. If that was the reason of the crash, it should crash every time i ran the code with the same video. So probably, there are more errors in that code.
    Notice that i’ve not tested if fixing that error in the code above actually solve the crashing problems.

  • Anomalie #2024 (Nouveau) : langue des boutons d’admin

    7 avril 2011, par jluc -

    Sur spip.net, depuis plusieurs années, le texte des boutons d’admin m’apparaît en espagnol alors que tous mes paramétrages (espace perso, navigateur etc) sont en français. Je me souviens qu’un habitué d’IRC constatait également ce même (...)