Recherche avancée

Médias (91)

Autres articles (61)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

Sur d’autres sites (7312)

  • Android Media player by FFmpeg2.3.3 and SDL2-2.0.3 has a error when SDL_init().The error is about SDL_main.h

    25 avril 2019, par Hanamaki

    I use FFmpeg2.3.3 and SDL2-2.0.3 to develop an Android video player.I built the .apk success,but when I ran it,it’s an error at SDL_init().I got message by SDL_error().The message was :

    SDL_Init(14144) : Application didn’t initialize properly, did you include SDL_main.h in the file containing your main() function ?

    but I have #include "SDL_main.h" in the source.

  • [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;
    }
  • "does not contain any stream" if "EXT-X-MEDIA-SEQUENCE" > 0

    6 mars 2019, par Wonson

    I have a list of .ts files and want to save them as multiple video files.


    First I have a .m3u8 like this obtained from streaming :

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-TARGETDURATION:5
    #EXT-X-MEDIA-SEQUENCE:0
    #EXT-X-KEY:METHOD=AES-128,URI="aaa001_00001.key"
    #EXTINF:3.01,
    aaa001_00002.ts
    #EXTINF:3.01,
    aaa001_00003.ts

    ...

    #EXTINF:3.01,
    aaa001_01944.ts
    #EXT-X-ENDLIST

    Step 1 :

    So, I tried to convert it into several m3u8 like the followings :

    segment1.m3u8

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-TARGETDURATION:5
    #EXT-X-MEDIA-SEQUENCE:0
    #EXT-X-KEY:METHOD=AES-128,URI="aaa001_00001.key"
    #EXTINF:3.01,
    aaa001_00002.ts
    #EXTINF:3.01,
    aaa001_00003.ts

    ...

    #EXTINF:3.01,
    aaa001_00569.ts
    #EXT-X-ENDLIST

    segment2.m3u8

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-TARGETDURATION:5
    #EXT-X-MEDIA-SEQUENCE:567
    #EXT-X-KEY:METHOD=AES-128,URI="aaa001_00001.key"
    #EXTINF:3.01,
    aaa001_00002.ts
    #EXTINF:3.01,
    aaa001_00003.ts

    ...

    #EXTINF:3.01,
    aaa001_01288.ts
    #EXT-X-ENDLIST

    and so on...

    then do the ffmpeg cmd one by one..

    ffmpeg -i /fs/segment2.m3u8 -safe 0 -map 0:v -map 0:a -cpu-used 4 -threads 0 -preset veryfast -c copy -bsf:a aac_adtstoasc output.mp4


    But those EXT-X-MEDIA-SEQUENCE > 0 (i.e. since segment2.m3u8...) will result in

    "Output file #0 does not contain any stream"


    Then I tried to make the ’segment2.m3u8’ looks like this

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-TARGETDURATION:5
    #EXT-X-MEDIA-SEQUENCE:0
    #EXT-X-KEY:METHOD=AES-128,URI="aaa001_00001.key"
    #EXTINF:3.01,
    aaa001_00002.ts <--the first video chunk
    #EXTINF:3.01,
    aaa001_00570.ts <--the start point of segment 2
    #EXTINF:3.01,
    aaa001_00571.ts

    ...

    #EXTINF:3.01,
    aaa001_01288.ts
    #EXT-X-ENDLIST

    ffmpeg works fine, and gives me an output video, so it seems the stream channel info is in the first chunk.

    However, there are still several problems

    1. the first chunk of video is in segment2.mp4 which I clearly do not want it here.

    2. the segment2 output video plays first the 3.01s, then freezed the image until the time reach aaa001_00570.ts and play again


    So, any suggestion so that I can reference the stream info from first chunk ? or ignore it in the playlist, etc ?


    UPDATE SOLUTION

    As it works when #EXT-X-MEDIA-SEQUENCE:0, and #EXT-X-KEY : IV = by default

    So I add IV=hex(#EXT-X-MEDIA-SEQUENCE)in every playlist

    segment1.m3u8

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-TARGETDURATION:5
    #EXT-X-MEDIA-SEQUENCE:0
    #EXT-X-KEY:METHOD=AES-128,URI="aaa001_00001.key",IV=0x00000000000000000000000000000000
    #EXTINF:3.01,
    aaa001_00002.ts
    #EXTINF:3.01,
    aaa001_00003.ts

    ...

    #EXTINF:3.01,
    aaa001_00569.ts
    #EXT-X-ENDLIST

    segment2.m3u8

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-TARGETDURATION:5
    #EXT-X-MEDIA-SEQUENCE:567
    #EXT-X-KEY:METHOD=AES-128,URI="aaa001_00001.key",IV=0x00000000000000000000000000000237
    #EXTINF:3.01,
    aaa001_00570.ts

    ...

    #EXTINF:3.01,
    aaa001_01288.ts
    #EXT-X-ENDLIST