Recherche avancée

Médias (91)

Autres articles (76)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

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

Sur d’autres sites (11946)

  • Revision 36454 : uniformiser les inputs du formulaire de login

    19 mars 2010, par brunobergot@… — Log

    uniformiser les inputs du formulaire de login

  • When i used ffmpeg to trim a video ,i observed an error [closed]

    6 mars 2020, par israfilll

    i wanna use ffmpeg to trim a video but when i build app i see this I/System.out : ssssCANNOT LINK EXECUTABLE "/data/user/0/com.example.newapplication/files/ffmpeg" : "/data/data/com.example.newapplication/files/ffmpeg" has text relocations (https://android.googlesource.com/platform/bionic/+/master/androg-’changes-for-ndk-developers.md#Text-Relocations-Enforced-for-API-level-23)

    why didn’t i use this library

    public class MainActivity extends AppCompatActivity {
    String outPutFile;
    Uri filePath, filePathSecond, photoUri, AudioUri;
    ProgressDialog progressDialog;
    private int REQUEST_TAKE_GALLERY_VIDEO = 110;
    private int REQUEST_TAKE_GALLERY_VIDEO_2 = 115;
    private FFmpeg ffmpeg;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);
       if(ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
               != PackageManager.PERMISSION_GRANTED){
           ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},1);


       }
       progressDialog = new ProgressDialog(this);
       findViewById(R.id.selectVideo).setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               Intent intent = new Intent();
               intent.setType("video/*");
               intent.setAction(Intent.ACTION_GET_CONTENT);
               startActivityForResult(Intent.createChooser(intent, "Select Video"), REQUEST_TAKE_GALLERY_VIDEO);
           }
       });
       findViewById(R.id.start).setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               if (filePath != null) {
                   executeCutVideoCommand(1000, 4 * 1000, filePath);
               }
           }
       });



       findViewById(R.id.marge_video).setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               if (filePath != null && filePathSecond != null)
                   executeMargeVideoCommand(filePath, filePathSecond);
           }
       });
       findViewById(R.id.selectVideo_2).setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               Intent intent = new Intent();
               intent.setType("video/*");
               intent.setAction(Intent.ACTION_GET_CONTENT);
               startActivityForResult(Intent.createChooser(intent, "Select Video"), REQUEST_TAKE_GALLERY_VIDEO_2);
           }
       });

       findViewById(R.id.filter_video).setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               if(filePath!=null){
                   executeFilterCommand(filePath);
               }
           }
       });
       loadFFMpegBinary();
    }


    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
       super.onActivityResult(requestCode, resultCode, data);
       if (requestCode == REQUEST_TAKE_GALLERY_VIDEO) {
           Uri uri = data.getData();
           if (uri != null) {
               filePath = uri;
           }
       }
       if (requestCode == REQUEST_TAKE_GALLERY_VIDEO_2) {
           Uri uri = data.getData();
           if (uri != null) {
               filePathSecond = uri;
           }
       }


    }



    // video trim
    private void executeCutVideoCommand(int startMs, int endMs, Uri filePath) {
       File moviesDir = Environment.getExternalStoragePublicDirectory(
               Environment.DIRECTORY_MOVIES
       );
       String filePrefix = "cut_video";
       String fileExtn = ".mp4";
       String yourRealPath = getPath(MainActivity.this, filePath);
       File dest = new File(moviesDir, filePrefix + fileExtn);
       int fileNo = 0;
       while (dest.exists()) {
           fileNo++;
           dest = new File(moviesDir, filePrefix + fileNo + fileExtn);
       }
      /* Log.d(TAG, "startTrim: src: " + yourRealPath);
       Log.d(TAG, "startTrim: dest: " + dest.getAbsolutePath());
       Log.d(TAG, "startTrim: startMs: " + startMs);
       Log.d(TAG, "startTrim: endMs: " + endMs);*/
       outPutFile = dest.getAbsolutePath();
       //String[] complexCommand = {"-i", yourRealPath, "-ss", "" + startMs / 1000, "-t", "" + endMs / 1000, dest.getAbsolutePath()};
       String[] complexCommand = {"-ss",
               "" + (startMs / 1000),
               "-y",
               "-i",
               yourRealPath,
               "-t",
               "" + ((endMs - startMs) / 1000),
               "-vcodec",
               "mpeg4",
               "-b:v",
               "2097152",
               "-b:a",
               "48000",
               "-ac",
               "2",
               "-ar",
               "22050",
               outPutFile};
       execFFmpegBinary(complexCommand);
    }

    private String getPath(final Context context, final Uri uri) {
       final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
       // DocumentProvider
       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
           if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
               // ExternalStorageProvider
               if (isExternalStorageDocument(uri)) {
                   final String docId = DocumentsContract.getDocumentId(uri);
                   final String[] split = docId.split(":");
                   final String type = split[0];
                   if ("primary".equalsIgnoreCase(type)) {
                       return Environment.getExternalStorageDirectory() + "/" + split[1];
                   }
                   // TODO handle non-primary volumes
               }
               // DownloadsProvider
               else if (isDownloadsDocument(uri)) {
                   final String id = DocumentsContract.getDocumentId(uri);
                   final Uri contentUri = ContentUris.withAppendedId(
                           Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
                   return getDataColumn(context, contentUri, null, null);
               }
               // MediaProvider
               else if (isMediaDocument(uri)) {
                   final String docId = DocumentsContract.getDocumentId(uri);
                   final String[] split = docId.split(":");
                   final String type = split[0];
                   Uri contentUri = null;
                   if ("image".equals(type)) {
                       contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
                   } else if ("video".equals(type)) {
                       contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
                   } else if ("audio".equals(type)) {
                       contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
                   }
                   final String selection = "_id=?";
                   final String[] selectionArgs = new String[]{
                           split[1]
                   };
                   return getDataColumn(context, contentUri, selection, selectionArgs);
               }
           }
           // MediaStore (and general)
           else if ("content".equalsIgnoreCase(uri.getScheme())) {
               return getDataColumn(context, uri, null, null);
           }
           // File
           else if ("file".equalsIgnoreCase(uri.getScheme())) {
               return uri.getPath();
           }
       }
       return null;
    }

    private boolean isExternalStorageDocument(Uri uri) {
       return "com.android.externalstorage.documents".equals(uri.getAuthority());
    }

    /**
    * @param uri The Uri to check.
    * @return Whether the Uri authority is DownloadsProvider.
    */
    private boolean isDownloadsDocument(Uri uri) {
       return "com.android.providers.downloads.documents".equals(uri.getAuthority());
    }

    /**
    * @param uri The Uri to check.
    * @return Whether the Uri authority is MediaProvider.
    */
    private boolean isMediaDocument(Uri uri) {
       return "com.android.providers.media.documents".equals(uri.getAuthority());
    }

    private String getDataColumn(Context context, Uri uri, String selection,
                                String[] selectionArgs) {
       Cursor cursor = null;
       final String column = "_data";
       final String[] projection = {
               column
       };
       try {
           cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
                   null);
           if (cursor != null && cursor.moveToFirst()) {
               final int column_index = cursor.getColumnIndexOrThrow(column);
               return cursor.getString(column_index);
           }
       } finally {
           if (cursor != null)
               cursor.close();
       }
       return null;
    }

    private void loadFFMpegBinary() {
       try {
           if (ffmpeg == null) {
               ffmpeg = FFmpeg.getInstance(this);
           }
           ffmpeg.loadBinary(new LoadBinaryResponseHandler() {
               @Override
               public void onFailure() {
               }

               @Override
               public void onSuccess() {
               }
           });
       } catch (FFmpegNotSupportedException e) {
       } catch (Exception e) {
       }
    }

    private void execFFmpegBinary(final String[] command) {
       progressDialog.show();
       try {
           ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {
               @Override
               public void onFailure(String s) {


                   System.out.println("ssss"+s);
               }

               @Override
               public void onSuccess(String s) {
                   //    Log.d(TAG, "SUCCESS with output : " + s);
                   Toast.makeText(MainActivity.this, "SUCCESS" + outPutFile, Toast.LENGTH_LONG).show();
               }

               @Override
               public void onProgress(String s) {
               }

               @Override
               public void onStart() {
                   progressDialog.setMessage("Processing...");
                   progressDialog.show();
               }

               @Override
               public void onFinish() {
                   progressDialog.dismiss();
               }
           });
       } catch (Exception e ) {
           Toast.makeText(MainActivity.this, "EXCEPTION", Toast.LENGTH_LONG).show();

           // do nothing for now
       }
    }


    private void executeMargeVideoCommand(Uri filePath, Uri filePathSecond) {
       File moviesDir = Environment.getExternalStoragePublicDirectory(
               Environment.DIRECTORY_MOVIES
       );
       String filePrefix = "marge_change_video";
       String fileExtn = ".mp4";
       String yourRealPath = getPath(MainActivity.this, filePath);
       String yourRealPath2 = getPath(MainActivity.this, filePathSecond);
       File dest = new File(moviesDir, filePrefix + fileExtn);
       int fileNo = 0;
       while (dest.exists()) {
           fileNo++;
           dest = new File(moviesDir, filePrefix + fileNo + fileExtn);
       }

       outPutFile = dest.getAbsolutePath();
       String complexCommand[] = {"-y", "-i", yourRealPath, "-i", yourRealPath2, "-strict", "experimental", "-filter_complex",
               "[0:v]scale=iw*min(1920/iw\\,1080/ih):ih*min(1920/iw\\,1080/ih), pad=1920:1080:(1920-iw*min(1920/iw\\,1080/ih))/2:(1080-ih*min(1920/iw\\,1080/ih))/2,setsar=1:1[v0];[1:v] scale=iw*min(1920/iw\\,1080/ih):ih*min(1920/iw\\,1080/ih), pad=1920:1080:(1920-iw*min(1920/iw\\,1080/ih))/2:(1080-ih*min(1920/iw\\,1080/ih))/2,setsar=1:1[v1];[v0][0:a][v1][1:a] concat=n=2:v=1:a=1",
               "-ab", "48000", "-ac", "2", "-ar", "22050", "-s", "1920x1080", "-vcodec", "libx264", "-crf", "27",
               "-q", "4", "-preset", "ultrafast", outPutFile};
       execFFmpegBinary(complexCommand);
    }


    private void executeFilterCommand(Uri filePath) {
       File moviesDir = Environment.getExternalStoragePublicDirectory(
               Environment.DIRECTORY_MOVIES
       );
       String filePrefix = "filter_change_video";
       String fileExtn = ".mp4";
       String yourRealPath = getPath(MainActivity.this, filePath);
       File dest = new File(moviesDir, filePrefix + fileExtn);
       int fileNo = 0;
       while (dest.exists()) {
           fileNo++;
           dest = new File(moviesDir, filePrefix + fileNo + fileExtn);
       }

       outPutFile = dest.getAbsolutePath();
       //  String complexCommand[] = {"-i", yourRealPath,"-r", "15", "-aspect" ,""+w+":"+""+h ,"-strict" ,"-2",outPutFile};
       String complexCommand[] = { "-i",yourRealPath,"-vf", "split [main][tmp]; [tmp] lutyuv=","y=val*5"," [tmp2]; [main][tmp2] overlay", outPutFile};
       execFFmpegBinary(complexCommand);
    }

    }

  • Anomalie #4831 (Nouveau) : URLs arbo non mise à jour au changement de rubrique

    23 juin 2021, par Julien Tessier

    Etapes pour reproduire :

    • Utiliser les URL arbos
    • Créer un article "Lorem ipsum" dans la rubrique 1
    • Publier l’article, son URL est /rubrique-1/lorem-ipsum
    • Créer un article "Lorem ipsum" dans la rubrique 2
    • Proposer l’article à la publication, son URL est /rubrique-2/lorem-ipsum
    • Déplacer l’article dans la rubrique 1
    • SPIP génère une erreur dans les logs :
      2021-06-23 11:32:54 127.0.0.1 (pid 498) :Pri:ERREUR : Erreur 1062 de mysql : Duplicate entry ’1-lorem-ipsum’ for key ’PRIMARY’
      in .../plugins-dist/urls_etendues/action/editer_url.php L155 [sql_insertq(),url_insert(),declarer_url_arbo(),_generer_url_arbo(),urls_arbo_dist(),generer_url_entite(),html_af5c93b1e9d12543df40c819344ffc73(),public_parametrer_dist(),public_produire_page_dist(),inclure_page(),evaluer_fond(),recuperer_fond(),urls_afficher_fiche_objet(),minipipe(),execute_pipeline_afficher_fiche_objet(),pipeline(),f_afficher_blocs_ecrire(),f_recuperer_fond(),minipipe(),execute_pipeline_recuperer_fond(),pipeline(),recuperer_fond(),traiter_appels_inclusions_ajax()]
      
    • Publier l’article
    • L’URL du nouvel article est inchangée donc il est inaccessible (= son URL a déjà été "prise" par un autre)

    Comportement attendu

    Au changement de rubrique, URL arbos regénère une URL unique (avec l’ID donc).

    Résolution temporaire

    J’ai réglé ça de la manière suivante, via un plugin et la pipeline post_edition :

    1. <span class="CodeRay"><span class="keyword">function</span> <span class="function">plugin_post_edition</span>(<span class="local-variable">$e</span>) {
    2.     <span class="keyword">switch</span> (objet_type(<span class="local-variable">$e</span>[<span class="string"><span class="delimiter">'</span><span class="content">args</span><span class="delimiter">'</span></span>][<span class="string"><span class="delimiter">'</span><span class="content">table</span><span class="delimiter">'</span></span>])) {
    3.         <span class="keyword">case</span> <span class="string"><span class="delimiter">'</span><span class="content">article</span><span class="delimiter">'</span></span>;
    4.             <span class="keyword">if</span> (!<span class="predefined">empty</span>(<span class="local-variable">$e</span>[<span class="string"><span class="delimiter">'</span><span class="content">data</span><span class="delimiter">'</span></span>][<span class="string"><span class="delimiter">'</span><span class="content">id_rubrique</span><span class="delimiter">'</span></span>])) {
    5.                 <span class="local-variable">$id_rubrique</span> = <span class="predefined">intval</span>(<span class="local-variable">$e</span>[<span class="string"><span class="delimiter">'</span><span class="content">data</span><span class="delimiter">'</span></span>][<span class="string"><span class="delimiter">'</span><span class="content">id_rubrique</span><span class="delimiter">'</span></span>]);
    6.                 <span class="local-variable">$id_article</span> = <span class="predefined">intval</span>(<span class="local-variable">$e</span>[<span class="string"><span class="delimiter">'</span><span class="content">args</span><span class="delimiter">'</span></span>][<span class="string"><span class="delimiter">'</span><span class="content">id_objet</span><span class="delimiter">'</span></span>]);
    7.                 <span class="keyword">if</span> (<span class="local-variable">$url</span> = sql_fetsel(<span class="string"><span class="delimiter">'</span><span class="content">url</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">spip_urls</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">type = 'article' AND id_objet = </span><span class="local-variable">$id_article</span><span class="delimiter">"</span></span>, <span class="string"><span class="delimiter">'</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">perma DESC, date DESC</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">1</span><span class="delimiter">'</span></span>)) {
    8.                     <span class="local-variable">$url</span> = <span class="local-variable">$url</span>[<span class="string"><span class="delimiter">'</span><span class="content">url</span><span class="delimiter">'</span></span>];
    9.                     <span class="keyword">if</span> (sql_countsel(<span class="string"><span class="delimiter">'</span><span class="content">spip_urls</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">url = </span><span class="delimiter">"</span></span>.sql_quote(<span class="local-variable">$url</span>).<span class="string"><span class="delimiter">"</span><span class="content"> AND type = 'article' AND id_parent = </span><span class="local-variable">$id_rubrique</span><span class="content"> AND id_objet != </span><span class="local-variable">$id_article</span><span class="delimiter">"</span></span>)) {
    10.                         sql_delete(<span class="string"><span class="delimiter">'</span><span class="content">spip_urls</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">type = 'article' AND id_objet = </span><span class="local-variable">$id_article</span><span class="content"> AND url = </span><span class="delimiter">"</span></span>.sql_quote(<span class="local-variable">$url</span>));
    11.                     }
    12.                 }
    13.             }
    14.             <span class="keyword">break</span>;
    15.         <span class="keyword">default</span>:
    16.             <span class="keyword">break</span>;
    17.     }
    18.     <span class="keyword">return</span> <span class="local-variable">$e</span>;
    19. }
    20. </span>

    Télécharger

    Ce n’est peut être pas élégant mais ça marche en attendant un fix :)