Recherche avancée

Médias (91)

Autres articles (92)

Sur d’autres sites (14387)

  • saving H.264 encoded images with libavcodec

    8 octobre 2011, par user846400

    I am getting H.264 images from an IP camera and want to save the encoded images (without decoding). I am using output-example.c from ffmpeg (libavformat/output-example.c) for this purpose. For Saving the raw H.264 image, I do the following :

    AVPacket pkt;
    av_init_packet(&pkt);
    if (c->coded_frame->pts != AV_NOPTS_VALUE)
           pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
    if(c->coded_frame->key_frame)
           pkt.flags |= PKT_FLAG_KEY;
    pkt.stream_index= st->index;
    pkt.data= (uint8_t *)ulAddr;//video_outbuf;
    pkt.size= out_size;
    save_image(pkt.data, out_size);

    Where ulAddr is the address pointer to the image and out_size is the image size. Instead of saving the images to a media video file, I want to save the individual images. save_image function simply uses basic fopen and fwrite functions for saving the images. If I decode the frame and then save, everything works fine. But I have problem saving the encoded frames. The encoded frames are saved with a very small size and then they cannot be decoded.
    Is there anything wrong ? I will really appreciate any help in this regard.

  • rtmpproto : Validate the embedded flv packet size before copying

    3 octobre 2013, par Martin Storsjö
    rtmpproto : Validate the embedded flv packet size before copying
    

    This wasn’t an issue prior to 58404738, when the whole RTMP packet
    was copied at once and the length of the individual embedded flv
    packets only were validated by the flv demuxer.

    Prior to this patch, this could lead to reads and writes out of bound.

    Signed-off-by : Martin Storsjö <martin@martin.st>

    • [DBH] libavformat/rtmpproto.c
  • Extract specific frames of youtube video without downloading video

    22 janvier 2023, par Kashish Arora

    I need to extract specific frames of an online video to work on an algorithm but I don't want to download the whole video because that would make it highly inefficient.

    &#xA;

    For starters, I tried working with youtube videos. I can download whole of the video using youtube-dl in this way :

    &#xA;

    ydl_opts = {&#x27;outtmpl&#x27;: r&#x27;OUTPUT_DIRECTORY_HERE&#x27;,}&#xA;with youtube_dl.YoutubeDL(ydl_opts) as ydl:&#xA;    ydl.download([url])&#xA;

    &#xA;

    And then I can capture individual frames.

    &#xA;

    I need to avoid downloading the whole video. After some research, I have found that ffmpeg might help me do this. I found no way to download just the frames so if this is not possible, the second option is that I can download specific portions of the video. One such example in linux is here but I couldn't find any solution for python.

    &#xA;

    What is a good way to download just the frames, or portions of videos (in python) without downloading the entire thing ?

    &#xA;