Recherche avancée

Médias (1)

Mot : - Tags -/swfupload

Autres articles (90)

  • 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

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

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

Sur d’autres sites (9394)

  • ffmpeg / libav encoding 264 from YUV420P [on hold]

    4 janvier 2017, par MrSmith

    I am having issues getting this thing to encode correctly. Either I get the container wrong or the content it seems.
    This code encodes a file just fine, but viewing it with VLC or Totem will just yield the first picture, not the remaining 100 frames.
    This is a step up from before as I dont get warnings that my container (mp4) is borked, however now the video wont play at all.. at least it played before :).

    If someone could put a finger somewhere on this code and call me a dumbass, that would be nice :)

    void encode_video(char *carrarr[]){
    av_log_set_level(AV_LOG_DEBUG);
    av_register_all();
    avcodec_register_all();
    AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_H264);
    AVOutputFormat * outputFormat = av_guess_format("mp4", NULL, NULL);

    int test = avformat_alloc_output_context2(&outFmtCtx, outputFormat, NULL, NULL);
    if(test<0) exit(-1);

    AVStream * outStrm = avformat_new_stream(outFmtCtx, codec);
    avcodec_get_context_defaults3(outStrm->codec, codec);

    outStrm->codec->codec_id = AV_CODEC_ID_H264;
    outStrm->codec->coder_type = AVMEDIA_TYPE_VIDEO;

    outStrm->codec->bit_rate = 400000;
    outStrm->codec->width = 320;
    outStrm->codec->height = 240;
    outStrm->codec->time_base= (AVRational){1,25};
    outStrm->time_base=(AVRational){1,25};
    outStrm->codec->gop_size = 10; // emit one intra frame every ten frames
    outStrm->codec->max_b_frames=1;
    outStrm->codec->pix_fmt = AV_PIX_FMT_YUV420P;
    outStrm->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
    // FOR H264 ONLY
    test = av_opt_set(outStrm->codec->priv_data, "preset", "slow", 0);
    if(test<0) exit(-2);
    test = avcodec_open2(outStrm->codec, codec, NULL);
    if(test<0) exit(-3);
    test = avio_open2(&outFmtCtx->pb, "myoutputfile.avi", AVIO_FLAG_WRITE, NULL, NULL);
    if(test<0) exit(-4);

    test = avformat_write_header(outFmtCtx, NULL);
    if(test<0) exit(-5);
    AVFrame * frame = avcodec_alloc_frame();
    if (!frame) exit(-6);

    frame->format = outStrm->codec->pix_fmt;
    frame->width  = outStrm->codec->width;
    frame->height = outStrm->codec->height;

    ret = av_image_alloc(frame->data, frame->linesize, frame->width, frame->height, outStrm->codec->pix_fmt, 32);
    if (ret < 0) exit(-7);

    av_init_packet(&pkt);
    pkt.data = NULL;
    pkt.size = 0;

    int yrange = 240*320;
    int vrange = 240*320*0.25;

    for(int i=0;i<100;i++){
       char *carr = carrarr[i];

       char* Y = carr;
       char* U = carr+yrange;
       char* V = carr+yrange+vrange;
       frame->data[0] = (uint8_t*)Y;
       frame->data[1] = (uint8_t*)U;
       frame->data[2] = (uint8_t*)V;
       frame->pts = i;

       ret = avcodec_encode_video2(outStrm->codec, &pkt, frame, &got_output);
       if (ret < 0) {
           fprintf(stderr, "Error encoding frame\n");
           exit (EXIT_FAILURE);
       }
       if (got_output) {
           printf("Write frame %3d (size=%5d)\n", i, pkt.size);
           //fwrite(pkt.data, 1, pkt.size, file_encoded_video);
           av_interleaved_write_frame(outFmtCtx, &pkt);
           av_free_packet(&pkt);
       }
    }
    av_write_trailer(outFmtCtx);
    avio_close(outFmtCtx->pb);
    }

    carrarr is holding 100 frames of nice valid YUV420P data, I know this cause I’ve encoded it before AND I can output it to screen with SDL.

    Any ideas welcome. Thanks !

  • Error in video streaming using libavformat : VBV buffer size not set, muxing may fail

    18 octobre 2017, par Blue Sky

    I stream a video using libavformat as follows :

    static AVStream *add_stream(AVFormatContext *oc, AVCodec **codec,
                           enum AVCodecID codec_id)
    {
    AVCodecContext *c;
    AVStream *st;
    /* find the encoder */
    *codec = avcodec_find_encoder(codec_id);
    if (!(*codec)) {
       fprintf(stderr, "Could not find encoder for '%s'\n",
               avcodec_get_name(codec_id));
       exit(1);
    }
    st = avformat_new_stream(oc, *codec);
    if (!st) {
       fprintf(stderr, "Could not allocate stream\n");
       exit(1);
    }
    st->id = oc->nb_streams-1;
    c = st->codec;
    switch ((*codec)->type) {
    case AVMEDIA_TYPE_AUDIO:
       c->sample_fmt  = (*codec)->sample_fmts ?
           (*codec)->sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
       c->bit_rate    = 64000;
       c->sample_rate = 44100;
       c->channels    = 2;
       break;
    case AVMEDIA_TYPE_VIDEO:
       c->codec_id = codec_id;
       c->bit_rate = 400000;
       /* Resolution must be a multiple of two. */
       c->width    = outframe_width;
       c->height   = outframe_height;
       /* timebase: This is the fundamental unit of time (in seconds) in terms
        * of which frame timestamps are represented. For fixed-fps content,
        * timebase should be 1/framerate and timestamp increments should be
        * identical to 1. */
       c->time_base.den = STREAM_FRAME_RATE;
       c->time_base.num = 1;
       c->gop_size      = 12; /* emit one intra frame every twelve frames at most */
       c->pix_fmt       = STREAM_PIX_FMT;
       if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
           /* just for testing, we also add B frames */
           c->max_b_frames = 2;
       }
       if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
           /* Needed to avoid using macroblocks in which some coeffs overflow.
            * This does not happen with normal video, it just happens here as
            * the motion of the chroma plane does not match the luma plane. */
           c->mb_decision = 2;
       }
    break;
    default:
       break;
    }
    /* Some formats want stream headers to be separate. */
    if (oc->oformat->flags & AVFMT_GLOBALHEADER)
       c->flags |= CODEC_FLAG_GLOBAL_HEADER;
    return st;
    }

    But when I run this code, I get the following error/warning :

    [mpeg @ 01f3f040] VBV buffer size not set, muxing may fail

    Do you know how I can set the VBV buffer size in the code ? In fact, when I use ffplay to display the streamed video, ffplay doesn’t show anything for short videos but for long videos, it start displaying the video immediately. So, it looks like ffplay needs a buffer to be filled up by some amount so that it can start displaying the stream. Am I right ?

  • Encoding RGB frames using x264 and AVCodec in C

    6 novembre 2016, par deepwork

    I have RGB24 frames streamed from camera and i want to encode them into h264 ,i found that AVCodec and x264 can do so, the problem is x264 as default accepts YUV420 as input so what i wrote was a program which convert RGB frames to YUV420 .that was by sws_scale function .this works well except that it does not satisfy the required FPS because the converting (RGB->YUV420) takes time.

    This is how i setup my encoder context :

    videoStream->id = 0;
    vCodecCtx = videoStream->codec;

    vCodecCtx->coder_type       = AVMEDIA_TYPE_VIDEO;
    vCodecCtx->codec_id         = AV_CODEC_ID_H264;
    vCodecCtx->bit_rate         = 400000;
    vCodecCtx->width            = Width;
    vCodecCtx->height           = Height;
    vCodecCtx->time_base.den    = FPS;
    vCodecCtx->time_base.num    = 1;
    //vCodecCtx->time_base      = (AVRational){1,};
    vCodecCtx->gop_size         = 12;
    vCodecCtx->max_b_frames     = 1;
    vCodecCtx->pix_fmt          = AV_PIX_FMT_YUV420P;

    if(formatCtx->oformat->flags & AVFMT_GLOBALHEADER)
       vCodecCtx->flags |= CODEC_FLAG_GLOBAL_HEADER;

    av_opt_set(vCodecCtx->priv_data, "preset", "ultrafast", 0);
    av_opt_set(vCodecCtx->priv_data, "profile", "baseline", AV_OPT_SEARCH_CHILDREN);

    if (avcodec_open2(vCodecCtx, h264Codec, NULL) < 0){
       return 0;
    }

    when i changes AV_PIX_FMT_YUV420P to AV_PIX_FMT_RGB24 ,avcodec_open2 will fail.
    i read that there is a version of libx264 for RGB called libx264rgb but i even dont know whether i have to rebuild x264 with enabling this option or to download another source or i have to do it programmatically with the first x264 lib.

    the question is how to enable RGB as input to libx264 to use with libavcodec in C .or how to make the encoding or sws_scale more fast .

    Edit :

    How i built ffmpeg :

    NDK=D:/AndroidDev/android-ndk-r9
    PLATFORM=$NDK/platforms/android-18/arch-arm/
    PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64

    GENERAL="\
    --enable-small \
    --enable-cross-compile \
    --extra-libs="-lgcc" \
    --arch=arm \
    --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
    --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
    --nm=$PREBUILT/bin/arm-linux-androideabi-nm \
    --extra-cflags="-I../x264/android/arm/include" \
    --extra-ldflags="-L../x264/android/arm/lib" "


    MODULES="\
    --enable-gpl \
    --enable-libx264"

    function build_ARMv6
    {
     ./configure \
     --target-os=linux \
     --prefix=./android/armeabi \
     ${GENERAL} \
     --sysroot=$PLATFORM \
     --enable-shared \
     --disable-static \
     --extra-cflags=" -O3 -fpic -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 -mfloat-abi=softfp -mfpu=vfp -marm -march=armv6" \
     --extra-ldflags="-lx264 -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
     --enable-zlib \
     ${MODULES} \
     --disable-doc \
     --enable-neon

     make clean
     make
     make install
    }

    build_ARMv6

    echo Android ARMEABI builds finished

    How i built x264 :

    NDK=D:/AndroidDev/android-ndk-r9
    PLATFORM=$NDK/platforms/android-18/arch-arm/
    TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64
    PREFIX=./android/arm

    function build_one
    {
     ./configure \
     --prefix=$PREFIX \
     --enable-static \
     --enable-pic \
     --host=arm-linux \
     --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
     --sysroot=$PLATFORM

     make clean
     make
     make install
    }

    build_one

    echo Android ARM builds finished