Recherche avancée

Médias (0)

Mot : - Tags -/serveur

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

Autres articles (66)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

Sur d’autres sites (13133)

  • Why does my lambda doesn't end with an expected request end event ? [on hold]

    16 avril 2019, par Nachum Freedman
    const now = (...a) =>
     console.log(...a, Math.floor(new Date().getTime() / 1000) % 3600);

    exports.handler = (event, context, callback) => {
     console.log("PROCESS START");

     const FROM_BUCKET = event.Records[0].s3.bucket.name;
     const Key = decodeURIComponent(
       event.Records[0].s3.object.key.replace(/\+/g, " ")
     );
     const uploadKey = Key.replace(/.webm/, ".mp4");

     console.log("FROM BUCKET", FROM_BUCKET);
     console.log("Recived key", Key);

     const slicedFilename = Key.slice(-4) !== "webm" ? Key.slice(-4) : ".webm";
     const extension =
       slicedFilename === ".mp4"
         ? ".mp4"
         : slicedFilename === ".pcm"
         ? ".pcm"
         : slicedFilename === ".webm"
         ? ".webm"
         : console.log("THE FILE NAME IS INCORRECT PLEASE CHECK @:", Key);

     console.log("Extension detected is", extension);

     const downloadKey =
       Key.slice(-4) !== "webm"
         ? Key.slice(0, -4) + extension
         : Key.slice(0, -5) + extension;

     const downloadParams = { Bucket: FROM_BUCKET, Key: downloadKey };

     console.log("Downloading file from S3", downloadParams);

     const mobileDownloadExtension =
       extension === ".mp4" ? ".pcm" : extension === ".pcm" ? ".mp4" : null;

     const mobileDownloadParams = {
       Bucket: FROM_BUCKET,
       Key: Key.slice(0, -4) + mobileDownloadExtension
     };

     console.log("Downloading file from S3", mobileDownloadParams);

     const tmpNamespace = Math.random();

     const isMobile = extension === ".mp4" || extension === ".pcm";
     let firstDigit = 0;
     let restOfTheOffset = 0;
     if (isMobile) {
       console.log(
         "If apply, second key to download is a file type",
         mobileDownloadExtension
       );
       const offsetTime = Key.slice(
         Key.lastIndexOf("_") + 1,
         Key.indexOf(".")
       ).replace("-", "");
       if (offsetTime > 999) {
         firstDigit = 1;
         restOfTheOffset = offsetTime.slice(1, offsetTime.length);
       } else {
         firstDigit = 0;
         restOfTheOffset = offsetTime;
       }
     }
     console.log("FIle recieved from Mobile?", isMobile);

     Promise.all([
       // download file from s3
       new Promise((resolve, reject) =>
         s3.getObject(downloadParams, (err, response) => {
           if (err) {
             console.error(
               "Error while downloading file from S3",
               downloadParams,
               err.code,
               "-",
               err.message
             );
             return reject(err);
           }
           console.log("Successfully downloaed file from S3", downloadParams);
           fs.writeFile(
             tmp + "/input" + tmpNamespace + extension,
             response.Body,
             err =>
               err
                 ? console.log(err.code, "-", err.message) || reject(err)
                 : console.log(tmp + "/input" + tmpNamespace + extension) ||
                   resolve()
           );
         })
       ),
       new Promise((resolve, reject) => {
         extension !== ".mp4" && extension !== ".pcm"
           ? resolve()
           : s3.getObject(mobileDownloadParams, (err, response) => {
               if (err) {
                 console.error(
                   "Error while downloading file from S3",
                   mobileDownloadParams,
                   err.code,
                   "-",
                   err.message
                 );
                 return reject(err);
               }
               console.log(
                 "Successfully downloaed file from S3",
                 mobileDownloadParams
               );
               fs.writeFile(
                 tmp + "/input" + tmpNamespace + mobileDownloadExtension,
                 response.Body,
                 err =>
                   err
                     ? console.log(err.code, "-", err.message) || reject(err)
                     : console.log(
                         tmp + "/input" + tmpNamespace + mobileDownloadExtension
                       ) || resolve()
               );
             });
       })
     ])
       .then(() =>
         Promise.all([
           // call the answerVideoReady -> PROCESSING mobileDownloadExtnesion is actually the second file we seek (if mp4 then pcm)
           // ,

           isMobile
             ? Promise.resolve()
                 .then(() => {
                   new Promise((resolve, reject) => {
                     console.log("CALLING VIDEO PROCESSING", Key);
                     videoProcessing(Key);
                     resolve();
                   });
                 })
                 .then(
                   () =>
                     // run ffmpeg
                     // ffmpeg -i tmp/input.mp4 -movflags faststart -acodec copy -vcodec copy output.mp4
                     now("FFMPEG CONVERT PCM TO WAV START") ||
                     new Promise((resolve, reject) =>
                       spawn("./ffmpeg/ffmpeg", [
                         "-f",
                         "s16le",
                         "-ar",
                         "16000",
                         "-ac",
                         "1",
                         "-i",
                         tmp + "/input" + tmpNamespace + ".pcm",
                         "-ar",
                         "44100",
                         "-ac",
                         "2",
                         tmp + "/input" + tmpNamespace + ".wav"
                       ]).on("close", code =>
                         console.log("FFMPEG CONVERT PCM TO WAV SUCCESS", code) ||
                         !code
                           ? resolve()
                           : reject()
                       )
                     )
                 )
                 .then(
                   () =>
                     // run ffmpeg
                     // ffmpeg -i tmp/input.mp4 -movflags faststart -acodec copy -vcodec copy output.mp4
    //more stuff
                     now("FFMPEG COMBINE MP4 AND WAV START") ||
                     new Promise(
                       (resolve, reject) =>
                         console.log(
                           [
                             "-i",
                             tmp + "/input" + tmpNamespace + ".mp4",
                             "-itsoffset",
                             "-" + firstDigit + "." + restOfTheOffset,
                             "-i",
                             tmp + "/input" + tmpNamespace + ".wav",
                             "-movflags",
                             "faststart",
                             "-filter_complex",
                             " [1:0] apad ",
                             "-shortest",
                             tmp + "/output" + tmpNamespace + ".mp4"
                           ].join(" ")
                         ) ||
                         spawn("./ffmpeg/ffmpeg", [
                           "-i",
                           tmp + "/input" + tmpNamespace + ".mp4",
                           "-itsoffset",
                           "-" + firstDigit + "." + restOfTheOffset,
                           "-i",
                           tmp + "/input" + tmpNamespace + ".wav",
                           "-movflags",
                           "faststart",
                           "-filter_complex",
                           " [1:0] apad ",
                           "-shortest",
                           tmp + "/output" + tmpNamespace + ".mp4"
                         ]).on("close", code =>
                           console.log(
                             "FFMPEG COMBINE MP4 AND WAV SUCCESS",
                             code
                           ) || !code
                             ? resolve()
                             : reject()
                         )
                     )
                 )
             : Promise.resolve()
                 .then(() => {
                   new Promise((resolve, reject) => {
                     console.log("CALLING VIDEO PROCESSING", Key);
                     videoProcessing(Key);
                     resolve();
                   });
                 })
                 .then(
                   () =>
                     now("FFMPEG SEND WEBM START") ||
                     new Promise((resolve, reject) => {
                       exec(
                         "./sed -i '1,4d;$d' " +
                           tmp +
                           "/input" +
                           tmpNamespace +
                           ".webm"
                       ).on(
                         "close",
                         code =>
                           console.log("FFMPEG SEND WEBM SUCCESS", code) ||
                           (!code ? resolve() : reject())
                       );
                     })
                 )
                 .then(
                   () =>
                     // run ffmpeg
                     // ffmpeg -i tmp/input.mp4 -movflags faststart -acodec copy -vcodec copy output.mp4
                     now("FFMPEG WEBM WEB READY START") ||
                     new Promise((resolve, reject) =>
                       (a => {
                         a.stdout.on("data", data => {
                           //console.log(`child stdout:\n${data}`);
                         });
                         a.stderr.on("data", data => {
                           //console.log(`child stdout:\n${data}`);
                         });
                         return a;
                       })(
                         spawn("./ffmpeg/ffmpeg", [
                           "-i",
                           tmp + "/input" + tmpNamespace + extension,
                           "-movflags",
                           "faststart",
                           "-acodec",
                           "aac",
                           "-vcodec",
                           "h264",
                           "-preset",
                           "slow",
                           "-crf",
                           "26",
                           "-r",
                           "25",
                           tmp + "/output" + tmpNamespace + ".mp4"
                         ])
                       ).on("close", code =>
                         console.log(
                           "FFMPEG WEBM WEB READY FINISHED WITH:",
                           code
                         ) || !code
                           ? resolve()
                           : reject()
                       )
                     )
                 )
         ])
       )
       .then(
         () =>
           new Promise((resolve, reject) =>
             // upload the output.mp4 to s3
             fs.readFile(
               tmp + "/output" + tmpNamespace + ".mp4",
               (err, filedata) => {
                 if (err) {
                   console.log("ERROR WHILE TRYING TO READ FILE", err);
                   throw err;
                 }
                 console.log("KEEEEYYY", uploadKey),
                   s3.putObject(
                     {
                       Bucket: TO_BUCKET,
                       Key: uploadKey,
                       Body: filedata
                     },
                     (err, response) => {
                       console.log(response);
                       if (err) {
                         console.log(
                           "ERROR WHILE UPLOADING FILE TO S3",
                           err,
                           response
                         );
                         return reject(err);
                       }
    //uploading file
                       console.log(
                         "Successfully uploaded file to " + TO_BUCKET,
                         Key
                       );
                       resolve();
                     }
                   );
               }
             )
           )

         // call the answerVideoReady -> COMPLETED, context.success  or ERROR, context.fail or error on set status to ERROR -> fail
       )
       .then(p =>
         videoCompleted(Key)
           .then(c => context.succeed())
           .catch(es => context.fail(es))
       )
       .catch(
         e =>
           console.log("catch for upload error with:", e) ||
           videoError(Key)
             .then(p => context.fail(e))
             .catch(ee => context.fail(ee))
       );
    };
  • FFMPEG - Scale video filter not providing expected results

    11 novembre 2011, par dpassera

    Apologies if this question has been asked. I couldn't find it, but if it has, please let me know and I'll close this out.

    I'm attempting a simple scale of a video whose original dimensions are 480x360 and whose target dimensions are 400x300. The video starts as an FLV and eventually needs to end up as an MPEG. I'm using the following command line to do this :

    ffmpeg -i user.flv -vf "scale=400:300" user_scaled.mpg

    When I play the scaled video in MPEG Streamclip, the scale is correct and the video info shows that the dimensions are 400x300. However, when I play the scaled video in Quicktime, the video is scaled to 478x359. More importantly, FFMPEG, itself, treats the video as being 478x359, so any future commands (trimming, conversion, overlaying, etc) executed on it result in a video of 478x359.

    The initial workflow required an FLV to MPEG conversion, but I've tried this with several different in and out formats (FLV -> FLV, FLV -> MPEG, MPEG -> MPEG, etc) all with the same results. As long as I can end up with an MPEG, though, I can deal with however many steps and conversions it would take to get this scaling working.

    I'll paste the command-line output below, and a sample input video is also linked below, if you'd like it. Thank you very much for any help.

    http://www.monkeydriver.com/dpassera/stack_flv.zip

    Command-line output :

    ffmpeg -i user.flv -vf "scale=400:300" user_scaled.mpg

    ffmpeg version 0.7-rc1, Copyright (c) 2000-2011 the FFmpeg developers
     built on May 21 2011 22:13:19 with gcc 4.1.2 20080704 (Red Hat 4.1.2-50)
     configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64
    --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth
    --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
    -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC'
    --enable-avfilter --enable-libdirac --enable-libgsm --enable-libmp3lame
    --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264
    --enable-gpl --enable-postproc --enable-pthreads --enable-shared
    --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
    --disable-yasm --enable-filters --enable-filter=movie

     libavutil    50. 40. 1 / 50. 40. 1
     libavcodec   52.120. 0 / 52.120. 0
     libavformat  52.108. 0 / 52.108. 0
     libavdevice  52.  4. 0 / 52.  4. 0
     libavfilter   1. 77. 0 /  1. 77. 0
     libswscale    0. 13. 0 /  0. 13. 0
     libpostproc  51.  2. 0 / 51.  2. 0

    [flv @ 0x11dd3b30] Estimating duration from bitrate, this may be inaccurate
    Input #0, flv, from 'user.flv':

     Metadata:
       duration        : 5
       videocodecid    : 2
       audiocodecid    : 6
       canSeekToEnd    : true
       createdby       : FMS 4.0
       creationdate    : Mon Oct 31 11:43:44 2011

     Duration: 00:00:04.62, start: 0.000000, bitrate: N/A
       Stream #0.0: Video: flv, yuv420p, 640x480, 1k tbr, 1k tbn, 1k tbc
       Stream #0.1: Audio: nellymoser, 44100 Hz, mono, s16

    [buffer @ 0x11ddc950] w:640 h:480 pixfmt:yuv420p

    [scale @ 0x11dda610] w:640 h:480 fmt:yuv420p -> w:400 h:300 fmt:yuv420p flags:0xa0000004

    [mpeg @ 0x11dd6bd0] VBV buffer size not set, muxing may fail

    Output #0, mpeg, to 'user_scaled.mpg':
     Metadata:
       duration        : 5
       videocodecid    : 2
       audiocodecid    : 6
       canSeekToEnd    : true
       createdby       : FMS 4.0
       creationdate    : Mon Oct 31 11:43:44 2011
       encoder         : Lavf52.108.0

       Stream #0.0: Video: mpeg1video, yuv420p, 400x300, q=2-31, 200 kb/s, 90k tbn, 60 tbc

       Stream #0.1: Audio: mp2, 44100 Hz, mono, s16, 64 kb/s

    Stream mapping:
    Stream #0.0 -> #0.0
    Stream #0.1 -> #0.1

    Press [q] to stop encoding
    frame=  230 fps=  0 q=10.2 size=     366kB time=3.82 bitrate= 785.6kbits/s dup=175 drop=0
    frame=  267 fps=  0 q=10.7 Lsize=     412kB time=4.43 bitrate= 761.3kbits/s dup=203 drop=0    

    video:370kB audio:36kB global headers:0kB muxing overhead 1.568959%
  • 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;