Recherche avancée

Médias (3)

Mot : - Tags -/spip

Autres articles (96)

  • 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

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

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

Sur d’autres sites (8649)

  • Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead

    28 février 2018, par user1496491

    I’m using C API of MMPEG and getting this message. So I added time_base to my stream

    videoStream = avformat_new_stream(formatContext, codec);
    videoStream->time_base = AVRational{1, fps};

    and got rid of it in context

    codecContext->bit_rate = 400000;
    codecContext->width = width;
    codecContext->height = height;
    codecContext->gop_size = 10;
    codecContext->max_b_frames = 1;
    //codecContext->time_base = AVRational{1, fps};
    codecContext->pix_fmt = AV_PIX_FMT_YUV420P;

    avcodec_open2(codecContext, codec, NULL) immediately breaks

    WHY ? Do I need to apply the value to both of them ? I’ve duplicated values to both, and the message gone. But isn’t it just wrong ?

  • FFMPEG (C++) convert & compress a single image out of buffer

    27 mars 2018, par MrEinsa

    i try to encode (with compression) and decode (without compression) a image with ffmpeg. But if i want to get the sent image back with avcodec_receive_packet i get only the error AVERROR(EAGAIN).

    It doesnt matter what i change ... allways AVERROR(EAGAIN) is the outcome. Is it maybe a problem of sending just one single frame to the encoder ? And if yes, how to fix it ?

    Code (only relevant stuff shown) :

           avcodec_register_all();


       /* ------ init codec ------------------*/
       AVCodec *codec;
       codec = avcodec_find_decoder(AV_CODEC_ID_H264);
       if (!codec)
       {
           print("compressH264, could not find decoder:\"AV_CODEC_ID_H264\"!!!");
           return false;
       }

       AVCodec *nVidiaCodec = avcodec_find_encoder_by_name("h264_nvenc");
       if (!nVidiaCodec)
       {
           print("err");
       }
       /* ------ ------------ ------------------*/

       /* ------ init context ------------------*/
       AVCodecContext* av_codec_context_ = NULL;
       av_codec_context_ = avcodec_alloc_context3(nVidiaCodec);
       if (!av_codec_context_)
       {
           print("compressH264, avcodec_alloc_context3 failed!!!");
           return false;
       }
       int w = imgSrc.width();
       int h = imgSrc.height();
       if ((w % 2) != 0)
       {
           ++w;
       }
       if ((h % 2) != 0)
       {
           ++h;
       }
       av_codec_context_->width = w;
       av_codec_context_->height = h;
       av_codec_context_->pix_fmt = AV_PIX_FMT_YUV420P;
       av_codec_context_->gop_size = 1;
       av_codec_context_->max_b_frames = 1;
       av_codec_context_->bit_rate = 400000;
       av_codec_context_->time_base.den = 1;
       av_codec_context_->time_base.num = 1;

       av_opt_set(av_codec_context_->priv_data, "preset", "slow", 0);

       int ret = avcodec_open2(av_codec_context_, nVidiaCodec, NULL);
       if (0 > ret)
       {
           print("compressH264, could not open codec context for decoder:\"AV_CODEC_ID_H264\"!!!");
           return false;
       }


       AVFrame *picture = av_frame_alloc();
       picture->format = AV_PIX_FMT_RGB24;
       picture->width = w;
       picture->height = h;

       ret = avpicture_fill((AVPicture *)picture, imgSrc.bits(), AV_PIX_FMT_RGB24, w, h);
       if (0 > ret)
       {
           print("compressH264, avpicture_fill - failed!!!");
           return false;
       }

       AVFrame *tmp_picture = av_frame_alloc();
       tmp_picture->format = AV_PIX_FMT_YUV420P;
       tmp_picture->width = w;
       tmp_picture->height = h;

       ret = av_frame_get_buffer(tmp_picture, 32);

       SwsContext *img_convert_ctx = sws_getContext(av_codec_context_->width, av_codec_context_->height, AV_PIX_FMT_RGB24, av_codec_context_->width, av_codec_context_->height, av_codec_context_->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL);

       ret = sws_scale(img_convert_ctx, picture->data, picture->linesize, 0, av_codec_context_->height, tmp_picture->data, tmp_picture->linesize);

       int h264Size = avpicture_get_size(AV_PIX_FMT_YUV420P, w, h);

       ret = avcodec_send_frame(av_codec_context_, tmp_picture);
       if (0 > ret)
       {
           char err[AV_ERROR_MAX_STRING_SIZE];
           av_make_error_string(err, AV_ERROR_MAX_STRING_SIZE, ret);
           print("compressH264, avcodec_send_frame: %s", err);
       }


       AVPacket *pkt = av_packet_alloc();

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

    Everything works well until :
    - avcodec_receive_packet ... i get all time the error AVERROR(EAGAIN).

    I can start decoding just if i have the compressed image.

    Thanks for your help guys.

    Edit :
    If i do now the following code, i get a packet and ret == 0, but i have to send 46 times the same image ... for me this makes no sence.

           do
       {
           ret = avcodec_receive_packet(av_codec_context_, &pkt);
           if (ret == 0)
           {
               break;
           }
           else if ((ret < 0) && (ret != AVERROR(EAGAIN)))
           {
               coutF("error");
           }
           else if (ret == AVERROR(EAGAIN))
           {
               ret = avcodec_send_frame(av_codec_context_, tmp_picture);
               if (0 > ret)
               {
                   char err[AV_ERROR_MAX_STRING_SIZE];
                   av_make_error_string(err, AV_ERROR_MAX_STRING_SIZE, ret);
                   coutFRed("compressH264, avcodec_send_frame: %s", err);
               }
               coutF("cnt:%d", ++cnt);
           }

       } while (ret == 0);

    Edit :

    Good morning,

    after more invest, i got the issue. I have to send the same frame a lot of time, because of the keyframe stuff for h264. The question now is, if it is possible to remove the h264 standart stuff from the encoder and just let FFMPEG convert one single frame.

  • Use ffmpeg to stream live content to azure media services

    19 mars 2018, par Dadicool

    I’ve been trying to stream content to azure media services using ffmpeg as it’s one of the options described here : http://azure.microsoft.com/blog/2014/09/18/azure-media-services-rtmp-support-and-live-encoders/

    My command is :

    ffmpeg -v verbose -i 300.mp4 -strict -2 -c:a aac -b:a 128k -ar 44100 -r 30 -g 60 -keyint_min 60 -b:v 400000 -c:v libx264 -preset medium -bufsize 400k -maxrate 400k -f flv rtmp://nessma-****.channel.mediaservices.windows.net:1935/live/584c99f5c47f424d9e83ac95364331e7

    I have made sure that the streaming endpoint has one active streaming unit, I also made sure that the channel is actually Ready and I even get it to start streaming (which makes a PublishURL available).

    When I execute the ffmpeg command to start streaming, I keep getting the following error :

    ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
     built on Dec 30 2014 11:31:18 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
     configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --arch=x86_64 --enable-runtime-cpudetect
     libavutil      54. 15.100 / 54. 15.100
     libavcodec     56. 13.100 / 56. 13.100
     libavformat    56. 15.102 / 56. 15.102
     libavdevice    56.  3.100 / 56.  3.100
     libavfilter     5.  2.103 /  5.  2.103
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  1.100 /  1.  1.100
     libpostproc    53.  3.100 / 53.  3.100
    Routing option strict to both codec and muxer layer
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] overread end of atom 'colr' by 1 bytes
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] stream 0, timescale not set
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] max_analyze_duration 5000000 reached at 5003637 microseconds
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '300.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: mp42isomavc1
       creation_time   : 2014-01-11 05:39:32
       genre           : Trailer
       artist          : Warner Bros.
       title           : 300: Rise of an Empire - Trailer 2
       encoder         : HandBrake 0.9.9 2013051800
       date            : 2014
     Duration: 00:02:33.24, start: 0.000000, bitrate: 7377 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 (1920x1088), 7219 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc (default)
       Metadata:
         creation_time   : 2014-01-11 05:39:32
         encoder         : JVT/AVC Coding
       Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 157 kb/s (default)
       Metadata:
         creation_time   : 2014-01-11 05:39:32
       Stream #0:2: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 101x150 [SAR 72:72 DAR 101:150], 90k tbr, 90k tbn, 90k tbc
    rtmp://nessma-****.channel.mediaservices.windows.net:1935/live/584c99f5c47f424d9e83ac95364331e7: Input/output error

    The Azure blog post clearly states that this should be possible but I can’t find a working example anywhere.

    Environment :

    • MacOS Maverick
    • FFMPEG installed from official build
    • 300.mp4 : 1080p trailer of the latest 300 movie