Recherche avancée

Médias (1)

Mot : - Tags -/publicité

Autres articles (112)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

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

Sur d’autres sites (5404)

  • FFmpeg "movflags" > "faststart" causes av_write_trailer() to return -2

    30 juin 2016, par williamtroup

    I’m setting up the format layout for the ideo as follows :

    AVOutputFormat* outputFormat = ffmpeg.av_guess_format(null, "output.mp4", null);

    AVCodec* videoCodec = ffmpeg.avcodec_find_encoder(outputFormat->video_codec);

    AVFormatContext* formatContext = ffmpeg.avformat_alloc_context();
    formatContext->oformat = outputFormat;
    formatContext->video_codec_id = videoCodec->id;

    ffmpeg.avformat_new_stream(formatContext, videoCodec);

    This is how I am setting up the Codec Context :

    AVCodecContext* codecContext = ffmpeg.avcodec_alloc_context3(videoCodec);
    codecContext->bit_rate = 400000;
    codecContext->width = 1280;
    codecContext->height = 720;
    codecContext->gop_size = 12;
    codecContext->max_b_frames = 1;
    codecContext->pix_fmt = videoCodec->pix_fmts[0];
    codecContext->codec_id = videoCodec->id;
    codecContext->codec_type = videoCodec->type;
    codecContext->time_base = new AVRational
    {
       num = 1,
       den = 30
    };

    I’m using the following code to setup the "movflags" > "faststart" option for the header of the video :

    AVDictionary* options = null;

    int result = ffmpeg.av_dict_set(&options, "movflags", "faststart", 0);

    int writeHeaderResult = ffmpeg.avformat_write_header(formatContext, &options);

    The file is opened and the header is written as follows :

    if ((formatContext->oformat->flags & ffmpeg.AVFMT_NOFILE) == 0)
    {
       int ioOptionResult = ffmpeg.avio_open(&formatContext->pb, "output.mp4", ffmpeg.AVIO_FLAG_WRITE);
    }

    int writeHeaderResult = ffmpeg.avformat_write_header(formatContext, &options);

    After this, I write each video frame as follows :

    outputFrame->pts = frameIndex;

    packet.flags |= ffmpeg.AV_PKT_FLAG_KEY;
    packet.pts = frameIndex;
    packet.dts = frameIndex;

    int encodedFrame = 0;
    int encodeVideoResult = ffmpeg.avcodec_encode_video2(codecContext, &packet, outputFrame, &encodedFrame);

    if (encodedFrame != 0)
    {
       packet.pts = ffmpeg.av_rescale_q(packet.pts, codecContext->time_base, m_videoStream->time_base);
       packet.dts = ffmpeg.av_rescale_q(packet.dts, codecContext->time_base, m_videoStream->time_base);
       packet.stream_index = m_videoStream->index;

       if (codecContext->coded_frame->key_frame > 0)
       {
           packet.flags |= ffmpeg.AV_PKT_FLAG_KEY;
       }

       int writeFrameResult = ffmpeg.av_interleaved_write_frame(formatContext, &packet);
    }

    After that, I write the trailer :

    int writeTrailerResult = ffmpeg.av_write_trailer(formatContext);

    However, writeTrailerResult is always -2. I’m been looking into this problem for days and cannot figure out what the problem is.

    The DLLs used for the AutoGen library are :

    avcodec-56.dll
    avdevice-56.dll
    avfilter-5.dll
    avformat-56.dll
    avutil-54.dll
    postproc-53.dll
    swresample-1.dll
    swscale-3.dll
  • Webcam streaming from Mac using FFmpeg

    22 juillet 2016, par Galaxy

    I want to stream my webcam from Mac using FFmpeg.

    First I checked the supported devices using ffmpeg -f avfoundation -list_devices true -i ""

    Output :

    [AVFoundation input device @ 0x7fdf1bd03000] AVFoundation video devices:
    [AVFoundation input device @ 0x7fdf1bd03000] [0] USB 2.0 Camera #2
    [AVFoundation input device @ 0x7fdf1bd03000] [1] FaceTime HD Camera
    [AVFoundation input device @ 0x7fdf1bd03000] [2] Capture screen 0
    [AVFoundation input device @ 0x7fdf1bd03000] [3] Capture screen 1
    [AVFoundation input device @ 0x7fdf1bd03000] AVFoundation audio devices:
    [AVFoundation input device @ 0x7fdf1bd03000] [0] Built-in Microphone

    The device[0] is the webcam I want to use.


    Then I tried to capture the webcam using ffmpeg -f avfoundation -i "0" out.mpg

    Output :

    [avfoundation @ 0x7fe7f3810600] Selected framerate (29.970030) is not supported by the device
    [avfoundation @ 0x7fe7f3810600] Supported modes:
    [avfoundation @ 0x7fe7f3810600]   320x240@[120.101366 120.101366]fps
    [avfoundation @ 0x7fe7f3810600]   640x480@[120.101366 120.101366]fps
    [avfoundation @ 0x7fe7f3810600]   800x600@[60.000240 60.000240]fps
    [avfoundation @ 0x7fe7f3810600]   1024x768@[30.000030 30.000030]fps
    [avfoundation @ 0x7fe7f3810600]   1280x720@[60.000240 60.000240]fps
    [avfoundation @ 0x7fe7f3810600]   1280x1024@[30.000030 30.000030]fps
    [avfoundation @ 0x7fe7f3810600]   1920x1080@[30.000030 30.000030]fps
    [avfoundation @ 0x7fe7f3810600]   320x240@[30.000030 30.000030]fps
    [avfoundation @ 0x7fe7f3810600]   640x480@[30.000030 30.000030]fps
    [avfoundation @ 0x7fe7f3810600]   800x600@[20.000000 20.000000]fps
    [avfoundation @ 0x7fe7f3810600]   1024x768@[6.000002 6.000002]fps
    0: Input/output error

    After that, I tried stream this webcam from my Mac using ffmpeg -f avfoundation -framerate 30 -i "0" -f mpeg1video -b 200k -r 30 -vf scale=1920:1080 http://127.0.0.1:8082/

    Output :

    [avfoundation @ 0x7f8515012800] An error occurred: The activeVideoMinFrameDuration passed is not supported by the device.  Use -activeFormat.videoSupportedFrameRateRanges to discover valid ranges.0: Input/output error

    I cannot capture or stream this webcam. However when I used the Facetime camera instead of this webcam, everything was OK. I’ve been searching for this problem for a few days, but still cannot fix it. Does anyone have experience with webcam and FFmpeg on Mac ?

  • Calculate frames to remove to get timelapse of desired length

    12 juin 2016, par Espen Birk

    I’ve got lots of images stored on a server, and a reference in a MySQL database so that i can easily query it for image from specific dates/time.

    Images is taken with an interval of 7 images/hour.

    Lets say i want to create a timelapse from the last 4 days, and make a 5 sec movie. How can i calculate how to evenly drop frames to get to that desired length of 5 seconds ?

    This is what i got so far.

    Total images : 4 Days * 24 hours * 7 images/hour = 672 images
    Required images at 24 fps : 24 * 5 = 120 images

    Divide the total images with the required images to find out which/every frame i need to keep

    672 / 120 = 5.6

    Then i loop trough all 672 images, and every 5th or 6th time i store a reference to the image in an array.

    Here is my problem. If i round up i get a video thats longer than i want, and if i round down i get a video thats shorter.

    If i keep every 5th image when looping : 134 images / 24 fps = 5.6 sec video
    If i keep every 6th image when looping : 112 images / 24 fps = 4.6 sec video

    Is it possible to get it better, and still skip images evenly ?

    Solved this using xxfelixxx’s answer in PHP
    Heres the code in PHP :

    $start  = 1;
    $stop   = 672; // Total Images

    $dur    = 5;   // Video Duration
    $n      = 24 * $dur; // Required frames - 24 FPS * Duration
    $next   = $start;
    $step = ( $stop - $start ) / $n;

    $frames = array();

    for ($i = 1; $i <= $n; $i++) {
       $frames[] = round($next);
       $next += $step;
    };

    var_dump($frames);