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 (43)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

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

  • My media converter app crashes when handling file names with spaces

    24 mars 2014, par suffa

    I wrote an app that uses ffmpeg to convert media files (.wav, .avi, .mp3, ... etc.). It works only with file names that have no spaces. When a file name with spaces is encountered, the app immediately closes. Can someone tell me if the string I'm using to call ffmpeg is correct, or need some characters escaped ? Below is a fragment of the code :

    ...
    ...
    ...

    #Select Media
    os.chdir("c:\\d-Converter\\ffmpeg\\bin")
    wrkdir = os.getcwd()
    filelist = os.listdir(wrkdir)
    self.formats1 = []

    for filename in filelist:
       (head, filename) = os.path.split(filename)
       if filename.endswith(".avi") or filename.endswith(".mp4") or filename.endswith(".flv") or filename.endswith(".mov") or filename.endswith(".mpeg4") or filename.endswith(".mpeg") or filename.endswith(".mpg2") or filename.endswith(".wav") or filename.endswith(".mp3"):
               self.formats1.append(filename)
       self.format_combo1=wx.ComboBox(panel, size=(140, -1),value='Select Media', choices=self.formats1, style=wx.CB_DROPDOWN, pos=(300,50))

       self.Bind(wx.EVT_COMBOBOX, self.fileFormats, self.format_combo1)


    ...
    ...
    ...


    def fileFormats(self, e):
       myFormats = {'audio': ('Select Format','.mp3', '.ogg', '.wav', '.wma'), 'video': ('Select Format','.flv','.mpg', '.mp4', '.mpeg')}
       bad_file = ['Media not supported']
       myFile = self.format_combo1.GetValue()
       f_exten = (x for x in myFormats['audio'] + myFormats['video'] if myFile.endswith(x))
       extension = f_exten.next()

       if extension in myFormats['audio']:
           self.format_combo2.SetItems(myFormats['audio'])

       elif extension in myFormats['video']:
           self.format_combo2.SetItems(myFormats['video'])
       else:
           self.format_combo2.SetItems(bad_file)
    ...
    ...
    ...


    def convertButton(self, e):

       unit1 = self.format_combo1.GetValue()
       if unit1:
           unit1 = self.repl_Wspace(unit1)

       #Media Formats
       unit2 = self.format_combo2.GetValue()
       unit3 = self.format_combo3.GetValue()
       unit4 = None
       unit5 = self.format_combo5.GetValue()
       bitRate = self.format_combo6.GetValue()
       unit6 = bitRate
       if unit3 == '-qmax':
           unit4 = self.format_combo4.GetValue()
       else:
           pass

       os.chdir("c:\\d-Converter\\ffmpeg\\bin")
       wrkdir = os.getcwd()

       newfile = unit1
       stripped = newfile.strip('mpeg3aviovfl4w2c.') #Strips the extension from the original file name


       progname='c:\\d-Converter\\ffmpeg\\bin\\ffmpeg.exe' + ' -i '

       preset1_a='-vn -ar 44100 -ac 2 -ab'
       preset1_b='-f mp3 '
       preset_mp3='.mp3'

       chck_unit1 = self.my_endswith(unit1)



       while True:    
           if unit5 == 'video to mp3':

               if unit6 == 'k/bs' or unit6 == '':
                   amsg = wx.MessageDialog(None, 'You must select a bit rate.', 'Media Converter', wx.ICON_INFORMATION)
                   amsg.ShowModal()
                   amsg.Destroy()
                   break

               elif unit5 == 'video to mp3' and unit6 != 'k/bs' or unit6 != '':
                   self.button.Disable()
                   self.button2.Enable()
                   self.format_combo1.Disable()
                   self.format_combo2.Disable()
                   self.format_combo3.Disable()
                   self.format_combo4.Disable()
                   self.format_combo5.Disable()
                   self.format_combo6.Disable()
                   startWorker(self.LongTaskDone, self.LongTask3, wargs=(progname, wrkdir, unit1, preset1_a, unit6, preset1_b, stripped, preset_mp3))
                   break
               elif unit1 != unit1.endswith(".mpg") or unit1.endswith(".mpeg") or unit1.endswith(".avi") or unit1.endswith(".mp4") or unit1.endswith(".flv"):
                   bmsg = wx.MessageDialog(None, 'You must select a valid format to convert to .mp3.', 'Media Converter', wx.ICON_INFORMATION)
                   bmsg.ShowModal()
                   bmsg.Destroy()
                   break

           else:
               pass



           if unit1 == 'Select Media' or unit1 == '':
               amsg = wx.MessageDialog(None, 'You must select a media file!', 'Media Converter', wx.ICON_INFORMATION)
               amsg.ShowModal()
               amsg.Destroy()
               break


           elif unit2 == 'Select Format' or unit2 == '' or unit2 == chck_unit1:
               amsg = wx.MessageDialog(None, 'You must select a valid format', 'Media Converter', wx.ICON_INFORMATION)
               amsg.ShowModal()
               amsg.Destroy()
               break


           elif unit3 == 'Select Quality' or unit3 == '':
               amsg = wx.MessageDialog(None, 'You must select quality', 'Media Converter', wx.ICON_INFORMATION)
               amsg.ShowModal()
               amsg.Destroy()
               break

           elif unit3 != 'Select Quality' or unit3 != '':
               self.format_combo5.Disable()

               if unit3 == '-qmax':
                   if unit4 == '0' or unit4 == '':
                       amsg = wx.MessageDialog(None, 'You must select number between 1-8.', 'Media Converter', wx.ICON_INFORMATION)
                       amsg.ShowModal()
                       amsg.Destroy()
                       break
                   else:
                       self.button.Disable()
                       self.button2.Enable()
                       self.format_combo1.Disable()
                       self.format_combo2.Disable()
                       self.format_combo3.Disable()
                       self.format_combo4.Disable()
                       self.format_combo5.Disable()
                       startWorker(self.LongTaskDone, self.LongTask2, wargs=(progname,wrkdir,unit1,unit3,unit4,stripped,unit2))
                       break
               elif unit3 == '-sameq':
                   self.button.Disable()
                   self.button2.Enable()
                   self.format_combo1.Disable()
                   self.format_combo2.Disable()
                   self.format_combo3.Disable()
                   self.format_combo4.Disable()
                   self.format_combo5.Disable()
                   startWorker(self.LongTaskDone, self.LongTask, wargs=(progname,wrkdir,unit1,unit3,stripped,unit2))
                   break  




    def LongTask(self, progname, wrkdir, unit1, unit3, stripped, unit2):
       convert_file1 = progname + wrkdir + '\\' + unit1 + ' ' + unit3 + ' ' + stripped + unit2
       self.statusbar.SetStatusText("Converting: " + unit1 + "...")
       os.system(convert_file1)
       print convert_file1


    def LongTask2(self, progname, wrkdir, unit1, unit3, unit4, stripped, unit2):
       convert_file2 = progname + wrkdir + '\\' + unit1 + ' ' + unit3 + ' ' + unit4 + ' ' + stripped + unit2
       self.statusbar.SetStatusText("Converting: " + unit1 + "...")
       os.system(convert_file2)

    ...
    ...
    ...
  • error with ffmpeg, when trying to upload a video

    14 juillet 2021, par James

    I recently downloaded a script, which is similar to a social network. And all items in this script related to publish, for example. The button to publish images, video and polls are included. However the video upload button has a problem, the host I'm hosting this site doesn't accept ffmpeg conversion, and so far so good because in the script if there isn't you can leave the ffmpeg field (in the adm panel) empty , and I did that, the problem is that when I try to upload a video, I always get an error saying that it was not possible to relazie the operation, I went to take a look at the script to process the video, and found that it uploads because the video goes to the uploads folder, but it doesn't deliver anything to the bank and doesn't even preview the video on the publish page, that is, the ffmpeg code is running even with the host not allowing it, giving an error soon.

    


    I've tried to do everything like deleting the ffmpeg part of the code, trying to change the input names and many other small attempts like changing some name there or here, but the error still persists.

    


    The code is right below, could someone tell me what I can change in this code so that it uploads the normal video ? (this host allows video uploading, but without ffmpeg). And what could be wrong with him ?

    


    I tested it on localhost but everything worked fine

    


    the whole code

    


    <?php 

