Recherche avancée

Médias (3)

Mot : - Tags -/spip

Autres articles (18)

  • Taille des images et des logos définissables

    9 février 2011, par

    Dans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
    Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...)

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

  • MediaSPIP Core : La Configuration

    9 novembre 2010, par

    MediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
    Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...)

Sur d’autres sites (4011)

  • [FFmpeg]how to make codes for converting jpg files to avi(motion jpeg)

    13 avril 2016, par YJJ

    I want to make the code so that I can embed the code to a machine with cameras.

    I have one I have worked on.

    It generates a output avi file, but it doesn’t work.

    I think I didn’t make a logic to input raw images and I don’t know how.

    I want to input 100 jpg images from street_01.jpg to street_99.jpg

    int main(int argc, char* argv[])
    {
       AVFormatContext* pFormatCtx;
       AVOutputFormat* fmt;
       AVStream* video_st;
       AVCodecContext* pCodecCtx;
       AVCodec* pCodec;
       AVPacket pkt;
       uint8_t* picture_buf;
       AVFrame* pFrame;
       int picture_size;
       int y_size;
       int framecnt = 0;
       //FILE *in_file = fopen("src01_480x272.yuv", "rb"); //Input raw YUV data
       FILE *in_file = fopen("street_01.jpg", "rb");       //Input raw YUV data
       int in_w = 2456, in_h = 2058;                       //Input data's width and height
       int framenum = 100;                                 //Frames to encode
       //const char* out_file = "src01.h264";              //Output Filepath
       //const char* out_file = "src01.ts";
       //const char* out_file = "src01.hevc";
       const char* out_file = "output.avi";

       av_register_all();
    /*
       //Method1.
       pFormatCtx = avformat_alloc_context();
       //Guess Format
       fmt = av_guess_format(NULL, out_file, NULL);
       pFormatCtx->oformat = fmt;
    */
       //Method 2.
       avformat_alloc_output_context2(&pFormatCtx, NULL, "avi", out_file);
       fmt = pFormatCtx->oformat;


       //Open output URL
       if (avio_open(&pFormatCtx->pb, out_file, AVIO_FLAG_READ_WRITE) < 0){
           printf("Failed to open output file! \n");
           return -1;
       }

       video_st = avformat_new_stream(pFormatCtx, 0);
       video_st->time_base.num = 1;
       video_st->time_base.den = 25;

       if (video_st == NULL){
           return -1;
       }
       //Param that must set
       pCodecCtx = video_st->codec;
       //pCodecCtx->codec_id =AV_CODEC_ID_HEVC;
       pCodecCtx->codec_id = AV_CODEC_ID_MJPEG;
       //pCodecCtx->codec_id = fmt->video_codec;
       pCodecCtx->codec_type = AVMEDIA_TYPE_VIDEO;
       pCodecCtx->pix_fmt = AV_PIX_FMT_YUV444P;
       pCodecCtx->width = in_w;
       pCodecCtx->height = in_h;
       pCodecCtx->time_base.num = 1;
       pCodecCtx->time_base.den = 25;
       pCodecCtx->bit_rate = 400000;
       pCodecCtx->gop_size = 250;
       //H264
       //pCodecCtx->me_range = 16;
       //pCodecCtx->max_qdiff = 4;
       //pCodecCtx->qcompress = 0.6;
       pCodecCtx->qmin = 10;
       pCodecCtx->qmax = 51;

       //Optional Param
       pCodecCtx->max_b_frames = 3;

       // Set Option
       AVDictionary *param = 0;
       //H264
       if (pCodecCtx->codec_id == AV_CODEC_ID_H264) {
           av_dict_set(&param, "preset", "slow", 0);
           av_dict_set(&param, "tune", "zerolatency", 0);
           //av_dict_set(&param, "profile", "main", 0);
       }
       //H265
       if (pCodecCtx->codec_id == AV_CODEC_ID_H265){
           av_dict_set(&param, "preset", "ultrafast", 0);
           av_dict_set(&param, "tune", "zero-latency", 0);
       }

       //Show some Information
       av_dump_format(pFormatCtx, 0, out_file, 1);

       pCodec = avcodec_find_encoder(pCodecCtx->codec_id);
       if (!pCodec){
           printf("Can not find encoder! \n");
           return -1;
       }
       if (avcodec_open2(pCodecCtx, pCodec, &param) < 0){
           printf("Failed to open encoder! \n");
           return -1;
       }


       pFrame = av_frame_alloc();
       //picture_size = av_image_get_buffer_size(pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height, 1);
       picture_size = avpicture_get_size(pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height);
       picture_buf = (uint8_t *)av_malloc(picture_size);
       avpicture_fill((AVPicture *)pFrame, picture_buf, pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height);

       //Write File Header
       avformat_write_header(pFormatCtx, NULL);

       av_new_packet(&pkt, picture_size);

       y_size = pCodecCtx->width * pCodecCtx->height;

       for (int i = 0; i/Read raw YUV data
           if (fread(picture_buf, 1, y_size * 3 / 2, in_file) <= 0){
               printf("Failed to read raw data! \n");
               return -1;
           }
           else if (feof(in_file)){
               break;
           }
           pFrame->data[0] = picture_buf;                  // Y
           pFrame->data[1] = picture_buf + y_size;         // U
           pFrame->data[2] = picture_buf + y_size * 5 / 4; // V
           //PTS
           pFrame->pts = i;
           int got_picture = 0;
           //Encode
           int ret = avcodec_encode_video2(pCodecCtx, &pkt, pFrame, &got_picture);
           if (ret < 0){
               printf("Failed to encode! \n");
               return -1;
           }
           if (got_picture == 1){
               printf("Succeed to encode frame: %5d\tsize:%5d\n", framecnt, pkt.size);
               framecnt++;
               pkt.stream_index = video_st->index;
               ret = av_write_frame(pFormatCtx, &pkt);
               av_free_packet(&pkt);
           }
       }
       //Flush Encoder
       int ret = flush_encoder(pFormatCtx, 0);
       if (ret < 0) {
           printf("Flushing encoder failed\n");
           return -1;
       }

       //Write file trailer
       av_write_trailer(pFormatCtx);

       //Clean
       if (video_st){
           avcodec_close(video_st->codec);
           av_free(pFrame);
           av_free(picture_buf);
       }
       avio_close(pFormatCtx->pb);
       avformat_free_context(pFormatCtx);

       fclose(in_file);

       return 0;
    }
  • ffmpeg : avcodec_open2 returns invalid argument

    12 mai 2016, par roari

    i’m reusing the sample code from the developer 64bit release of ffmpeg in my application to encode a video :

    AVCodec* pCodec_{nullptr};
    AVCodecContext* pContext_{nullptr};

    avcodec_register_all();
    pCodec_ = avcodec_find_encoder(AV_CODEC_ID_MPEG2VIDEO);
    if (!pCodec_) {}

    pContext_ = avcodec_alloc_context3(pCodec_);
    if (!pContext_) {}

    pContext_->bit_rate = 400000;
    pContext_->width = size.width();
    pContext_->height = size.height();

    pContext_->time_base.den = 1;
    pContext_->time_base.num = fps;

    pContext_->gop_size = 10;
    pContext_->max_b_frames = 1;
    pContext_->pix_fmt = AV_PIX_FMT_BGR0;

    if (codec_id == AV_CODEC_ID_H264) {
       av_opt_set(pContext_->priv_data, "preset", "slow", 0);
    }

    int err = avcodec_open2(pContext_, pCodec_, nullptr);
    if (err < 0) {}

    AVCodec* and AVCodecContext* look like they are allocated correctly. avcodec_open2 then returns invalid argument (-22).

    I use : Windows 10 64, VS2013 Compiler, Qt Creator IDE, ffmpeg(2016-05-12) 64bit.

    The sample i took the code from is "decoding_encoding.c".

    Any ideas ?

  • Wrong second count for blackdetect filter in ffprobe

    10 avril 2016, par Jabb

    I issue this command on a 8 minutes 20 seconds video in order to detect blackframes.

    root@ubuntu:/home/hts# ffprobe -f lavfi -i "movie=test.ts,blackdetect[out0]" -show_entries tags=lavfi.black_start,lavfi.black_end -of default=nw=1

    I am expecting to get proper seconds back from ffprobe indicating where the blackframes are.

    Instead I receive very very high numbers.

    I need to mention that I cut this video from the end of a larger stream using tail. The stream is configured to add a keyframe every 0.5 seconds. Could this be the reason ? And how could I cope with this ?

    ffprobe version git-2016-03-31-54ccaae Copyright (c) 2007-2016 the FFmpeg developers
     built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
     configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-libmfx
     libavutil      55. 19.100 / 55. 19.100
     libavcodec     57. 33.100 / 57. 33.100
     libavformat    57. 29.101 / 57. 29.101
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 40.102 /  6. 40.102
     libswscale      4.  0.100 /  4.  0.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    [h264 @ 0x3222100] non-existing PPS 0 referenced
       Last message repeated 1 times
    [h264 @ 0x3222100] decode_slice_header error
    [h264 @ 0x3222100] no frame!
    [h264 @ 0x3222100] non-existing PPS 0 referenced
       Last message repeated 1 times
    [h264 @ 0x3222100] decode_slice_header error
    [h264 @ 0x3222100] no frame!
    [h264 @ 0x3222100] non-existing PPS 0 referenced
       Last message repeated 1 times
    [h264 @ 0x3222100] decode_slice_header error
    [h264 @ 0x3222100] no frame!
    [h264 @ 0x3222100] non-existing PPS 0 referenced
       Last message repeated 1 times
    [h264 @ 0x3222100] decode_slice_header error
    [h264 @ 0x3222100] no frame!
    [h264 @ 0x3222100] non-existing PPS 0 referenced
       Last message repeated 1 times
    [h264 @ 0x3222100] decode_slice_header error
    [h264 @ 0x3222100] no frame!
    [h264 @ 0x3222100] non-existing PPS 0 referenced
       Last message repeated 1 times
    [h264 @ 0x3222100] decode_slice_header error
    [h264 @ 0x3222100] no frame!
    [h264 @ 0x3222100] non-existing PPS 0 referenced
       Last message repeated 1 times
    [h264 @ 0x3222100] decode_slice_header error
    [h264 @ 0x3222100] no frame!
    [h264 @ 0x3222100] non-existing PPS 0 referenced
       Last message repeated 1 times
    [h264 @ 0x3222100] decode_slice_header error
    [h264 @ 0x3222100] no frame!
    [h264 @ 0x3222100] non-existing PPS 0 referenced
       Last message repeated 1 times
    [h264 @ 0x3222100] decode_slice_header error
    [h264 @ 0x3222100] no frame!
    [h264 @ 0x3222100] non-existing PPS 0 referenced
       Last message repeated 1 times
    [h264 @ 0x3222100] decode_slice_header error
    [h264 @ 0x3222100] no frame!
    Input #0, lavfi, from 'movie=test.ts,blackdetect[out0]':
     Duration: N/A, start: 78576.400000, bitrate: N/A
       Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x256 [SAR 1:1 DAR 5:4], 25 fps, 25 tbr, 90k tbn, 90k tbc
    TAG:lavfi.black_start=78681.9
    TAG:lavfi.black_end=78682
    TAG:lavfi.black_start=78720.5
    TAG:lavfi.black_end=78721.1
    TAG:lavfi.black_start=78761.4
    TAG:lavfi.black_end=78762.6
    TAG:lavfi.black_start=78770.9
    TAG:lavfi.black_end=78771
    TAG:lavfi.black_start=78781
    TAG:lavfi.black_end=78781.2
    TAG:lavfi.black_start=78801.2
    TAG:lavfi.black_end=78801.4
    TAG:lavfi.black_start=78821.4
    TAG:lavfi.black_end=78821.5
    TAG:lavfi.black_start=78851.5
    TAG:lavfi.black_end=78851.7
    TAG:lavfi.black_start=78871.7
    TAG:lavfi.black_end=78871.8
    TAG:lavfi.black_start=78891.8
    TAG:lavfi.black_end=78892
    TAG:lavfi.black_start=78919
    TAG:lavfi.black_end=78919.2
    TAG:lavfi.black_start=78949.2
    TAG:lavfi.black_end=78949.3
    TAG:lavfi.black_start=78979.3
    TAG:lavfi.black_end=78979.5
    TAG:lavfi.black_start=78999.5
    TAG:lavfi.black_end=78999.6
    TAG:lavfi.black_start=79022.6
    TAG:lavfi.black_end=79022.8
    TAG:lavfi.black_start=79042.8
    TAG:lavfi.black_end=79043
    TAG:lavfi.black_start=79063
    TAG:lavfi.black_end=79063.1
    [h264 @ 0x3260360] concealing 284 DC, 284 AC, 284 MV errors in P frame