Advanced search

Medias (2)

Tag: - Tags -/documentation

Other articles (18)

  • Ajouter notes et légendes aux images

    7 February 2011, by

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • XMP PHP

    13 May 2011, by

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

  • Les formats acceptés

    28 January 2010, by

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

On other websites (4651)

  • Encoding a video in FFmpeg to X264 and have it playable in Quicktime

    7 May 2013, by illu

    I am wondering which command line settings i need to explicitly set (or avoid) to make a video encoded into x264 (in the mp4 format) using ffmpeg by default playable in Quicktime. I find that a number of the predefined preset files work for me but some of them won't, for example I can't get any of the lossless ones to work and I'm interested in those ones as well. For example libx264-lossless_max.ffpreset will encode my video but it's only playable in VLC, not in Quicktime. In Quicktime the video stays black. I know Perian is an option but I want my file to be playable without installing Perian. Thanks for your help.

  • Trouble syncing libavformat/ffmpeg with x264 and RTP

    26 December 2012, by Jacob Peddicord

    I've been working on some streaming software that takes live feeds
    from various kinds of cameras and streams over the network using
    H.264. To accomplish this, I'm using the x264 encoder directly (with
    the "zerolatency" preset) and feeding NALs as they are available to
    libavformat to pack into RTP (ultimately RTSP). Ideally, this
    application should be as real-time as possible. For the most part,
    this has been working well.

    Unfortunately, however, there is some sort of synchronization issue:
    any video playback on clients seems to show a few smooth frames,
    followed by a short pause, then more frames; repeat. Additionally,
    there appears to be approximately a 4-second delay. This happens with
    every video player I've tried: Totem, VLC, and basic gstreamer pipes.

    I've boiled it all down to a somewhat small test case:

    #include
    #include
    #include
    #include
    #include <libavformat></libavformat>avformat.h>
    #include <libswscale></libswscale>swscale.h>

    #define WIDTH       640
    #define HEIGHT      480
    #define FPS         30
    #define BITRATE     400000
    #define RTP_ADDRESS "127.0.0.1"
    #define RTP_PORT    49990

    struct AVFormatContext* avctx;
    struct x264_t* encoder;
    struct SwsContext* imgctx;

    uint8_t test = 0x80;


    void create_sample_picture(x264_picture_t* picture)
    {
       // create a frame to store in
       x264_picture_alloc(picture, X264_CSP_I420, WIDTH, HEIGHT);

       // fake image generation
       // disregard how wrong this is; just writing a quick test
       int strides = WIDTH / 8;
       uint8_t* data = malloc(WIDTH * HEIGHT * 3);
       memset(data, test, WIDTH * HEIGHT * 3);
       test = (test &lt;&lt; 1) | (test >> (8 - 1));

       // scale the image
       sws_scale(imgctx, (const uint8_t* const*) &amp;data, &amp;strides, 0, HEIGHT,
                 picture->img.plane, picture->img.i_stride);
    }

    int encode_frame(x264_picture_t* picture, x264_nal_t** nals)
    {
       // encode a frame
       x264_picture_t pic_out;
       int num_nals;
       int frame_size = x264_encoder_encode(encoder, nals, &amp;num_nals, picture, &amp;pic_out);

       // ignore bad frames
       if (frame_size &lt; 0)
       {
           return frame_size;
       }

       return num_nals;
    }

    void stream_frame(uint8_t* payload, int size)
    {
       // initalize a packet
       AVPacket p;
       av_init_packet(&amp;p);
       p.data = payload;
       p.size = size;
       p.stream_index = 0;
       p.flags = AV_PKT_FLAG_KEY;
       p.pts = AV_NOPTS_VALUE;
       p.dts = AV_NOPTS_VALUE;

       // send it out
       av_interleaved_write_frame(avctx, &amp;p);
    }

    int main(int argc, char* argv[])
    {
       // initalize ffmpeg
       av_register_all();

       // set up image scaler
       // (in-width, in-height, in-format, out-width, out-height, out-format, scaling-method, 0, 0, 0)
       imgctx = sws_getContext(WIDTH, HEIGHT, PIX_FMT_MONOWHITE,
                               WIDTH, HEIGHT, PIX_FMT_YUV420P,
                               SWS_FAST_BILINEAR, NULL, NULL, NULL);

       // set up encoder presets
       x264_param_t param;
       x264_param_default_preset(&amp;param, "ultrafast", "zerolatency");

       param.i_threads = 3;
       param.i_width = WIDTH;
       param.i_height = HEIGHT;
       param.i_fps_num = FPS;
       param.i_fps_den = 1;
       param.i_keyint_max = FPS;
       param.b_intra_refresh = 0;
       param.rc.i_bitrate = BITRATE;
       param.b_repeat_headers = 1; // whether to repeat headers or write just once
       param.b_annexb = 1;         // place start codes (1) or sizes (0)

       // initalize
       x264_param_apply_profile(&amp;param, "high");
       encoder = x264_encoder_open(&amp;param);

       // at this point, x264_encoder_headers can be used, but it has had no effect

       // set up streaming context. a lot of error handling has been ommitted
       // for brevity, but this should be pretty standard.
       avctx = avformat_alloc_context();
       struct AVOutputFormat* fmt = av_guess_format("rtp", NULL, NULL);
       avctx->oformat = fmt;

       snprintf(avctx->filename, sizeof(avctx->filename), "rtp://%s:%d", RTP_ADDRESS, RTP_PORT);
       if (url_fopen(&amp;avctx->pb, avctx->filename, URL_WRONLY) &lt; 0)
       {
           perror("url_fopen failed");
           return 1;
       }
       struct AVStream* stream = av_new_stream(avctx, 1);

       // initalize codec
       AVCodecContext* c = stream->codec;
       c->codec_id = CODEC_ID_H264;
       c->codec_type = AVMEDIA_TYPE_VIDEO;
       c->flags = CODEC_FLAG_GLOBAL_HEADER;
       c->width = WIDTH;
       c->height = HEIGHT;
       c->time_base.den = FPS;
       c->time_base.num = 1;
       c->gop_size = FPS;
       c->bit_rate = BITRATE;
       avctx->flags = AVFMT_FLAG_RTP_HINT;

       // write the header
       av_write_header(avctx);

       // make some frames
       for (int frame = 0; frame &lt; 10000; frame++)
       {
           // create a sample moving frame
           x264_picture_t* pic = (x264_picture_t*) malloc(sizeof(x264_picture_t));
           create_sample_picture(pic);

           // encode the frame
           x264_nal_t* nals;
           int num_nals = encode_frame(pic, &amp;nals);

           if (num_nals &lt; 0)
               printf("invalid frame size: %d\n", num_nals);

           // send out NALs
           for (int i = 0; i &lt; num_nals; i++)
           {
               stream_frame(nals[i].p_payload, nals[i].i_payload);
           }

           // free up resources
           x264_picture_clean(pic);
           free(pic);

           // stream at approx 30 fps
           printf("frame %d\n", frame);
           usleep(33333);
       }

       return 0;
    }

    This test shows black lines on a white background that
    should move smoothly to the left. It has been written for ffmpeg 0.6.5
    but the problem can be reproduced on 0.8 and 0.10 (from what I've tested so far). I've taken some shortcuts in error handling to make this example as short as
    possible while still showing the problem, so please excuse some of the
    nasty code. I should also note that while an SDP is not used here, I
    have tried using that already with similar results. The test can be
    compiled with:

    gcc -g -std=gnu99 streamtest.c -lswscale -lavformat -lx264 -lm -lpthread -o streamtest

    It can be played with gtreamer directly:

    gst-launch udpsrc port=49990 ! application/x-rtp,payload=96,clock-rate=90000 ! rtph264depay ! decodebin ! xvimagesink

    You should immediately notice the stuttering. One common "fix" I've
    seen all over the Internet is to add sync=false to the pipeline:

    gst-launch udpsrc port=49990 ! application/x-rtp,payload=96,clock-rate=90000 ! rtph264depay ! decodebin ! xvimagesink sync=false

    This causes playback to be smooth (and near-realtime), but is a
    non-solution and only works with gstreamer. I'd like to fix the
    problem at the source. I've been able to stream with near-identical
    parameters using raw ffmpeg and haven't had any issues:

    ffmpeg -re -i sample.mp4 -vcodec libx264 -vpre ultrafast -vpre baseline -b 400000 -an -f rtp rtp://127.0.0.1:49990 -an

    So clearly I'm doing something wrong. But what is it?

  • Using ffmpeg to convert flv to mp4 on debian 6 [closed]

    28 March 2013, by user1542610

    I am using ffmpeg on debian version squeeze/sid to convert flv to mp4.I need to view final output on iphone, ipad. I have tried many different combinations but have not succeeded in converting the file properly.

    Information about the sample flv file is as follows - via command ffmpeg -i sample.flv

     FFmpeg version SVN-r0.5.9-4:0.5.9-0ubuntu0.10.04.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
     configuration: --extra-version=4:0.5.9-0ubuntu0.10.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
     libavutil     49.15. 0 / 49.15. 0
     libavcodec    52.20. 1 / 52.20. 1
     libavformat   52.31. 0 / 52.31. 0
     libavdevice   52. 1. 0 / 52. 1. 0
     libavfilter    0. 4. 0 /  0. 4. 0
     libswscale     0. 7. 1 /  0. 7. 1
     libpostproc   51. 2. 0 / 51. 2. 0
     built on Jun 12 2012 16:27:59, gcc: 4.4.3
    Input #0, flv, from &#39;sample.flv&#39;:
     Duration: 00:01:06.90, start: 2.079000, bitrate: N/A
       Stream #0.0: Video: flv, yuv420p, 352x200, 1k tbr, 1k tbn, 1k tbc
       Stream #0.1: Audio: nellymoser, 44100 Hz, mono, s16
    At least one output file must be specified

    when i try using command - ffmpeg -i sample.flv -sameq -ar 22050 sample.mp4

    I get error with following output.

    ffmpeg -i sample.flv -sameq -ar 22050 sample.mp4
    FFmpeg version SVN-r0.5.9-4:0.5.9-0ubuntu0.10.04.1, Copyright (c) 2000-2009 Fabrice Bellard, et al.
     configuration: --extra-version=4:0.5.9-0ubuntu0.10.04.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
     libavutil     49.15. 0 / 49.15. 0
     libavcodec    52.20. 1 / 52.20. 1
     libavformat   52.31. 0 / 52.31. 0
     libavdevice   52. 1. 0 / 52. 1. 0
     libavfilter    0. 4. 0 /  0. 4. 0
     libswscale     0. 7. 1 /  0. 7. 1
     libpostproc   51. 2. 0 / 51. 2. 0
     built on Jun 12 2012 16:27:59, gcc: 4.4.3
    Input #0, flv, from &#39;sample.flv&#39;:
     Duration: 00:01:06.90, start: 2.079000, bitrate: N/A
       Stream #0.0: Video: flv, yuv420p, 352x200, 1k tbr, 1k tbn, 1k tbc
       Stream #0.1: Audio: nellymoser, 44100 Hz, mono, s16
    Output #0, mp4, to &#39;sample.mp4&#39;:
       Stream #0.0: Video: mpeg4, yuv420p, 352x200, q=2-31, 200 kb/s, 90k tbn, 1k tbc
       Stream #0.1: Audio: 0x0000, 22050 Hz, mono, s16, 64 kb/s
    Stream mapping:
     Stream #0.0 -> #0.0
     Stream #0.1 -> #0.1
    Unsupported codec for output stream #0.1

    I am not very conversant with ffmpeg and any help, pointers would highly appreciated.

    Many thanks is advance.