if (empty($cl['is_logged'])) {
    $data         = array(
        'code'    => 401,
        'data'    => array(),
        'message' => 'Unauthorized Access'
    );
}

else {
    $post_data  = $me['draft_post'];
    $media_type = fetch_or_get($_POST["type"], false);

    if (empty($media_type) || in_array($media_type, array("image", "video")) != true) {
        $data['code']    = 400;
        $data['message'] = "Media file type is missing or invalid";
        $data['data']    = array();
    }

    else {
        if ($media_type == "image") {
            if (not_empty($_FILES['file']) && not_empty($_FILES['file']['tmp_name'])) {
                if (empty($post_data)) {
                    $post_id   = cl_create_orphan_post($me['id'], "image");
                    $post_data = cl_get_orphan_post($post_id);

                    cl_update_user_data($me['id'], array(
                        'last_post' => $post_id
                    ));
                }
                
                if (not_empty($post_data) && $post_data["type"] == "image") {
                    if (empty($post_data['media']) || count($post_data['media']) < 10) {
                        $file_info      =  array(
                            'file'      => $_FILES['file']['tmp_name'],
                            'size'      => $_FILES['file']['size'],
                            'name'      => $_FILES['file']['name'],
                            'type'      => $_FILES['file']['type'],
                            'file_type' => 'image',
                            'folder'    => 'images',
                            'slug'      => 'original',
                            'crop'      => array('width' => 300, 'height' => 300),
                            'allowed'   => 'jpg,png,jpeg,gif'
                        );

                        $file_upload = cl_upload($file_info);

                        if (not_empty($file_upload['filename'])) {
          
                            $img_id      = cl_db_insert(T_PUBMEDIA, array(
                                "pub_id" => $post_data["id"],
                                "type"   => "image",
                                "src"    => $file_upload['filename'],
                                "time"   => time(),
                                "json_data" => json(array(
                                    "image_thumb" => $file_upload['cropped']
                                ),true)
                            ));

                            if (is_posnum($img_id)) {
                                $data['message'] = 'Media file uploaded successfully';
                                $data['code']    = 200;
                                $data['data']    = array(
                                    "media_id"   => $img_id, 
                                    "url"        => cl_get_media($file_upload['cropped']),
                                    "type"       => "Image"
                                );
                            }
                        }
                        else {
                            $data['code']    = 400;
                            $data['message'] = "Something went wrong while saving a uploaded media file. Please check your details and try again";
                            $data['data']    = array();
                        }
                    }
                    else {
                        $data['code']    = 400;
                        $data['message'] = "You cannot attach more than 10 images to a post";
                        $data['data']    = array();
                    }
                }
                else {
                    cl_delete_orphan_posts($me['id']);
                    cl_update_user_data($me['id'],array(
                        'last_post' => 0
                    ));

                    $data['code']    = 500;
                    $data['message'] = "An error occurred while processing your request. Please try again later.";
                    $data['data']    = array();
                }
            }
            else {
                $data['code']    = 500;
                $data['message'] = "Media file is missing or invalid";
                $data['data']    = array();
            }
        }

        else if($media_type == "video") {
            if (not_empty($_FILES['file']) && not_empty($_FILES['file']['tmp_name'])) {
                if (empty($post_data)) {
                    $post_id   = cl_create_orphan_post($me['id'], "video");
                    $post_data = cl_get_orphan_post($post_id);

                    cl_update_user_data($me['id'],array(
                        'last_post' => $post_id
                    ));
                }

                if (not_empty($post_data) && $post_data["type"] == "video") {
                    if (empty($post_data['media'])) {
                        $file_info      =  array(
                            'file'      => $_FILES['file']['tmp_name'],
                            'size'      => $_FILES['file']['size'],
                            'name'      => $_FILES['file']['name'],
                            'type'      => $_FILES['file']['type'],
                            'file_type' => 'video',
                            'folder'    => 'videos',
                            'slug'      => 'original',
                            'allowed'   => 'mp4,mov,3gp,webm',
                        );

                        $file_upload = cl_upload($file_info);
                        $upload_fail = false;
                        $post_id     = $post_data['id'];

                        if (not_empty($file_upload['filename'])) {
                            try {
                                require_once(cl_full_path("core/libs/ffmpeg-php/vendor/autoload.php"));

                                $ffmpeg         = new FFmpeg(cl_full_path($config['ffmpeg_binary']));
                                $thumb_path     = cl_gen_path(array(
                                    "folder"    => "images",
                                    "file_ext"  => "jpeg",
                                    "file_type" => "image",
                                    "slug"      => "poster",
                                ));

                                $ffmpeg->input($file_upload['filename']);
                                $ffmpeg->set('-ss','3');
                                $ffmpeg->set('-vframes','1');
                                $ffmpeg->set('-f','mjpeg');
                                $ffmpeg->output($thumb_path)->ready();
                            } 

                            catch (Exception $e) {
                                $upload_fail = true;
                            }

                            if (empty($upload_fail)) {
                                $vid_id      = cl_db_insert(T_PUBMEDIA, array(
                                    "pub_id" => $post_id,
                                    "type"   => "video",
                                    "src"    => $file_upload['filename'],
                                    "time"   => time(),
                                    "json_data" => json(array(
                                        "poster_thumb" => $thumb_path
                                    ),true)
                                ));

                                if (is_posnum($vid_id)) {
                                    $data['message'] = 'Media file uploaded successfully';
                                    $data['code']    = 200;
                                    $data['data']    = array(
                                        "media_id"   => $vid_id, 
                                        "type"       => "Video",
                                        "source"     => cl_get_media($file_upload['filename']),
                                        "poster"     => cl_get_media($thumb_path),
                                    );
                                }
                            }

                            else {
                                $data['code']    = 400;
                                $data['message'] = "Something went wrong while saving a uploaded media file. Please check your details and try again";
                                $data['data']    = array();
                            }
                        }
                    }
                    else {
                        $data['code']    = 400;
                        $data['message'] = "You cannot attach more than 1 video to a post";
                        $data['data']    = array();
                    }
                }
                else {
                    cl_delete_orphan_posts($me['id']);
                    cl_update_user_data($me['id'], array(
                        'last_post' => 0
                    ));
                }
            }

            else {
                $data['code']    = 500;
                $data['message'] = "Media file is missing or invalid";
                $data['data']    = array();
            }
        }
    }
}


    


    I dosen't made this code so, i dont know nothing about him

    


  • Anomalie #4495 (Nouveau) : migration 3.2.7 vers 3.3.0

    24 mai 2020, par josiane aletto

    test 1-
    j’ai installée en local un site qui était en SPIP 3.2.7 [24473] pour le migrer en SPIP 3.3.0-dev [24578].
    fichier mesoptions.php avec

    1. <span class="CodeRay"><span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_IMG_MAX_HEIGHT</span><span class="delimiter">'</span></span>,<span class="integer">1200</span>); <span class="comment">// largeur en pixels</span>
    2. <span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_IMG_MAX_WIDTH</span><span class="delimiter">'</span></span>, <span class="integer">1024</span>);  <span class="comment">// hauteur en pixels</span>
    3. <span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_IMG_MAX_SIZE</span><span class="delimiter">'</span></span>,  <span class="integer">650</span>);   <span class="comment">// taille en kilo-octets</span>
    4. </span>

    Télécharger


    Des logos de taille superieure a _IMG_MAX_SIZE’, 650 ne sont plus dans IMG Pas non plus dans logo_erreur non plus.
    par exemple rubon3 : 1630 × 648 pixels
    Plugins :
    Adaptive Images 1.9.2 -
    Agenda 3.26.0 -
    API de vérification 1.8.1 - stable
    Centre image 0.10.4 - dev
    Couleur de rubrique 2.3.8
    Facteur 3.6.2 - stable
    Formidable 3.34.3 - stable
    Insérer Modèles 1.3.3 - stable
    Massicot 0.8.1 -
    Mini Calendrier 2.4.1 - stable
    oEmbed 2.0.10 - stable
    Owl Carousel 1.0.18
    Carousel responsive avec support du multi-touch.
    Palette 4.0.7
    pdf.js 0.6.3
    Picto mod avec FontAwesome 2.1.0
    Saisies pour formulaires 3.11.1
    SPIP Bonux 3.4.6
    YAML 2.0.10
    test2
    Pour mieux voir J’ai recommencé installation /migration en désinstallant le plugin massicot et en le supprimant du repertoire plugin et en mettant dans mes_options.php
    define(’_IMG_MAX_HEIGHT’,800) ; // largeur en pixels
    define(’_IMG_MAX_WIDTH’, 500) ; // hauteur en pixels
    define(’_IMG_MAX_SIZE’, 400) ; // taille en kilo-octets

    je constate ; que les logos de taille >400Ko sont présent mais retaillé, rubon3 qui avait 1630 × 648 pixels a maintenant à 500 × 199 pixels 221 ko dans logo/IMG alors qu’il n’ y a pas massicot.
    si je supprime ce rubon3 par logo de la rubrique et télécharge l’image originale j’obtiens une image retaillé avec du noir en plus. mais si je clique dessus l’image est retaillée mais ok et elle est bien en 500*199 dans IMG sans le noir.

    • les images migrées ont bien gardées leurs dimensions*.

    test3
    je telecharge le logo rubon3 de 1630 × 648 pixels comme un document d’un article —> il est enregistré directement en 500 × 199 pixels 221 ko . Ce mécanisme a changé, en mieux, car dans la version 3.2 j’avais un message "Les images doivent obligatoirement faire moins de 650 ko (ce fichier fait 847.5 ko)".