Recherche avancée

Médias (91)

Autres articles (92)

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

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (4600)

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