Recherche avancée

Médias (0)

Mot : - Tags -/médias

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

Autres articles (63)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (9435)

  • PHP Create video thumbnail with FFMPEG - returns error code 1

    27 février 2013, par Light

    I am trying to create a video thumbnail with FFMPEG using the following script.
    However I am getting return value of 1. What does it mean ? What is error code 1 ? I have Googled it and didn't find and answer. Thanks.
    Here is the code :

    <?php

           //thumb path should be added in the below code
           //test for thumb
           $dir_img='uploads/';
           $mediapath='thumb.jpg';
           $file_thumb=create_movie_thumb('test.mp4',$mediapath,$mediaid);

           $name_file=explode(".",$mediapath);
           $imgname="thumb_".$name_file[0].".jpg";    

           /*
             Function to create video thumbnail using ffmpeg
           */
           function create_movie_thumb($src_file,$mediapath,$mediaid)
           {

               global $CONFIG, $ERROR;

               $CONFIG['ffmpeg_path'] = '/usr/bin/'; // Change the path according to your server.
               $dir_img='uploads/';
               $CONFIG['fullpath'] = $dir_img."thumbs/";

               $src_file = $src_file;
               $name_file=explode(".",$mediapath);
               $imgname="thumb_".$name_file[0].".jpg";
               $dest_file = $CONFIG['fullpath'].$imgname;

               if (preg_match("#[A-Z]:|\\\\#Ai", __FILE__)) {
                   // get the basedir, remove '/include'
                   $cur_dir = substr(dirname(__FILE__), 0, -8);
                   $src_file = '"' . $cur_dir . '\\' . strtr($src_file, '/', '\\') . '"';
                   $ff_dest_file = '"' . $cur_dir . '\\' . strtr($dest_file, '/', '\\') . '"';
               } else {
                   $src_file = escapeshellarg($src_file);
                   $ff_dest_file = escapeshellarg($dest_file);
               }

               $output = array();

               if (eregi("win",$_ENV['OS'])) {
                   // Command to create video thumb
                   $cmd = "\"".str_replace("\\","/", $CONFIG['ffmpeg_path'])."ffmpeg\" -i ".str_replace("\\","/" ,$src_file )." -an -ss 00:00:05 -r 1 -vframes 1 -y ".str_replace("\\","/" ,$ff_dest_file);
                   exec ("\"$cmd\"", $output, $retval);
                   echo "exec1";

               } else {
                   // Command to create video thumb
                   $cmd = "{$CONFIG['ffmpeg_path']}ffmpeg -i $src_file -an -ss 00:00:05 -r 1 -vframes 1 -y $ff_dest_file";
                   exec ($cmd, $output, $retval);
                   echo "exec2";
               }


               if ($retval) {
                   $ERROR = "Error executing FFmpeg - Return value: $retval";
                   if ($CONFIG['debug_mode']) {
                       // Re-execute the command with the backtick operator in order to get all outputs
                       // will not work if safe mode is enabled
                       $output = `$cmd 2>&1`;
                       $ERROR .= "<br /><br /><div align="\&quot;left\&quot;">Cmd line : <br /><span style="&quot;font-size:120%&quot;">" . nl2br(htmlspecialchars($cmd)) . "</span></div>";
                       $ERROR .= "<br /><br /><div align="\&quot;left\&quot;">The ffmpeg program said:<br /><span style="&quot;font-size:120%&quot;">";
                       $ERROR .= nl2br(htmlspecialchars($output));
                       $ERROR .= "</span></div>";
                   }
                   echo $ERROR;
                   @unlink($dest_file);
                   return false;
               }

               $return = $dest_file;
               //@chmod($return, octdec($CONFIG[&#39;default_file_mode&#39;])); //silence the output in case chmod is disabled
               return $return;
           }
    ?>
  • FFMPEG : sws_scale returns error : Slice parameters 0, 2160 are invalid

    21 janvier 2020, par Matthew Czarnek

    I’m trying to follow a tutorial to display ffmpeg AVFrame output in SDL. The tutorial(and all examples I’m seeing online) are still using ’sws_getContext’, which has been deprecated and removed from the newest version of ffmpeg. Trying to change current pixel format from whatever it currently is to PIX_FMT_YUV420P, so I can display it. I believe I need the sws_scale function to accomplish this.

    However, sws_scale is the function that causes a command line error of :
    Slice parameters 0, 2160 are invalid

    Here is all my code associate with swsContext :

    struct SwsContext* av_sws_ctx = NULL;
    av_sws_ctx = sws_alloc_context();

    sws_init_context(av_sws_ctx, NULL, NULL);

    sws_scale(av_sws_ctx, (uint8_t const* const*)av_frame->data,
                           av_frame->linesize, 0, av_codec_context->height,
                           av_frame->data, av_frame->linesize);

    Further complicating the matter, SwsContext is only defined internal to ffmpeg, externally I can’t set/get any variables or even view them in the debugger.

    int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[] )

    The vales of other parameters, other than av_sws_ctx :

    srcSlice: av_frame->data =
        8 arrays, first is filled with "\x10\x10\x10\x10\x10..."
        second and third are "€€€€€€€€€€€€€€€€€..."
        rest are NULL
    linesize(av_frame->linesize) is an array:
       3840,1920,1920,0,0,0,0,0
    srcSliceY:0
    srcSliceH:2160
    dest: same as second parameter (av_frame->data)
    dstStride: av_frame->linesize again

    If I drill into sws_scale source code, I find that this error is thrown by this chunk of code :

    if ((srcSliceY &amp; (macro_height-1)) ||
           ((srcSliceH&amp; (macro_height-1)) &amp;&amp; srcSliceY + srcSliceH != c->srcH) ||
           srcSliceY + srcSliceH > c->srcH) {
           av_log(c, AV_LOG_ERROR, "Slice parameters %d, %d are invalid\n", srcSliceY, srcSliceH);
           return AVERROR(EINVAL);
       }

    I assume that the issue therefore is that the height of my video is bigger than sws_context(4k video). But can’t figure out how to tell sws_context what it’s height should be using sws_alloc_context or sws_init_context or any other function.

    See something I’m missing ? Thank you.

  • Error -138 returns "Error number -138 occurred"

    29 avril 2016, par bot1131357

    I am trying to create a program that listens for a period of time, and then times out so that it can return to work on other tasks and retry again later. Here is the code I am testing with :

    AVFormatContext *pFormatCtx = NULL;
    AVCodecContext *codecCtx = NULL;
    AVCodec *codec;
    int ret = 0;

    // Register all formats and codecs
    av_register_all();
    avformat_network_init(); // for network streaming

    AVDictionary *d = NULL;           // "create" an empty dictionary
    av_dict_set(&amp;d, "timeout", "5", 0); // add an entry
    av_dict_set(&amp;d, "rtsp_flags", "listen", 0); // add an entry

    char filename[100];
    sprintf_s(filename, sizeof(filename), "%s", "rtsp://127.0.0.1:8554/demo");


    //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    printf_s("Open video file.\n");
    // Open video file
    ret = avformat_open_input(&amp;pFormatCtx, filename, NULL, &amp;d);   // Returns -138 here
    if (ret &lt;0)
    {
       printf_s("Failed: cannot open input.\n");
       av_strerror(ret, errbuf, ERRBUFFLEN);
       fprintf(stderr, "avformat_open_input() fail: %s\n", errbuf);
       continue;
       //return -1; // Couldn't find stream information
    }

    In the listening mode, avformat_open_input() returns -138. Using av_strerror() gives the following explanation : "Error number -138 occurred"

    Is this an Easter egg ? What does -138 stand for ?