Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP 0.2

Autres articles (77)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • 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

Sur d’autres sites (7181)

  • libavformat/libavcodec : Why am I getting a significantly shorter video than expected ?

    2 mars 2023, par itzjackyscode

    The MVE below is a simple test program that should encode 6 s (360 frames) of video. When I import the exported video (output.mkv) into a video editor, I see that it is only a fraction of a second. Why is this ? How do I fix it ?

    


    MVE

    


    #include <cstddef>&#xA;#include <cstdio>&#xA;#include <iostream>&#xA;extern "C" {&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavutil></libavutil>imgutils.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;}&#xA;&#xA;namespace av {&#xA;  // ERROR HANDLING&#xA;  // ==============&#xA;&#xA;  class av_category_t final : public std::error_category {&#xA;  public:&#xA;    inline const char* name() const noexcept override { return "av_category"; }&#xA;&#xA;    inline std::string message(int code) const noexcept override {&#xA;      thread_local static char msg_buffer[AV_ERROR_MAX_STRING_SIZE];&#xA;      av_strerror(code, msg_buffer, sizeof(msg_buffer));&#xA;      return std::string(msg_buffer);&#xA;    }&#xA;  };&#xA;&#xA;  inline const std::error_category&amp; av_category() {&#xA;    static av_category_t result;&#xA;    return result;&#xA;  }&#xA;&#xA;  // helper function to create a std::system_error.&#xA;  inline std::system_error av_error(int code) {&#xA;    return std::system_error(code, av_category());&#xA;  }&#xA;&#xA;  // Allocate or reallocate buffers in a video frame.&#xA;  inline void alloc_video_frame(&#xA;    AVFrame* frame, int width, int height, AVPixelFormat pix_fmt&#xA;  ) {&#xA;    int err;&#xA;    if (frame->width != width || frame->height != height || &#xA;      frame->format != pix_fmt || !av_frame_is_writable(frame)) {&#xA;      // unref the old data if any&#xA;      if (frame->buf[0] != nullptr) {&#xA;        av_frame_unref(frame);&#xA;      }&#xA;&#xA;      // reset parameters&#xA;      frame->width  = width;&#xA;      frame->height = height;&#xA;      frame->format = pix_fmt;&#xA;&#xA;      // reallocate&#xA;      if ((err = av_frame_get_buffer(frame, 0)) &lt; 0)&#xA;        throw av_error(err);&#xA;    }&#xA;  }&#xA;  inline void alloc_video_frame(AVFrame* frame, const AVCodecContext* ctx) {&#xA;    alloc_video_frame(frame, ctx->width, ctx->height, ctx->pix_fmt);&#xA;  }&#xA;}  // namespace av&#xA;&#xA;void fill_rgb(AVFrame* tmp, AVFrame* dst, uint32_t col) {&#xA;  static SwsContext* sws = nullptr;&#xA;  int err;&#xA;  &#xA;  av::alloc_video_frame(tmp, dst->width, dst->height, AV_PIX_FMT_0RGB32);&#xA;  for (int i = 0; i &lt; tmp->height; i&#x2B;&#x2B;) {&#xA;    for (int j = 0; j &lt; tmp->width; j&#x2B;&#x2B;) {&#xA;      void* p = tmp->data[0] &#x2B; (i * tmp->linesize[0]) &#x2B; (j * 4);&#xA;      *((uint32_t*) p) = col;&#xA;    }&#xA;  }&#xA;  &#xA;  sws = sws_getCachedContext(sws,&#xA;    // src params&#xA;    tmp->width, tmp->height, (AVPixelFormat) tmp->format,&#xA;    // dst params&#xA;    dst->width, dst->height, (AVPixelFormat) dst->format,&#xA;    // stuff&#xA;    0, nullptr, nullptr, nullptr&#xA;  );&#xA;  if ((err = sws_scale_frame(sws, dst, tmp)) &lt; 0)&#xA;    throw av::av_error(err);&#xA;}&#xA;&#xA;int32_t hue_c(int deg) {&#xA;  deg %= 360;&#xA;  int rem = deg % 60;&#xA;  switch (deg / 60) {&#xA;  case 0: return 0xFF0000 | ((deg * 256 / 60) &lt;&lt; 8);&#xA;  case 1: return 0x00FF00 | (((60 - deg) * 256 / 60) &lt;&lt; 16);&#xA;  case 2: return 0x00FF00 | ((deg * 256 / 60) &lt;&lt; 0);&#xA;  case 3: return 0x0000FF | (((60 - deg) * 256 / 60) &lt;&lt; 8);&#xA;  case 4: return 0x00FF00 | ((deg * 256 / 60) &lt;&lt; 16);&#xA;  case 5: return 0xFF0000 | (((60 - deg) * 256 / 60) &lt;&lt; 0);&#xA;  }&#xA;  return 0xFFFFFF;&#xA;}&#xA;&#xA;int main() {&#xA;  int res;&#xA;&#xA;  AVFormatContext* fmt_ctx;&#xA;  AVStream* vstream;&#xA;  const AVCodec* vcodec;&#xA;  AVCodecContext* vcodec_ctx;&#xA;&#xA;  AVFrame* vframe;&#xA;  AVFrame* vframe2;&#xA;  AVPacket* vpacket;&#xA;&#xA;  int64_t pts = 0;&#xA;&#xA;  // init frame&#xA;  res = avformat_alloc_output_context2(&amp;fmt_ctx, NULL, NULL, "output.mkv");&#xA;  if (res &lt; 0)&#xA;    return 1;&#xA;&#xA;  // get encoder&#xA;  vcodec = avcodec_find_encoder(AV_CODEC_ID_VP8);&#xA;&#xA;  // allocate everything else&#xA;  vstream    = avformat_new_stream(fmt_ctx, vcodec);&#xA;  vcodec_ctx = avcodec_alloc_context3(vcodec);&#xA;  vframe     = av_frame_alloc();&#xA;  vframe2    = av_frame_alloc();&#xA;  vpacket    = av_packet_alloc();&#xA;  if (!vstream || !vcodec_ctx || !vframe || !vpacket) {&#xA;    return 1;&#xA;  }&#xA;&#xA;  // set PTS counter&#xA;  pts = 0;&#xA;&#xA;  // codec: size parameters&#xA;  vcodec_ctx->width               = 640;&#xA;  vcodec_ctx->height              = 480;&#xA;  vcodec_ctx->sample_aspect_ratio = {1, 1};&#xA;&#xA;  // codec: pixel formats&#xA;  vcodec_ctx->pix_fmt = AV_PIX_FMT_YUV420P;&#xA;&#xA;  // codec: bit rate et al.&#xA;  vcodec_ctx->bit_rate       = 2e6;&#xA;  vcodec_ctx->rc_buffer_size = 4e6;&#xA;  vcodec_ctx->rc_max_rate    = 2e6;&#xA;  vcodec_ctx->rc_min_rate    = 2.5e6;&#xA;&#xA;  // codec: frame rate&#xA;  vcodec_ctx->time_base   = {1, 60};&#xA;  vstream->time_base      = {1, 60};&#xA;  vstream->avg_frame_rate = {60, 1};&#xA;&#xA;  // open codec&#xA;  res = avcodec_open2(vcodec_ctx, vcodec, NULL);&#xA;  if (res &lt; 0)&#xA;    throw av::av_error(res);&#xA;  res = avcodec_parameters_from_context(vstream->codecpar, vcodec_ctx);&#xA;  if (res &lt; 0)&#xA;    throw av::av_error(res);&#xA;  &#xA;  // open file&#xA;  if (!(fmt_ctx->oformat->flags &amp; AVFMT_NOFILE)) {&#xA;    res = avio_open(&amp;fmt_ctx->pb, "output.mkv", AVIO_FLAG_WRITE);&#xA;    if (res &lt; 0)&#xA;      throw av::av_error(res);&#xA;  }&#xA;  &#xA;  // write format header&#xA;  res = avformat_write_header(fmt_ctx, NULL);&#xA;  if (res &lt; 0)&#xA;    throw av::av_error(res);&#xA;&#xA;  // encode loop&#xA;  for (int i = 0; i &lt; 360; i&#x2B;&#x2B;) {&#xA;    av::alloc_video_frame(vframe, vcodec_ctx);&#xA;&#xA;    // gen data and store to vframe&#xA;    fill_rgb(vframe2, vframe, hue_c(i));&#xA;    &#xA;    // set timing info&#xA;    vframe->time_base = vcodec_ctx->time_base;&#xA;    vframe->pts       = i;&#xA;&#xA;    // send to encoder&#xA;    avcodec_send_frame(vcodec_ctx, vframe);&#xA;    while ((res = avcodec_receive_packet(vcodec_ctx, vpacket)) == 0) {&#xA;      printf("DTS: %ld, PTS: %ld\n", vpacket->dts, vpacket->pts);&#xA;      &#xA;      if ((res = av_interleaved_write_frame(fmt_ctx, vpacket)) &lt; 0)&#xA;        throw av::av_error(res);&#xA;      &#xA;    }&#xA;    if (res != AVERROR_EOF &amp;&amp; res != AVERROR(EAGAIN))&#xA;      return -1;&#xA;  }&#xA;  &#xA;  if ((res = av_write_trailer(fmt_ctx)) &lt; 0)&#xA;    throw av::av_error(res);&#xA;  &#xA;  av_frame_free(&amp;vframe);&#xA;  av_frame_free(&amp;vframe2);&#xA;  av_packet_free(&amp;vpacket);&#xA;  avcodec_free_context(&amp;vcodec_ctx);&#xA;  &#xA;  avformat_free_context(fmt_ctx);&#xA;}&#xA;</iostream></cstdio></cstddef>

    &#xA;

  • How to get 1 frame per second in ffmpeg video to images ? Getting more images than expected

    15 septembre 2021, par code0x00

    I am trying to extract images from a video 1 frame per second but i am getting more images than i expect.

    &#xA;

    for eg. :

    &#xA;

    When i run below command :

    &#xA;

    ffmpeg -i filename.mp4 -r 1 img%d.jpg&#xA;

    &#xA;

    It is a 20 second video but creating 22 images.

    &#xA;

    it should create 21 images.

    &#xA;

    Why it is creating one extra image ?

    &#xA;

  • Convert CODEC of all videos in a folder from "Codec : MPEG-H Part2/HEVC (H.265) (hev1)" to "Codec : H264 - MPEG-4 AVC (part 10) (avc1)" [closed]

    19 mai 2024, par user25123807

    I've downloaded shows and cant get them to play on TV as the codec is not supported. H264 is a compatible codec. I have noted the codec of the videos in the title of this post, and the codec which is compatible (264). I need help converting in bulk, all videos in a folder to the compatible codec - H264 - MPEG-4 AVC (part 10) (avc1).

    &#xA;

    please help

    &#xA;

    i have ffmpeg.

    &#xA;

    I have tried changing the file type from mkv —> mp4 but the issue is the codec. I need help bulk converting the codec (265—>264)

    &#xA;