Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

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

Autres articles (57)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (7261)

  • x86 : replace explicit REP_RETs with RETs

    1er février 2023, par Lynne
    x86 : replace explicit REP_RETs with RETs
    

    From x86inc :
    > On AMD cpus <=K10, an ordinary ret is slow if it immediately follows either
    > a branch or a branch target. So switch to a 2-byte form of ret in that case.
    > We can automatically detect "follows a branch", but not a branch target.
    > (SSSE3 is a sufficient condition to know that your cpu doesn't have this problem.)

    x86inc can automatically determine whether to use REP_RET rather than
    REP in most of these cases, so impact is minimal. Additionally, a few
    REP_RETs were used unnecessary, despite the return being nowhere near a
    branch.

    The only CPUs affected were AMD K10s, made between 2007 and 2011, 16
    years ago and 12 years ago, respectively.

    In the future, everyone involved with x86inc should consider dropping
    REP_RETs altogether.

    • [DH] libavcodec/x86/aacpsdsp.asm
    • [DH] libavcodec/x86/ac3dsp.asm
    • [DH] libavcodec/x86/alacdsp.asm
    • [DH] libavcodec/x86/audiodsp.asm
    • [DH] libavcodec/x86/dirac_dwt.asm
    • [DH] libavcodec/x86/fft.asm
    • [DH] libavcodec/x86/flacdsp.asm
    • [DH] libavcodec/x86/h264_chromamc.asm
    • [DH] libavcodec/x86/h264_chromamc_10bit.asm
    • [DH] libavcodec/x86/h264_deblock_10bit.asm
    • [DH] libavcodec/x86/h264_idct.asm
    • [DH] libavcodec/x86/h264_idct_10bit.asm
    • [DH] libavcodec/x86/h264_intrapred.asm
    • [DH] libavcodec/x86/h264_intrapred_10bit.asm
    • [DH] libavcodec/x86/h264_qpel_10bit.asm
    • [DH] libavcodec/x86/h264_qpel_8bit.asm
    • [DH] libavcodec/x86/h264_weight.asm
    • [DH] libavcodec/x86/h264_weight_10bit.asm
    • [DH] libavcodec/x86/hevc_sao.asm
    • [DH] libavcodec/x86/hevc_sao_10bit.asm
    • [DH] libavcodec/x86/hpeldsp.asm
    • [DH] libavcodec/x86/hpeldsp_vp3.asm
    • [DH] libavcodec/x86/huffyuvdsp.asm
    • [DH] libavcodec/x86/jpeg2000dsp.asm
    • [DH] libavcodec/x86/lossless_videodsp.asm
    • [DH] libavcodec/x86/lossless_videoencdsp.asm
    • [DH] libavcodec/x86/me_cmp.asm
    • [DH] libavcodec/x86/pngdsp.asm
    • [DH] libavcodec/x86/qpel.asm
    • [DH] libavcodec/x86/qpeldsp.asm
    • [DH] libavcodec/x86/rv34dsp.asm
    • [DH] libavcodec/x86/rv40dsp.asm
    • [DH] libavcodec/x86/sbrdsp.asm
    • [DH] libavcodec/x86/takdsp.asm
    • [DH] libavcodec/x86/utvideodsp.asm
    • [DH] libavcodec/x86/v210.asm
    • [DH] libavcodec/x86/vc1dsp_mc.asm
    • [DH] libavcodec/x86/videodsp.asm
    • [DH] libavcodec/x86/vp8dsp.asm
    • [DH] libavfilter/x86/af_volume.asm
    • [DH] libavfilter/x86/avf_showcqt.asm
    • [DH] libavfilter/x86/scene_sad.asm
    • [DH] libavfilter/x86/vf_blend.asm
    • [DH] libavfilter/x86/vf_framerate.asm
    • [DH] libavfilter/x86/vf_gradfun.asm
    • [DH] libavfilter/x86/vf_hqdn3d.asm
    • [DH] libavfilter/x86/vf_interlace.asm
    • [DH] libavfilter/x86/vf_maskedmerge.asm
    • [DH] libavfilter/x86/vf_stereo3d.asm
    • [DH] libavfilter/x86/vf_w3fdif.asm
    • [DH] libavutil/x86/float_dsp.asm
    • [DH] libavutil/x86/lls.asm
    • [DH] libswresample/x86/audio_convert.asm
    • [DH] libswresample/x86/rematrix.asm
    • [DH] libswscale/x86/input.asm
    • [DH] libswscale/x86/output.asm
    • [DH] libswscale/x86/scale.asm
    • [DH] libswscale/x86/scale_avx2.asm
    • [DH] libswscale/x86/yuv2yuvX.asm
    • [DH] libswscale/x86/yuv_2_rgb.asm
    • [DH] tests/checkasm/x86/checkasm.asm
  • Convert videos from .264 to .265 (HEVC) with ffmpeg [closed]

    11 août 2024, par John Terragnoli

    I see that there are a few questions on this subject but I am still getting errors. All I want to do is convert videos in my library to HEVC so they take up less space.
    &#xA;I've tried this :

    &#xA;&#xA;

    ffmpeg -i input.mp4 -c:v libx265 output.mp4&#xA;

    &#xA;&#xA;

    ffmpeg seems to take a long time and the output seems to be about the right size. The video will play with VLC but the icon is weird and when I try to open it with QuickTime, I get the error : 'The document “output.mov” could not be opened. The file isn’t compatible with QuickTime Player.'

    &#xA;&#xA;

    I don't want to change any of the fancy settings. I just want the files to take up less space and with minimal or no quality loss.

    &#xA;&#xA;

    Thanks !

    &#xA;&#xA;

    EDIT : &#xA;Having trouble keeping the time stamp that I put into the videos.
    &#xA;Originally I was using exiftool in terminal. But, sometimes that doesn’t work with videos, so I would airdrop them to my iPhone, use an app called Metapho to change the dates, and then airdrop them back. Exiftool was create but sometimes I just wouldn’t work. It would change the date to something like 1109212 Aug 2nd. Weird. Bottom line is that when I do these conversions, I really don’t want lose the time stamps in them.

    &#xA;&#xA;

    ORIGINAL FILE THAT I TIMESTAMPED, IN .264

    &#xA;&#xA;

    ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers&#xA;  built with Apple clang version 11.0.0 (clang-1100.0.33.8)&#xA;  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags=&#x27;-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin -fno-stack-check&#x27; --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;test_original.mov&#x27;:&#xA;  Metadata:&#xA;    major_brand     : qt  &#xA;    minor_version   : 0&#xA;    compatible_brands: qt  &#xA;    creation_time   : 2019-10-22T18:48:43.000000Z&#xA;    encoder         : HandBrake 0.10.2 2015060900&#xA;    com.apple.quicktime.creationdate: 1994-12-25T18:00:00Z&#xA;  Duration: 00:01:21.27, start: 0.000000, bitrate: 800 kb/s&#xA;    Chapter #0:0: start 0.000000, end 81.265000&#xA;    Metadata:&#xA;      title           : Chapter 12&#xA;    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 710x482 [SAR 58409:65535 DAR 1043348:794715], 634 kb/s, SAR 9172:10291 DAR 404229:307900, 29.95 fps, 29.97 tbr, 90k tbn, 180k tbc (default)&#xA;    Metadata:&#xA;      creation_time   : 2019-10-22T18:48:43.000000Z&#xA;      handler_name    : Core Media Video&#xA;      encoder         : &#x27;avc1&#x27;&#xA;    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2019-10-22T18:48:43.000000Z&#xA;      handler_name    : Core Media Audio&#xA;    Stream #0:2(und): Data: bin_data (text / 0x74786574), 0 kb/s&#xA;    Metadata:&#xA;      creation_time   : 2019-10-22T18:48:43.000000Z&#xA;      handler_name    : Core Media Text&#xA;At least one output file must be specified&#xA;

    &#xA;&#xA;

    FILE CONVERTED TO HEVC, WITHOUT -COPYTS TAG

    &#xA;&#xA;

    ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers&#xA;  built with Apple clang version 11.0.0 (clang-1100.0.33.8)&#xA;  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags=&#x27;-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin -fno-stack-check&#x27; --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;test_original_HEVC.mov&#x27;:&#xA;  Metadata:&#xA;    major_brand     : qt  &#xA;    minor_version   : 512&#xA;    compatible_brands: qt  &#xA;    encoder         : Lavf58.29.100&#xA;  Duration: 00:01:21.30, start: 0.000000, bitrate: 494 kb/s&#xA;    Chapter #0:0: start 0.000000, end 81.265000&#xA;    Metadata:&#xA;      title           : Chapter 12&#xA;    Stream #0:0: Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, progressive), 710x482 [SAR 9172:10291 DAR 404229:307900], 356 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 29.97 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : Core Media Video&#xA;      encoder         : Lavc58.54.100 libx265&#xA;    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)&#xA;    Metadata:&#xA;      handler_name    : Core Media Audio&#xA;    Stream #0:2(eng): Data: bin_data (text / 0x74786574), 0 kb/s&#xA;    Metadata:&#xA;      handler_name    : SubtitleHandler&#xA;At least one output file must be specified&#xA;

    &#xA;&#xA;

    FILE CONVERTED TO HEVC, WITH -COPYTS TAG

    &#xA;&#xA;

    ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers&#xA;  built with Apple clang version 11.0.0 (clang-1100.0.33.8)&#xA;  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags=&#x27;-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home/include/darwin -fno-stack-check&#x27; --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;test_original_HEVC_keepts.mov&#x27;:&#xA;  Metadata:&#xA;    major_brand     : qt  &#xA;    minor_version   : 512&#xA;    compatible_brands: qt  &#xA;    encoder         : Lavf58.29.100&#xA;  Duration: 00:01:21.30, start: 0.000000, bitrate: 494 kb/s&#xA;    Chapter #0:0: start 0.000000, end 81.265000&#xA;    Metadata:&#xA;      title           : Chapter 12&#xA;    Stream #0:0: Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, progressive), 710x482 [SAR 9172:10291 DAR 404229:307900], 356 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 29.97 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : Core Media Video&#xA;      encoder         : Lavc58.54.100 libx265&#xA;    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)&#xA;    Metadata:&#xA;      handler_name    : Core Media Audio&#xA;    Stream #0:2(eng): Data: bin_data (text / 0x74786574), 0 kb/s&#xA;    Metadata:&#xA;      handler_name    : SubtitleHandler&#xA;At least one output file must be specified&#xA;

    &#xA;

  • FFMPEG. Read frame, process it, put it to output video. Copy sound stream unchanged

    9 décembre 2016, par Andrey Smorodov

    I want to apply processing to a video clip with sound track, extract and process frame by frame and write result to output file. Number of frames, size of frame and speed remains unchanged in output clip. Also I want to keep the same audio track as I have in source.

    I can read clip, decode frames and process then using opencv. Audio packets are also writes fine. I’m stuck on forming output video stream.

    The minimal runnable code I have for now (sorry it not so short, but cant do it shorter) :

    extern "C" {
    #include <libavutil></libavutil>timestamp.h>
    #include <libavformat></libavformat>avformat.h>
    #include "libavcodec/avcodec.h"
    #include <libavutil></libavutil>opt.h>
    #include <libavdevice></libavdevice>avdevice.h>
    #include <libswscale></libswscale>swscale.h>
    }
    #include "opencv2/opencv.hpp"

    #if LIBAVCODEC_VERSION_INT &lt; AV_VERSION_INT(55,28,1)
    #define av_frame_alloc  avcodec_alloc_frame
    #endif

    using namespace std;
    using namespace cv;

    static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt, const char *tag)
    {
       AVRational *time_base = &amp;fmt_ctx->streams[pkt->stream_index]->time_base;

       char buf1[AV_TS_MAX_STRING_SIZE] = { 0 };
       av_ts_make_string(buf1, pkt->pts);
       char buf2[AV_TS_MAX_STRING_SIZE] = { 0 };
       av_ts_make_string(buf1, pkt->dts);
       char buf3[AV_TS_MAX_STRING_SIZE] = { 0 };
       av_ts_make_string(buf1, pkt->duration);

       char buf4[AV_TS_MAX_STRING_SIZE] = { 0 };
       av_ts_make_time_string(buf1, pkt->pts, time_base);
       char buf5[AV_TS_MAX_STRING_SIZE] = { 0 };
       av_ts_make_time_string(buf1, pkt->dts, time_base);
       char buf6[AV_TS_MAX_STRING_SIZE] = { 0 };
       av_ts_make_time_string(buf1, pkt->duration, time_base);

       printf("pts:%s pts_time:%s dts:%s dts_time:%s duration:%s duration_time:%s stream_index:%d\n",
           buf1, buf4,
           buf2, buf5,
           buf3, buf6,
           pkt->stream_index);

    }


    int main(int argc, char **argv)
    {
       AVOutputFormat *ofmt = NULL;
       AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;
       AVPacket pkt;
       AVFrame *pFrame = NULL;
       AVFrame *pFrameRGB = NULL;
       int frameFinished = 0;
       pFrame = av_frame_alloc();
       pFrameRGB = av_frame_alloc();

       const char *in_filename, *out_filename;
       int ret, i;
       in_filename = "../../TestClips/Audio Video Sync Test.mp4";
       out_filename = "out.mp4";

       // Initialize FFMPEG
       av_register_all();
       // Get input file format context
       if ((ret = avformat_open_input(&amp;ifmt_ctx, in_filename, 0, 0)) &lt; 0)
       {
           fprintf(stderr, "Could not open input file '%s'", in_filename);
           goto end;
       }
       // Extract streams description
       if ((ret = avformat_find_stream_info(ifmt_ctx, 0)) &lt; 0)
       {
           fprintf(stderr, "Failed to retrieve input stream information");
           goto end;
       }
       // Print detailed information about the input or output format,
       // such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base.
       av_dump_format(ifmt_ctx, 0, in_filename, 0);

       // Allocate an AVFormatContext for an output format.
       avformat_alloc_output_context2(&amp;ofmt_ctx, NULL, NULL, out_filename);
       if (!ofmt_ctx)
       {
           fprintf(stderr, "Could not create output context\n");
           ret = AVERROR_UNKNOWN;
           goto end;
       }

       // The output container format.
       ofmt = ofmt_ctx->oformat;

       // Allocating output streams
       for (i = 0; i &lt; ifmt_ctx->nb_streams; i++)
       {
           AVStream *in_stream = ifmt_ctx->streams[i];
           AVStream *out_stream = avformat_new_stream(ofmt_ctx, in_stream->codec->codec);
           if (!out_stream)
           {
               fprintf(stderr, "Failed allocating output stream\n");
               ret = AVERROR_UNKNOWN;
               goto end;
           }
           ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
           if (ret &lt; 0)
           {
               fprintf(stderr, "Failed to copy context from input to output stream codec context\n");
               goto end;
           }
           out_stream->codec->codec_tag = 0;
           if (ofmt_ctx->oformat->flags &amp; AVFMT_GLOBALHEADER)
           {
               out_stream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
           }
       }

       // Show output format info
       av_dump_format(ofmt_ctx, 0, out_filename, 1);

       // Open output file
       if (!(ofmt->flags &amp; AVFMT_NOFILE))
       {
           ret = avio_open(&amp;ofmt_ctx->pb, out_filename, AVIO_FLAG_WRITE);
           if (ret &lt; 0)
           {
               fprintf(stderr, "Could not open output file '%s'", out_filename);
               goto end;
           }
       }
       // Write output file header
       ret = avformat_write_header(ofmt_ctx, NULL);
       if (ret &lt; 0)
       {
           fprintf(stderr, "Error occurred when opening output file\n");
           goto end;
       }

       // Search for input video codec info
       AVCodec *in_codec = nullptr;
       AVCodecContext* avctx = nullptr;

       int video_stream_index = -1;
       for (int i = 0; i &lt; ifmt_ctx->nb_streams; i++)
       {
           if (ifmt_ctx->streams[i]->codec->coder_type == AVMEDIA_TYPE_VIDEO)
           {
               video_stream_index = i;
               avctx = ifmt_ctx->streams[i]->codec;
               in_codec = avcodec_find_decoder(avctx->codec_id);
               if (!in_codec)
               {
                   fprintf(stderr, "in codec not found\n");
                   exit(1);
               }
               break;
           }
       }

       // Search for output video codec info
       AVCodec *out_codec = nullptr;
       AVCodecContext* o_avctx = nullptr;

       int o_video_stream_index = -1;
       for (int i = 0; i &lt; ofmt_ctx->nb_streams; i++)
       {
           if (ofmt_ctx->streams[i]->codec->coder_type == AVMEDIA_TYPE_VIDEO)
           {
               o_video_stream_index = i;
               o_avctx = ofmt_ctx->streams[i]->codec;
               out_codec = avcodec_find_encoder(o_avctx->codec_id);
               if (!out_codec)
               {
                   fprintf(stderr, "out codec not found\n");
                   exit(1);
               }
               break;
           }
       }

       // openCV pixel format
       AVPixelFormat pFormat = AV_PIX_FMT_RGB24;
       // Data size
       int numBytes = avpicture_get_size(pFormat, avctx->width, avctx->height);
       // allocate buffer
       uint8_t *buffer = (uint8_t *)av_malloc(numBytes * sizeof(uint8_t));
       // fill frame structure
       avpicture_fill((AVPicture *)pFrameRGB, buffer, pFormat, avctx->width, avctx->height);
       // frame area
       int y_size = avctx->width * avctx->height;
       // Open input codec
       avcodec_open2(avctx, in_codec, NULL);
       // Main loop
       while (1)
       {
           AVStream *in_stream, *out_stream;
           ret = av_read_frame(ifmt_ctx, &amp;pkt);
           if (ret &lt; 0)
           {
               break;
           }
           in_stream = ifmt_ctx->streams[pkt.stream_index];
           out_stream = ofmt_ctx->streams[pkt.stream_index];
           log_packet(ifmt_ctx, &amp;pkt, "in");
           // copy packet
           pkt.pts = av_rescale_q_rnd(pkt.pts, in_stream->time_base, out_stream->time_base, AVRounding(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
           pkt.dts = av_rescale_q_rnd(pkt.dts, in_stream->time_base, out_stream->time_base, AVRounding(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
           pkt.duration = av_rescale_q(pkt.duration, in_stream->time_base, out_stream->time_base);
           pkt.pos = -1;

           log_packet(ofmt_ctx, &amp;pkt, "out");
           if (pkt.stream_index == video_stream_index)
           {
               avcodec_decode_video2(avctx, pFrame, &amp;frameFinished, &amp;pkt);
               if (frameFinished)
               {
                   struct SwsContext *img_convert_ctx;
                   img_convert_ctx = sws_getCachedContext(NULL,
                       avctx->width,
                       avctx->height,
                       avctx->pix_fmt,
                       avctx->width,
                       avctx->height,
                       AV_PIX_FMT_BGR24,
                       SWS_BICUBIC,
                       NULL,
                       NULL,
                       NULL);
                   sws_scale(img_convert_ctx,
                       ((AVPicture*)pFrame)->data,
                       ((AVPicture*)pFrame)->linesize,
                       0,
                       avctx->height,
                       ((AVPicture *)pFrameRGB)->data,
                       ((AVPicture *)pFrameRGB)->linesize);

                   sws_freeContext(img_convert_ctx);

                   // Do some image processing
                   cv::Mat img(pFrame->height, pFrame->width, CV_8UC3, pFrameRGB->data[0],false);
                   cv::GaussianBlur(img,img,Size(5,5),3);
                   cv::imshow("Display", img);
                   cv::waitKey(5);
                   // --------------------------------
                   // Transform back to initial format
                   // --------------------------------
                   img_convert_ctx = sws_getCachedContext(NULL,
                       avctx->width,
                       avctx->height,
                       AV_PIX_FMT_BGR24,
                       avctx->width,
                       avctx->height,
                       avctx->pix_fmt,
                       SWS_BICUBIC,
                       NULL,
                       NULL,
                       NULL);
                   sws_scale(img_convert_ctx,
                       ((AVPicture*)pFrameRGB)->data,
                       ((AVPicture*)pFrameRGB)->linesize,
                       0,
                       avctx->height,
                       ((AVPicture *)pFrame)->data,
                       ((AVPicture *)pFrame)->linesize);
                       // --------------------------------------------
                       // Something must be here
                       // --------------------------------------------
                       //
                       // Write fideo frame (How to write frame to output stream ?)
                       //
                       // --------------------------------------------
                        sws_freeContext(img_convert_ctx);
               }

           }
           else // write sound frame
           {
               ret = av_interleaved_write_frame(ofmt_ctx, &amp;pkt);
           }
           if (ret &lt; 0)
           {
               fprintf(stderr, "Error muxing packet\n");
               break;
           }
           // Decrease packet ref counter
           av_packet_unref(&amp;pkt);
       }
       av_write_trailer(ofmt_ctx);
    end:
       avformat_close_input(&amp;ifmt_ctx);
       // close output
       if (ofmt_ctx &amp;&amp; !(ofmt->flags &amp; AVFMT_NOFILE))
       {
           avio_closep(&amp;ofmt_ctx->pb);
       }
       avformat_free_context(ofmt_ctx);
       if (ret &lt; 0 &amp;&amp; ret != AVERROR_EOF)
       {
           char buf_err[AV_ERROR_MAX_STRING_SIZE] = { 0 };
           av_make_error_string(buf_err, AV_ERROR_MAX_STRING_SIZE, ret);
           fprintf(stderr, "Error occurred: %s\n", buf_err);
           return 1;
       }

       avcodec_close(avctx);
       av_free(pFrame);
       av_free(pFrameRGB);

       return 0;
    }