Recherche avancée

Médias (0)

Mot : - Tags -/serveur

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

Autres articles (30)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • MediaSPIP Player : problèmes potentiels

    22 février 2011, par

    Le lecteur ne fonctionne pas sur Internet Explorer
    Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
    Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)

  • MediaSPIP Player : les contrôles

    26 mai 2010, par

    Les contrôles à la souris du lecteur
    En plus des actions au click sur les boutons visibles de l’interface du lecteur, il est également possible d’effectuer d’autres actions grâce à la souris : Click : en cliquant sur la vidéo ou sur le logo du son, celui ci se mettra en lecture ou en pause en fonction de son état actuel ; Molette (roulement) : en plaçant la souris sur l’espace utilisé par le média (hover), la molette de la souris n’exerce plus l’effet habituel de scroll de la page, mais diminue ou (...)

Sur d’autres sites (5806)

  • ffmpeg - dump_format() function print out 00:00:00

    16 juin 2013, par Juneyoung Oh

    I am working with ffmpeg.

    The only function that I needed is just extract duration of video on memory, not console.

    to do this, I realized that I have to redesign dump_format() function

    witch defined in avformat.h.

    below is the original source and especially what I need is dump_format

    that located in line 3063.

    http://ffmpeg.org/doxygen/0.6/libavformat_2utils_8c-source.html#l03063

    when I use dump_format, it returns everything fine but except duration.

    duration always returns 00:00:00.

    below is my test code. When I call line 31 is fine, but not 32.

    I want know what is wrong with my code.

    I suspect the fact that I dropped function dump_metadata.

    But everytime I use that function console prints undefined function error.

     1 #include <libavcodec></libavcodec>avcodec.h>
     2 #include <libavformat></libavformat>avformat.h>
     3 #include
     4 #include
     5 #include
     6
     7 void dump_format1(AVFormatContext* ic, int index, const char* url, int is_output);
     8
     9 int main(int argc, char *argv[]) {
    10         AVFormatContext* pFormatCtx;
    11         int secs;
    12         //need those for printing...
    13
    14         if(argc &lt; 2) {
    15                 printf("Please provide a movie file\n");
    16                 return -1;
    17         }
    18         //threat Exception for arguements.
    19
    20         av_register_all();
    21         //register all codecs
    22
    23         //========== Check Context
    24         if(av_open_input_file(&amp;pFormatCtx, argv[1], NULL, 0, NULL) != 0)
    25                 return -1;
    26
    27         if(av_find_stream_info(pFormatCtx) &lt; 0)
    28                 return -1;
    29
    30         //========== Print Basic Information
    31         //dump_format(pFormatCtx, 0 , argv[1], 0);
    32         dump_format1(pFormatCtx, 0 , argv[1], 0);
    33
    34
    35         if(pFormatCtx->duration != AV_NOPTS_VALUE){
    36                 secs = (pFormatCtx->duration) / AV_TIME_BASE;
    37         }
    38
    39         /*
    40                 AV_TIME_BASE = 1000000
    41         */
    42
    43         printf("%d\n",secs);
    44
    45         return 0;
    46 }
    47
    48 void dump_format1(AVFormatContext *ic,
    49                   int index,
    50                   const char *url,
    51                   int is_output) {
    52
    53         int i;
    54         uint8_t *printed = av_mallocz(ic->nb_streams);
    55         if (ic->nb_streams &amp;&amp; !printed)
    56                 return;
    57
    58         av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s &#39;%s&#39;:\n",
    59         is_output ? "Output" : "Input",
    60         index,
    61         is_output ? ic->oformat->name : ic->iformat->name,
    62         is_output ? "to" : "from", url);
    63
    64         dump_metadata(NULL, ic->metadata, "  ");
    65
    66         //if (!is_output) {
    67         av_log(NULL, AV_LOG_INFO, "  Duration: ");
    68
    69
    70
    71
    72         int hours, mins, secs, us;
    73         secs = ic->duration / AV_TIME_BASE;
    74         us = ic->duration % AV_TIME_BASE;
    75         mins = secs / 60;
    76         secs %= 60;
    77         hours = mins / 60;
    78         mins %= 60;
    79         av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs,
    80         (100 * us) / AV_TIME_BASE);
    81         return;
    82 }

    I compile with following commands.

    gcc -o tutorial01 tutorial01.c -lavformat -lavcodec -lswscale -lz
    ./tutorial01 /home/juneyoungoh/Videos/CON1234ID.ts

    Thanks for your guidences in advance.

  • FFMpeg\Exception\RuntimeException Encoding failed - Laravel 4 PHP-FFMPEG

    10 avril 2014, par Woogygun

    I'm using PHP-FFMPEG and the latest version of FFPMEG this is the same for my localhost and production server. Im encoding a .wav file(1.5 meg 44.1khz) to .mp3 128k bit rate.

    On localhost it runs without issues but, on the production server it gives the following error.

    FFMpeg \ Exception \ RuntimeException
    Encoding failed

    My binaries are located in the public folder right now for dev purposes.

    My code is as follows :

       Route::get(&#39;/audio&#39;, function() {
    $ffmpeg = FFMpeg\FFMpeg::create([
                                    &#39;ffmpeg.binaries&#39; => &#39;ffmpeg&#39;,
                                    &#39;ffprobe.binaries&#39; => &#39;ffprobe&#39;,
                                    &#39;timeout&#39;          => 3600]);
    $audio = $ffmpeg->open(public_path(&#39;track.wav&#39;));
    $format = new FFMpeg\Format\Audio\Mp3();
    $format->on(&#39;progress&#39;, function ($audio, $format, $percentage) {
       echo "$percentage % transcoded";
    });
    $format-> setAudioKiloBitrate(128);

    $audio->save($format, &#39;track.mp3&#39;);

    }) ;

    I can also confirm that FFMPEG is running via shell access :

    myuser@mydomain.com [~/public_html/hidden/public]# ffmpeg -i track.wav file.mp3
    FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
    built on Jan 29 2012 23:55:02 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
    configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --
    mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags=&#39;-O2 -g -
    pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-
    size=4 -m64 -mtune=generic -fPIC&#39; --enable-avfilter --enable-avfilter-lavf --enable-
    libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-
    libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --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
    [wav @ 0x8434b0]max_analyze_duration reached
    [wav @ 0x8434b0]Estimating duration from bitrate, this may be inaccurate
    Input #0, wav, from &#39;track.wav&#39;:
    Duration: 00:00:08.98, bitrate: 1411 kb/s
    Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
    Output #0, mp3, to &#39;file.mp3&#39;:
    Metadata:
    TSSE            : Lavf52.64.2
    Stream #0.0: Audio: libmp3lame, 44100 Hz, 2 channels, s16, 64 kb/s
    Stream mapping:
    Stream #0.0 -> #0.0
    Press [q] to stop encoding
    size=      70kB time=9.01 bitrate=  64.0kbits/s    
    video:0kB audio:70kB global headers:0kB muxing overhead 0.045772%
  • libx264 Input picture width (640) is greater than stride (0)

    16 août 2021, par GiuTor

    I'm trying to encode a series of Cairo surfaces by using libav. Here I initialize AV stuff :

    &#xA;

    AVStream* video_stream;&#xA;    AVCodec* vcodec;&#xA;    gint ret;&#xA;  &#xA;    /* Setup video container */&#xA;    avformat_alloc_output_context2(&amp;img->video_format_context, NULL, NULL, filename);&#xA;    if (img->video_format_context == NULL)&#xA;    {&#xA;        img_message(img, TRUE, _("Failed to find a suitable container for %s\n"),filename);&#xA;        return FALSE;&#xA;    }&#xA;    ret = avio_open(&amp;img->video_format_context->pb, filename, AVIO_FLAG_WRITE);&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        img_message(img, TRUE, _("Couldn&#x27;t write output file %s\n"),filename);&#xA;        return FALSE;&#xA;    }&#xA;    /* Setup video codec */&#xA;    vcodec = avcodec_find_encoder(codec_id);&#xA;    if (!vcodec)&#xA;    {&#xA;        img_message(img, TRUE, _("Couldn&#x27;t find any encoder for %s\n"),filename);&#xA;        return FALSE;&#xA;    }&#xA;    /* Create video stream */&#xA;    video_stream = avformat_new_stream(img->video_format_context, vcodec);&#xA;    video_stream->id = 0;&#xA;    if (! video_stream)&#xA;    {&#xA;        img_message(img, TRUE, _("Couldn&#x27;t not allocate video stream\n"));&#xA;        return FALSE;&#xA;    }&#xA;    /* Allocate video encoding context */&#xA;    img->codec_context = avcodec_alloc_context3(vcodec);&#xA;    if (! img->codec_context)&#xA;    {&#xA;        img_message(img, TRUE, _("Couldn&#x27;t allocate video enconding context\n"));&#xA;        return FALSE;&#xA;    }&#xA;    /* Setup video enconding context parameters */&#xA;    img->codec_context->codec_id = codec_id;&#xA;    img->codec_context->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    img->codec_context->width  = img->video_size[0];&#xA;    img->codec_context->height = img->video_size[1];&#xA;    img->codec_context->sample_aspect_ratio = (struct AVRational) {1, 1};&#xA;    img->codec_context->pix_fmt = vcodec->pix_fmts[0];&#xA;    img->codec_context->framerate = av_d2q(frame_rate, INT_MAX);&#xA;&#xA;    if (codec_id == AV_CODEC_ID_VP8 || codec_id == AV_CODEC_ID_VP9 || codec_id == AV_CODEC_ID_THEORA || codec_id == AV_CODEC_ID_FLV1 ||&#xA;        AV_CODEC_ID_MPEG1VIDEO || codec_id == AV_CODEC_ID_MPEG2VIDEO)&#xA;        img->codec_context->bit_rate = round(bitrate_crf * 1000000);&#xA;&#xA;    img->codec_context->time_base = av_inv_q(img->codec_context->framerate);&#xA;    video_stream->time_base = img->codec_context->time_base;&#xA;&#xA;    if (img->video_format_context->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;        img->codec_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;&#xA;    /* Some codecs require the CRF value */&#xA;    if (codec_id == AV_CODEC_ID_H264 || codec_id == AV_CODEC_ID_H265)&#xA;    {&#xA;        gchar *crf = g_strdup_printf("%i", bitrate_crf);&#xA;        av_opt_set(img->codec_context->priv_data, "crf", crf, AV_OPT_SEARCH_CHILDREN);&#xA;        g_free(crf);&#xA;    }&#xA;    /* Set exporting stage to be multithreaded */&#xA;    AVDictionary* opts = NULL;&#xA;    av_dict_set(&amp;opts, "threads", "auto", 0);&#xA;&#xA;    /* Open video encoder */&#xA;    ret = avcodec_open2(img->codec_context, vcodec, &amp;opts);&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        img_message(img, TRUE, _("Failed to open the video encoder\n"));&#xA;        return FALSE;&#xA;    }&#xA;    /* Copy video encoder parameters to output stream */&#xA;    ret = avcodec_parameters_from_context(video_stream->codecpar, img->codec_context);&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        img_message(img, TRUE, _("Failed to copy video encoder parameters to output stream\n"));&#xA;        return FALSE;&#xA;    }&#xA;    &#xA;    /* AVFRAME stuff */&#xA;    img->video_frame = av_frame_alloc();&#xA;    img->video_frame->format = AV_PIX_FMT_RGBA;&#xA;    img->video_frame->width  = img->video_size[0];&#xA;    img->video_frame->height = img->video_size[1];&#xA;&#xA;    av_frame_make_writable(img->video_frame);&#xA;    &#xA;    ret = av_frame_get_buffer(img->video_frame, 1);&#xA;    if (ret &lt; 0)&#xA;        img_message(img,TRUE, _("Could not allocate the video frame data\n"));&#xA;    img->video_packet = av_packet_alloc();&#xA;

    &#xA;

    And here I called repeatedly (the function is called somewehere else) av_send_frame() but it throws the error in the subject :

    &#xA;

    gint    width, height, stride, row, col, offset;&#xA;    uint8_t  *pix;&#xA;&#xA;    /* Image info and pixel data */&#xA;    width  = cairo_image_surface_get_width( surface );&#xA;    height = cairo_image_surface_get_height( surface );&#xA;    stride = cairo_image_surface_get_stride( surface );&#xA;    pix    = cairo_image_surface_get_data( surface );&#xA;&#xA;    for( row = 0; row &lt; height; row&#x2B;&#x2B; )&#xA;    {&#xA;        for( col = 0; col &lt; width; col&#x2B;&#x2B; )&#xA;        {&#xA;            offset = 3 * col &#x2B; row * img->video_frame->linesize[0];&#xA;            img->video_frame->data[0][offset &#x2B; 0] = pix[0];&#xA;            img->video_frame->data[0][offset &#x2B; 1] = pix[1];&#xA;            img->video_frame->data[0][offset &#x2B; 2] = pix[2];&#xA;        }&#xA;    }&#xA;    img_export_encode_av_frame(img->video_frame, img->video_format_context, img->codec_context, img->video_packet);&#xA;    return TRUE;&#xA;}&#xA;&#xA;void img_export_encode_av_frame(AVFrame *frame, AVFormatContext *fmt, AVCodecContext *ctx, AVPacket *pkt)&#xA;{&#xA;     gint ret;&#xA;    &#xA;    /* send the frame to the encoder */&#xA;    ret = avcodec_send_frame(ctx, frame);&#xA;    if (ret &lt; 0)&#xA;        g_print("Error sending a frame for encoding\n");&#xA;&#xA;    while (ret >= 0)&#xA;    {&#xA;        ret = avcodec_receive_packet(ctx, pkt);&#xA;        if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)&#xA;            return;&#xA;        else if (ret &lt; 0)&#xA;            g_print("Error during encoding\n");&#xA;            &#xA;        av_interleaved_write_frame(fmt, pkt);&#xA;        av_packet_unref(pkt);&#xA;    }&#xA;}&#xA;

    &#xA;

    I googled here also but with no luck. It seems I'm the only one to encode a cairo surface. Grepping the error message in ffmpeg sources didn't help. How do I set the stride ? I read ffmpeg does it for me once I allocate the buffer for the frame but in my case it seems it doesn't. Where am I wrong ?

    &#xA;