Recherche avancée

Médias (0)

Mot : - Tags -/albums

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

Autres articles (79)

  • 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 ) (...)

  • 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 (7796)

  • Add 2 pictures to video with durations ? [duplicate]

    24 juin 2013, par jesper

    This question already has an answer here :

    I am trying to add 2 different images into a video with ffmpeg.

    image1.jpg should show the first 10 seconds of the movie and youtubeLOL.png should show the next 6 minutes of the video.

    So the command should tell us also to repeat the pictures to get a length for 6 minutes and 10 seconds. How can i do this ? I have tried this :

    (It's not even working)

    passthru("ffmpeg -f image2 -loop 1 -vframes 100 -i /home/psafari/public_html/youtube_images/movie_" . $id . ".jpg -vcodec mpeg4 /home/psafari/public_html/youtube_videos/movie_" . time().".avi");

    Here is output :

    FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers built on Jan 29 2012 17:52:15 with gcc 4.4.5 20110214 (Red Hat 4.4.5-6) 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-avfilter-lavf --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab libavutil 50.15. 1 / 50.15. 1 libavcodec 52.72. 2 / 52.72. 2 libavformat 52.64. 2 / 52.64. 2 libavdevice 52. 2. 0 / 52. 2. 0 libavfilter 1.19. 0 / 1.19. 0 libswscale 0.11. 0 / 0.11. 0 libpostproc 51. 2. 0 / 51. 2. 0

    Invalid value '1' for option 'loop'

    output memcode

    MEncoder SVN-r31628-4.4.6 (C) 2000-2010 MPlayer Team
    get_path("config") problem
    success: format: 0  data: 0x0 - 0x1251b
    libavformat file format detected.
    [lavf] stream 0: video (h264), -vid 0
    VIDEO:  [H264]  540x800  24bpp  25.000 fps  116.3 kbps (14.2 kbyte/s)
    [V] filefmt:44  fourcc:0x34363248  size:540x800  fps:25.000  ftime:=0.0400
    videocodec: framecopy (540x800 24bpp fourcc=34363248)
    Writing header...
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
    Writing header...
    ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
    Pos:   0.0s      1f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.1s      2f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.1s      3f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.2s      4f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.2s      5f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.2s      6f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.3s      7f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.3s      8f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.4s      9f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.4s     10f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.4s     11f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.5s     12f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.5s     13f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.6s     14f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.6s     15f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.6s     16f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.7s     17f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.7s     18f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.8s     19f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.8s     20f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.8s     21f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.9s     22f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   0.9s     23f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   1.0s     24f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
         Pos:   1.0s     25f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
    Pos:   1.0s     26f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [538:0]
    Pos:   1.1s     27f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [518:0]
    Pos:   1.1s     28f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [500:0]
    Pos:   1.2s     29f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [483:0]
    Pos:   1.2s     30f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [467:0]
    Pos:   1.2s     31f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [452:0]
    Pos:   1.3s     32f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [438:0]
    Pos:   1.3s     33f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [425:0]
    Pos:   1.4s     34f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [413:0]
    Pos:   1.4s     35f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [401:0]
    Pos:   1.4s     36f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [390:0]
    Pos:   1.5s     37f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [380:0]
    Pos:   1.5s     38f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [370:0]
    Pos:   1.6s     39f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [360:0]
    Pos:   1.6s     40f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [351:0]
    Pos:   1.6s     41f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [343:0]
    Pos:   1.7s     42f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [335:0]
    Pos:   1.7s     43f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [327:0]
    Pos:   1.8s     44f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [320:0]
    Pos:   1.8s     45f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [313:0]
    Pos:   1.8s     46f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [306:0]
    Pos:   1.9s     47f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [300:0]
    Pos:   1.9s     48f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [294:0]
    Pos:   2.0s     49f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [288:0]
    Pos:   2.0s     50f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [282:0]
    Pos:   2.0s     51f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [277:0]
    Pos:   2.1s     52f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [272:0]
    Pos:   2.1s     53f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [266:0]
    Pos:   2.2s     54f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [262:0]
    Pos:   2.2s     55f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [257:0]
    Pos:   2.2s     56f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [252:0]
    Pos:   2.3s     57f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [248:0]
    Pos:   2.3s     58f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [244:0]
    Pos:   2.4s     59f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [240:0]
    Pos:   2.4s     60f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [236:0]
    Pos:   2.4s     61f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [232:0]
    Pos:   2.5s     62f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [229:0]
    Pos:   2.5s     63f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [225:0]
    Pos:   2.6s     64f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [222:0]
    Pos:   2.6s     65f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [218:0]
    Pos:   2.6s     66f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [215:0]
    Pos:   2.7s     67f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [212:0]
    Pos:   2.7s     68f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [209:0]
    Pos:   2.8s     69f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [206:0]
    Pos:   2.8s     70f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [203:0]
    Pos:   2.8s     71f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [200:0]
    Pos:   2.9s     72f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [197:0]
    Pos:   2.9s     73f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [195:0]
    Pos:   3.0s     74f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [192:0]
    Pos:   3.0s     75f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [190:0]
    Pos:   3.0s     76f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [187:0]
    Pos:   3.1s     77f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [185:0]
    Pos:   3.1s     78f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [183:0]
    Pos:   3.2s     79f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [180:0]
    Pos:   3.2s     80f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [178:0]
    Pos:   3.2s     81f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [176:0]
    Pos:   3.3s     82f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [174:0]
    Pos:   3.3s     83f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [172:0]
    Pos:   3.4s     84f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [170:0]
    Pos:   3.4s     85f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [168:0]
    Pos:   3.4s     86f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [166:0]
    Pos:   3.5s     87f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [164:0]
    Pos:   3.5s     88f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [162:0]
    Pos:   3.6s     89f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [161:0]
    Pos:   3.6s     90f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [159:0]
    Pos:   3.6s     91f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [157:0]
    Pos:   3.7s     92f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [156:0]
    Pos:   3.7s     93f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [154:0]
    Pos:   3.8s     94f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [152:0]
    Pos:   3.8s     95f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [151:0]
    Pos:   3.8s     96f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [149:0]
    Pos:   3.9s     97f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [148:0]
    Pos:   3.9s     98f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [146:0]
    Pos:   4.0s     99f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [145:0]
    Pos:   4.0s    100f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [144:0]
    Pos:   4.0s    101f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [142:0]
    Pos:   4.1s    102f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [141:0]
    Pos:   4.1s    103f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [140:0]
    Pos:   4.2s    104f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [138:0]
    Pos:   4.2s    105f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [137:0]
    Pos:   4.2s    106f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [136:0]
    Pos:   4.3s    107f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [135:0]
    Pos:   4.3s    108f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [133:0]
    Pos:   4.4s    109f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [132:0]
    Pos:   4.4s    110f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [131:0]
    Pos:   4.4s    111f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [130:0]
    Pos:   4.5s    112f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [129:0]
    Pos:   4.5s    113f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [128:0]
    Pos:   4.6s    114f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [127:0]
    Pos:   4.6s    115f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [126:0]
    Pos:   4.6s    116f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [124:0]
    Pos:   4.7s    117f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [123:0]
    Pos:   4.7s    118f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [122:0]
    Pos:   4.8s    119f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [121:0]
    Pos:   4.8s    120f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [120:0]
    Pos:   4.8s    121f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [119:0]
    Pos:   4.9s    122f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [119:0]
    Pos:   4.9s    123f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [118:0]
    Pos:   5.0s    124f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [117:0]
    Pos:   5.0s    125f (100%)  0.00fps Trem:   0min   0mb  A-V:0.000 [116:0]
    success: format: 0  data: 0x0 - 0x9daf8
    libavformat file format detected.
    [lavf] stream 0: video (h264), -vid 0
    VIDEO:  [H264]  640x400  24bpp  25.000 fps   21.8 kbps ( 2.7 kbyte/s)
    [V] filefmt:44  fourcc:0x34363248  size:640x400  fps:25.000  ftime:=0.0400
    videocodec: framecopy (540x800 24bpp fourcc=34363248)
    videocodec: framecopy (640x400 24bpp fourcc=34363248)

    All video files must have identical fps, resolution, and codec for -ovc copy.

    Exiting...
  • Revision b12e060b55 : Add speed feature to disable splitmv Added a speed feature in speed 1 to disabl

    30 juin 2013, par Yunqing Wang

    Changed Paths :
     Modify /vp9/encoder/vp9_onyx_if.c


     Modify /vp9/encoder/vp9_onyx_int.h



    Add speed feature to disable splitmv

    Added a speed feature in speed 1 to disable splitmv for HD (>=720)
    clips. Test result on stdhd set : 0.3% psnr loss and 0.07% ssim
    loss. Encoding speedup is 36%.

    (For reference : The test result on derf set showed 2% psnr loss
    and 1.6% ssim loss. Encoding speedup is 34%. SPLITMV should be
    enabled for small resolution videos.)

    Change-Id : I54f72b94f506c6d404b47c42e71acaa5374d6ee6

  • How to extract elementary video from mp4 using ffmpeg programmatically ?

    4 juillet 2013, par epipav

    I have started learning ffmpeg few weaks ago. At the moment I am able to transcode any video to mp4 using h264/AVC codec. The main scheme is something like that :

    -open input
    - demux
    - decode
    - encode
    - mux

    The actual code is below :

    #include <iostream>
    #include
    extern "C"
    {

    #ifndef __STDC_CONSTANT_MACROS
    #undef main /* Prevents SDL from overriding main() */
    #  define __STDC_CONSTANT_MACROS
    #endif



    #pragma comment (lib,"avcodec.lib")
    #pragma comment (lib,"avformat.lib")
    #pragma comment (lib,"swscale.lib")
    #pragma comment(lib,"avutil.lib")

    #include
    #include
    #include
    #include
    #include <libavutil></libavutil>opt.h>
    #include
    #include
    #include
    #include
    #include

    }


    using namespace std;


    void open_video(AVFormatContext*oc , AVCodec *codec, AVStream * st)
    {
    int ret;
    AVCodecContext *c ;
    c = st->codec;

    /*open codec */

    cout &lt;&lt; "probably starts here" &lt;&lt; endl;
    ret = avcodec_open2(c,codec,NULL);
    cout &lt;&lt; "and ends here" &lt;&lt; endl;

    if ( ret &lt; 0)
    {
       cout &lt;&lt; ("Could not open video codec") &lt;&lt; endl;
    }


    }






    /*This function will add a new stream to our file.
    @param
    oc -> Format context that the new stream will be added.
    codec -> codec of the stream, this will be passed.
    codec_id ->
    chWidth->
    chHeight->
    */

    AVStream * addStream(AVFormatContext * oc, AVCodec **codec, enum AVCodecID codec_id, int chWidth,        int chHeight, int fps)
    {
    AVCodecContext *c;
    AVStream *st;

    //find encoder of the stream, it passes this information to @codec, later on
    //it will be used in encoding the video @ avcodec_encode_video2 in loop.
    *codec = avcodec_find_encoder(AV_CODEC_ID_H264);

    if ( (*codec) == NULL)
       cout &lt;&lt; "ERROR CAN NOT FIND ENCODER! ERROR! ERROR! AVCODEC_FIND_ENCODER FAILED !!!1 """ &lt;&lt; endl;

    if(!(*codec))
       printf ("Could not find encoder for &#39; %s &#39; ", avcodec_get_name(codec_id));


    //create a new stream with the found codec inside oc(AVFormatContext).
    st = avformat_new_stream ( oc, *codec);

    if (!st)
       cout &lt;&lt; " Cannot allocate stream " &lt;&lt; endl;

    //Setting the stream id.
    //Since, there can be other streams in this AVFormatContext,
    //we should find the first non used index. And this is oc->nb_streams(number of streams) - 1
    st ->id = oc ->nb_streams - 1;

    c = st->codec;

    //setting the stream&#39;s codec&#39;s properties.
    c-> codec_id = codec_id;
    c->bit_rate = 4000000;
    c->width = chWidth;
    c->height = chHeight;
    c->time_base.den = fps;
       //fps;
    c->time_base.num = 1;
    c->gop_size = 12;
    c->pix_fmt = AV_PIX_FMT_YUV420P;

    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;
       }

    /* Some formats want stream headers to be separate. */
    if (oc->oformat->flags &amp; AVFMT_GLOBALHEADER)
       c->flags |= CODEC_FLAG_GLOBAL_HEADER;

    //returning our lovely new brand stream.
    return st;


    }

    int changeResolution ( string source, int format )
    {
    //Data members
    struct SwsContext   *sws_ctx = NULL;
    AVFrame             *pFrame = NULL;
    AVFrame             *outFrame = NULL;  
    AVPacket            packet;
    uint8_t             *buffer = NULL;
    uint8_t endcode[] = { 0, 0, 1, 0xb7 };
    AVDictionary        *optionsDict = NULL;
    AVFormatContext     *pFormatCtx = NULL;
    AVFormatContext     *outputContext = NULL;
    AVCodecContext      *pCodecCtx;
    AVCodec             *pCodec ;
    AVCodec             *codec;
    AVCodec             *videoCodec;
    AVOutputFormat      *fmt;
    AVStream            *video_stream;
    int                 changeWidth;
    int                  changeHeight;
    int                 frameFinished;
    int                 numBytes;
    int                 fps;


    int lock = 0;

    //Register all codecs &amp; other important stuff. Vital!..
    av_register_all();


    //Selects the desired resolution.
    if (format == 0)
    {
       changeWidth = 320;
       changeHeight = 180;
    }

    else if (format == 1)
    {
       changeWidth = 640;
       changeHeight = 480;

    }
    else if (format == 2)
    {
       changeWidth = 960;
       changeHeight = 540;

    }
    else if (format == 3)
    {
       changeWidth = 1024;
       changeHeight = 768;

    }
    else
    {
       changeWidth = 1280;
       changeHeight = 720;
    }


    // Open video file
    int aaa;
    aaa = avformat_open_input(&amp;pFormatCtx, source.c_str(), NULL, NULL) ;
    if(aaa !=0)
    {
       cout &lt;&lt; " cannot open input file \n" &lt;&lt; endl;
       cout &lt;&lt; "aaa = " &lt;&lt; aaa  &lt;&lt; endl;
        return -1; // Couldn&#39;t open file  
    }

    // Retrieve stream information
    if(av_find_stream_info(pFormatCtx)&lt;0)
       return -1; // Couldn&#39;t find stream information

    //just checking duration casually for no reason
    /*int64_t duration = pFormatCtx->duration;

    cout &lt;&lt; "the duration is " &lt;&lt; duration &lt;&lt; " " &lt;&lt; endl;*/

    //this writes the info about the file
    av_dump_format(pFormatCtx, 0, 0, 0);
    cin >> lock;

    // Find the first video stream
    int videoStream=-1;
    int i;

    for(i=0; i&lt;3; i++)
        if(pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
         videoStream=i;
         cout &lt;&lt; " lel \n " ;
        break;

    }


    if(videoStream==-1)
       return -1; // Didn&#39;t find a video stream

    // Get a pointer to the codec context for the video stream
    pCodecCtx=pFormatCtx->streams[videoStream]->codec;
    fps = pCodecCtx -> time_base.den;



    //Find the decoder of the input file, for the video stream
    pCodec=avcodec_find_decoder(pCodecCtx->codec_id);

    if(pCodec==NULL) {
       fprintf(stderr, "Unsupported codec!\n");
       return -1; // Codec not found
    }


    // Open codec, you must open it first, in order to use it.
    if(avcodec_open2(pCodecCtx, pCodec, &amp;optionsDict)&lt;0)
    return -1; // Could not open codec


    // Allocate video frame ( pFrame for taking the packets into, outFrame for processed frames to packet.)
    pFrame=avcodec_alloc_frame();
    outFrame = avcodec_alloc_frame();


    i=0;

    int ret;
    int video_frame_count = 0;

    //Initiate the outFrame set the buffer &amp; fill the properties
    numBytes=avpicture_get_size(PIX_FMT_YUV420P, changeWidth, changeHeight);
    buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
       avpicture_fill((AVPicture *)outFrame, buffer, PIX_FMT_YUV420P, changeWidth, changeHeight );  


    int pp;
    int frameNo = 0;

    //allocate the outputContext, it will be the AVFormatContext of our output file.
    //It will try to find the format by giving the file name.
    avformat_alloc_output_context2(&amp;outputContext,NULL,NULL, "myoutput.mp4");

    //Cant find the file extension, using MPEG as default.
    if (!outputContext) {
       printf("Could not deduce output format from file extension: using MPEG.\n");
       avformat_alloc_output_context2(&amp;outputContext, NULL, "mpeg", "myoutput.mp4");
    }

    //Still cant set file extension, exit.
    if (!outputContext) {
       return 1;
    }

    //set AVOutputFormat fmt to our outputContext&#39;s format.
    fmt = outputContext -> oformat;
    video_stream = NULL;

    //If fmt has a valid codec_id, create a new video stream.
    //This function will set the streams codec &amp; codecs desired properties.
    //Stream&#39;s codec will be passed to videoCodec for later usage.
    if (fmt -> video_codec != AV_CODEC_ID_NONE)
       video_stream = addStream(outputContext, &amp;videoCodec, fmt ->video_codec, changeWidth, changeHeight,fps);


    //open the video using videoCodec. by avcodec_open2() i.e open the codec.
    if (video_stream)  
       open_video(outputContext, videoCodec, video_stream);

    //Creating our new output file.
    if (!(fmt->flags &amp; AVFMT_NOFILE)) {
       ret = avio_open(&amp;outputContext->pb, "toBeStreamed.264", AVIO_FLAG_WRITE);
       if (ret &lt; 0) {
           cout &lt;&lt; " cant open file " &lt;&lt; endl;
           return 1;
         }
      }

    //Writing the header of format context.
    //ret = avformat_write_header(outputContext, NULL);

    if (ret >= 0) {
       cout &lt;&lt; "writing header success !!!"  &lt;&lt; endl;
    }


     //Start reading packages from input file.
    while(av_read_frame(pFormatCtx, &amp;packet)>=0  ) {

    // Is this a packet from the video stream?  
    if(packet.stream_index==videoStream) {

    // Decode video package into frames
    ret = avcodec_decode_video2(pCodecCtx, pFrame, &amp;frameFinished, &amp;packet);

    if( ret &lt; 0)
    {
       printf ( " Error decoding frame !!.." );
       return ret;
    }

    if (frameFinished){
       printf("video_frame n:%d    coded_n:%d\n" , video_frame_count++, pFrame->coded_picture_number);
    }

    av_free_packet(&amp;packet);

    //do stuff with frame, in this case we are changing the resolution.
    static struct SwsContext *img_convert_ctx_in = NULL;
    if (img_convert_ctx_in == NULL)
    {
       img_convert_ctx_in =sws_getContext( pCodecCtx->width,
           pCodecCtx->height,
           pCodecCtx->pix_fmt,
           changeWidth,
           changeHeight,
           PIX_FMT_YUV420P,
           SWS_BICUBIC,
           NULL,
           NULL,
           NULL );

    }
    //scale the frames
    sws_scale(img_convert_ctx_in,
       pFrame->data,
       pFrame->linesize,
       0,
       pCodecCtx->height,
       outFrame->data,
       outFrame->linesize);

    //initiate the pts value
    if ( frameNo == 0)
       outFrame->pts = 0;


       //calculate the pts value &amp; set it.
       outFrame->pts += av_rescale_q(1, video_stream->codec->time_base, video_stream->time_base);

       //encode frames into packages. Package passed in @packet.
       if(avcodec_encode_video2(outputContext->streams[0]->codec, &amp;packet, outFrame, &amp;pp) &lt; 0 )
         cout &lt;&lt; "Encoding frames into packages, failed. " &lt;&lt;  endl;

       frameNo++;

       //write the packages into file, resulting in creating a video file.
       av_interleaved_write_frame(outputContext,&amp;packet);


     }

    }



    av_free_packet(&amp;packet);
    //av_write_trailer(outputContext);

    avio_close(outputContext->pb);



    // Free the RGB image
    av_free(buffer);
    av_free(outFrame);

    // Free the YUV frame
    av_free(pFrame);

    // Close the codec
    avcodec_close(video_stream->codec);
    avcodec_close(pCodecCtx);

    // Close the video file
    avformat_close_input(&amp;pFormatCtx);

    return 0;


    }
    </iostream>

    at the end of the process I get my desired file with desired codec & container & resolution.

    My problem is, in a part of our project I need to get elementary video streams IN file. Such as example.264. However I can not add a stream without creating an AVFormatContext. I can not create an AVFormatContext because 264 files does not have a container,they are just raw video ?, as far as I know.

    I have tried the way in decoding_encoding.c which uses fwrite. However that example was for mpeg-2 codec and when I try to adapt that code to H264/AVC codec, I got "floating point division by zero" error from mediainfo and moreover, some of the properties of the video was not showing (such as FPS & playtime & quality factor). I think it has to do with the "endcode" the example adds at the end of the code. It is for mpeg-2. ( uint8_t endcode[] = 0, 0, 1, 0xb7  ; )

    Anyway, I would love to get a startpoint for this task. I have managed to come this far by using internet resources ( quite few & outdated for ffmpeg) but now I'm stuck a little.