Recherche avancée

Médias (0)

Mot : - Tags -/formulaire

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (33)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (8265)

  • avcodec_decode_video2 takes long time to decode wmv

    22 février 2013, par Mike Versteeg

    I have written a player using the ffmpeg libraries that plays several avi, mp4 and mpg files fine but not wmv. Debugging has shown that the culprit is avcodec_decode_video2 which for some reason takes half a second to decode a single wmv frame. I have tested and confirmed this with multiple wmv files, even those with much lower resolution then other files that play successfully. Anyone has a clue what I'm doing wrong ?

    PS : log shows "Extra data : 8 bits left, value : 0" and "parser not found for codec wmav2, packets or times may be invalid." for WMV files.

    UPDATE :
    Further examination has shown the call to avcodec_decode_video2 is not slow, instead it seems to return the same frame some 16 times or so, giving the visual impression that it is slow. It does not return an error code so I have no clue why it won't decode all frames in the case of wmv.

    Relevant code :

     AVPacket packet;
     av_init_packet(&packet);
     done = pOwner->av_read_frame(pFormatCtx, &packet) < 0;
     if (!done && packet.stream_index==videostream)
         bool error = pOwner->avcodec_decode_video2(pVCodecCtx, pFrameYUV, &finished, &packet) < 0;
  • Video encoding and keyframes

    24 février 2013, par Tishu

    I am transcoding a video frame by frame and using x264+ffmpeg to encode. The original video plays fine, but the first few frames of my transcoded vide show grey artefacts. I understand this is because of time compression and these artefacts disappear after a few frames.

    See these two pictures which are the first and second frames. The third frame is normal (i.e. no grey artefact and not blurry like the second one)
    First frame
    Second frame

    How can I force the first frame to be a key frame (ie fully encoded in my output video) so that these artefacts do not show ?

    Edit - more details

    Here is what I am doing more in details. I used bit form differents tutorials to read a video frame by frame and reencode each frame to a new video. My encoding parameters are the following :

    avcodec_get_context_defaults3(c, *codec);
    c->codec_id = codec_id;
    c->bit_rate = output_bitrate;
    /* Resolution must be a multiple of two. */
    c->width    = output_width;
    c->height   = output_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. */
    st->r_frame_rate.num = output_framerate_num;
    st->r_frame_rate.den = output_framerate_den;
    c->time_base.den = output_timebase_den;
    c->time_base.num = output_timebase_num;
    c->gop_size      = 3; /* 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;
    }
    c->max_b_frames = 2;
    c->scenechange_threshold = 0;
    c->rc_buffer_size = 0;
    c->me_method = ME_ZERO;

    Then I process each frame, probably doing something wrong there. The decoding bit :

    while(av_read_frame(gFormatCtx, &packet)>=0) {
       // Is this a packet from the video stream?
       if(packet.stream_index==gVideoStreamIndex) {
           // Decode video frame
           avcodec_decode_video2(gVideoCodecCtx, pCurrentFrame, &frameFinished, &packet);
           // Did we get a video frame?
           if(frameFinished) {
               [...]
               if(firstPts == -999) /*Initial value*/
                   firstPts = packet.pts;
               deltaPts = packet.pts - firstPts;
               double seconds = deltaPts*av_q2d(gFormatCtx->streams[gVideoStreamIndex]->time_base);
               [...]
               muxing_writeVideoFrame(pCurrentFrame, packet.pts);
           }
       }
    }

    The actual writing :

    int muxing_writeVideoFrame(AVFrame *frame, int64_t pts)
    {
    frameCount = frameCount +1;
    if(frameCount > 0)
    {
       if (video_st)
           video_pts = (double)video_st->pts.val * video_st->time_base.num /
                       video_st->time_base.den;
       else
           video_pts = 0.0;

       if (video_st && !(video_st && audio_st && audio_pts < video_pts))
       {
           frame->pts = pts;//av_rescale_q(frame_count, video_st->codec->time_base, video_st->time_base);
           write_video_frame(oc, video_st, frame);
       }
    }

    return 0;
    }

    static int write_video_frame(AVFormatContext *oc, AVStream *st, AVFrame *frame)
    {
       int ret;
       static struct SwsContext *sws_ctx;
       //LOGI(10, frame_count);
       AVCodecContext *c = st->codec;

       /* encode the image */
       AVPacket pkt;
       int got_output;
       av_init_packet(&pkt);
       pkt.data = NULL;    // packet data will be allocated by the encoder
       pkt.size = 0;
    ret = avcodec_encode_video2(c, &pkt, frame, &got_output);
    if (ret < 0) {
       fprintf(stderr, "Error encoding video frame: %s\n", av_err2str(ret));
       exit(1);
    }
    /* If size is zero, it means the image was buffered. */
    if (got_output) {
       if (c->coded_frame->key_frame)
           pkt.flags |= AV_PKT_FLAG_KEY;
       pkt.stream_index = st->index;
       /* Write the compressed frame to the media file. */
       ret = av_interleaved_write_frame(oc, &pkt);
    } else {
       ret = 0;
    }

       if (ret != 0) {
           LOGI(10, av_err2str(ret));
           exit(1);
       }
       frame_count++;
       return got_output;
    }
  • Stream frames of videos to server, compile, and download

    20 avril 2016, par Amol Patel

    I have an application that currently allows a user to upload a video and plays the gray-scaled version of the video side by side in real time. I want to be able to upload the gray-scaled video to a server frame by frame, compile the frames, and then allow the user to download the video. I have looked at various libraries such as ffserver, stream-encoder.js, node-video, etc. but have not been able to find something that does what I need. I plan on running ffmpeg on the server side to compile the frames

    Any tips or libraries I could use would be very helpful.

    Thanks