Recherche avancée

Médias (91)

Autres articles (111)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

Sur d’autres sites (11984)

  • Create movie programatically with ffmpeg

    16 janvier 2019, par Martin Delille

    I would like to create a movie programatically with ffmpeg.

    Here is my code :

    QString fileName = "test.mov";
    static char errorString[AV_ERROR_MAX_STRING_SIZE];

    printf("Video encoding\n");

    AVOutputFormat *outputFormat = av_guess_format(nullptr, fileName.toStdString().c_str(), nullptr);

    if (outputFormat == nullptr) {
       qDebug() << "Could not find suitable format for" << fileName;
       return false;
    }

    enum AVCodecID codec_id = AV_CODEC_ID_MJPEG;

    qDebug() << "Format Name:" << outputFormat->name;
    qDebug() << "Format Video Codec:" << outputFormat->video_codec;
    outputFormat->video_codec = codec_id;

    /// allocate the output media context, formatContext
    AVFormatContext *formatContext = avformat_alloc_context();
    formatContext->oformat = outputFormat;

    // find the mpeg1 video encoder
    AVCodec *codec = avcodec_find_encoder(codec_id);

    if (!codec) {
       qDebug() << "codec not found";
       return false;
    }

    qDebug() << "Codec name:" << codec->name;

    AVStream *videoStream = avformat_new_stream(formatContext, codec);
    // put sample parameters
    videoStream->codecpar->bit_rate = 400000;
    videoStream->codecpar->width = width;
    videoStream->codecpar->height = height;
    videoStream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
    videoStream->codecpar->format = AV_PIX_FMT_YUVJ422P;
    videoStream->time_base.num = 1;
    videoStream->time_base.den = 25;

    AVCodecContext *codecContext = avcodec_alloc_context3(nullptr);
    codecContext->codec_id = codec_id;
    codecContext->codec_type = AVMEDIA_TYPE_VIDEO;
    codecContext->width = width;
    codecContext->height = height;
    codecContext->time_base.num = 1;
    codecContext->time_base.den = 25;
    codecContext->pix_fmt = AV_PIX_FMT_YUVJ422P;

    if (int error = avcodec_parameters_to_context(codecContext, videoStream->codecpar)) {
       qDebug() << "Error parameting the context:" << av_make_error_string(errorString, AV_ERROR_MAX_STRING_SIZE, error);
       return false;
    }

    // open it
    if (int error = avcodec_open2(codecContext, codec, nullptr)) {
       qDebug() << "Could not open codec:" << av_make_error_string(errorString, AV_ERROR_MAX_STRING_SIZE, error);
       return false;
    }

    // alloc image and output buffer
    AVFrame *frame = av_frame_alloc();
    frame->format = codecContext->pix_fmt;
    frame->width = codecContext->width;
    frame->height = codecContext->height;

    if (int error = av_image_alloc(frame->data, frame->linesize, frame->width, frame->height, static_cast<enum avpixelformat="avpixelformat">(frame->format), 0)) {
       qDebug() &lt;&lt; "Error allocating image data:" &lt;&lt; av_make_error_string(errorString, AV_ERROR_MAX_STRING_SIZE, error);
       return false;
    }

    // Open the output file, if needed
    if (!(outputFormat->flags &amp; AVFMT_NOFILE)) {
       if (avio_open(&amp;formatContext->pb, fileName.toStdString().c_str(), AVIO_FLAG_WRITE) &lt; 0) {
           qDebug() &lt;&lt; "Could not open" &lt;&lt; fileName;
           return false;
       }
    }

    // some formats want stream headers to be separate
    if (formatContext->oformat->flags &amp; AVFMT_GLOBALHEADER) {
       codecContext->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
    }

    if (int error = avformat_write_header(formatContext, nullptr)) {
       qDebug() &lt;&lt; "error writing header:" &lt;&lt; av_make_error_string(errorString, AV_ERROR_MAX_STRING_SIZE, error);
       return false;
    }
    </enum>

    Unfortunately, when I execute it I have the following output :

    Format Name: mov
    Format Video Codec: 27
    Codec name: mjpeg
    [mov @ 0x1048c7000] Could not find tag for codec none in stream #0, codec not currently supported in container
    error writing header: Invalid argument

    What am I doing wrong ?

  • Export sprites/images from movie

    7 octobre 2014, par Dr.Kameleon

    OK, here’s the situation :

    • I have a .mov video, recorded using QuickTime
    • I want to split it into images (which I will use in a js animation)

    JS Code :

    function pad(num, size) {
       var s = num+"";
       while (s.length &lt; size) s = "0" + s;
       return s;
    }


    $(function(){
       var currentIndex = 1;


       setInterval(function(){
          $("#theImage").attr("src","img/video"+pad(currentIndex,3)+".png");
          currentIndex++;
       }, 1000/24);

    });

    So, I tried with FFMpeg :

    ffmpeg -i "video.mov" -f image2 -vf fps=24 video%03d.jpg

    This works. But the quality of the sprites is very low.

    ffmpeg -i "video.mov" -f image2 -vf fps=24 video%03d.png

    This works too. But the quality/size of the sprite is HUGE. I mean every sprite is around 110KB, with a grand total far above the video’s size (100MB > 2MB !)

    What’s going on ?

    How can I achieve that, without losing any quality and still not having too deal with huge filesizes ?

  • Simple example of using ffmpeg to convert a movie into a format that can be viewed on Apple products

    16 janvier 2014, par ensnare

    I have a directory of AVI and MOV movies taken from my digital camera. I'd like to write a Python script to go through them, and for every AVI or MOV it finds, generate a file in place that can be viewed on Apple products (iPad, Apple TV, etc ...). My videos are 1080p, and I'm interested in preserving as much of the original quality as possible.

    Any examples of how to do this with ffmpeg ? Specifically, flags to pass to the executable ? Would I want to do a one or two-pass encoding (what's the difference ?)

    I'm hoping to do the scripting part in Python.