Recherche avancée

Médias (91)

Autres articles (40)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

Sur d’autres sites (4561)

  • How to trim video in Android after camera capture ?

    2 juillet 2017, par Sathwik Gangisetty

    I have an app that captures images and videos. I’m able to implement cropping picture, but I cannot implement trimming video. I tried using mp4parser and ffmpeg but I cannot make it work. Can anyone suggest any tutorial to do it or please have a look at my mainActivity.java code and suggest me what to do ? I even tried K4LvideoTrimmer but couldn’t make it work as GitHub documentation is not clear.

    Here is my MainActivity.java file.

    package com.example.sathwik.uploadtrail1;

    import java.io.File;
    import java.io.IOException;
    import java.io.InputStream;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.util.Locale;
    import android.app.Activity;
    import android.content.Context;
    import android.content.DialogInterface;
    import android.content.Intent;
    import android.content.SharedPreferences;
    import android.content.pm.PackageManager;
    import android.database.Cursor;
    import android.graphics.Color;
    import android.graphics.drawable.ColorDrawable;
    import android.net.Uri;
    import android.os.Bundle;
    import android.os.Environment;
    import android.provider.MediaStore;
    import android.support.annotation.NonNull;
    import android.support.v7.app.AppCompatActivity;
    import android.util.Log;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.view.View;
    import android.widget.Button;
    import android.widget.Toast;

    import com.yalantis.ucrop.UCrop;

    import life.knowledge4.videotrimmer.K4LVideoTrimmer;

    import static android.R.attr.path;

    public class MainActivity extends AppCompatActivity {
       // LogCat tag
       private static final String TAG = MainActivity.class.getSimpleName();
       // Camera activity request codes
       private static final int CAMERA_CAPTURE_IMAGE_REQUEST_CODE = 100;
       private static final int CAMERA_CAPTURE_VIDEO_REQUEST_CODE = 200;
       public static final int MEDIA_TYPE_IMAGE = 1;
       public static final int MEDIA_TYPE_VIDEO = 2;
       final int PIC_CROP = 3;
       final int VIDEO_TRIM = 4;
       private File outputFile = null;
      // public static final int REQUEST_CROP = UCrop.REQUEST_CROP;

       private Uri fileUri; // file url to store image/video
      // private Uri fileUriCrop;
       private Button btnCapturePicture, btnRecordVideo;

       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_main);

           // Changing action bar background color

           //getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor(getResources().getString(R.color.action_bar))));
           btnCapturePicture = (Button) findViewById(R.id.btnCapturePicture);
           btnRecordVideo = (Button) findViewById(R.id.btnRecordVideo);

           /**
           * Capture image button click event
           */
           btnCapturePicture.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {

               captureImage();
            }
           });
           /**
             Record video button click event
            */
           btnRecordVideo.setOnClickListener(new View.OnClickListener() {
               @Override
               public void onClick(View v) {
               // record video
               recordVideo();
               }
               });
           // Checking camera availability
           if (!isDeviceSupportCamera()) {
           Toast.makeText(getApplicationContext(),
           "Sorry! Your device doesn't support camera",
           Toast.LENGTH_LONG).show();
           // will close the app if the device does't have camera
           finish();
           }
           }
       /**
         checking device has camera hardware or not
          */
       private boolean isDeviceSupportCamera() {
       if (getApplicationContext().getPackageManager().hasSystemFeature(
       PackageManager.FEATURE_CAMERA)) {
       // this device has a camera
       return true;
       } else {
       // no camera on this device
       return false;
       }
       }
       /**
             * Launching camera app to capture image
             */
       private void captureImage() {
           Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
           fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
           intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
           // start the image capture Intent
           startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);

       }


       /**
             * Launching camera app to record video
             */
       private void recordVideo() {
           Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
           fileUri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO);
           // set video quality
           intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
           intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);// set the image file
           // name
           // start the video capture Intent
           startActivityForResult(intent, CAMERA_CAPTURE_VIDEO_REQUEST_CODE);
       }

      /* *//** Perform UCrop *//*
       public void performUcrop(){
           UCrop.of(fileUri, fileUri).start(this);

       }*/
       private void performcrop(){
          // UCrop.of(fileUri, fileUri).start(this);
           Intent cropIntent = new Intent("com.android.camera.action.CROP");
           cropIntent.setDataAndType(fileUri, "image/*");

           cropIntent.putExtra("crop", "true");

           cropIntent.putExtra("aspectX", 1);
           cropIntent.putExtra("aspectY", 1);

           cropIntent.putExtra("outputX", 256);
           cropIntent.putExtra("outputY", 256);
           cropIntent.putExtra("return-data", true);
           //cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(outputFile));
           startActivityForResult(cropIntent, PIC_CROP);

       }



       /**
                 * Here we store the file url as it will be null after returning from camera
                 * app
                 */
           @Override
           protected void onSaveInstanceState(Bundle outState) {
               super.onSaveInstanceState(outState);
               // save file url in bundle as it will be null on screen orientation
               // changes
               outState.putParcelable("file_uri", fileUri);
           }
           @Override
           protected void onRestoreInstanceState (@NonNull Bundle savedInstanceState){
               super.onRestoreInstanceState(savedInstanceState);
               // get the file url
               fileUri = savedInstanceState.getParcelable("file_uri");
           }
           /**
                 * Receiving activity result method will be called after closing the camera
                 * */
           @Override
           protected void onActivityResult ( int requestCode, int resultCode, Intent data){
               // if the result is capturing Image
               if (requestCode == CAMERA_CAPTURE_IMAGE_REQUEST_CODE) {
                   if (resultCode == RESULT_OK) {
                       // successfully captured the image
                       //Log.d("ucrop", "error log" + fileUri);
                      // performUcrop();
                       //final Uri fileUri = UCrop.getOutput(data);
                       //fileUri = data.getData();
                       performcrop();

                       // launching upload activity

                   } else if (resultCode == RESULT_CANCELED) {
                       // user cancelled Image capture
                       Toast.makeText(getApplicationContext(),
                               "Sorry! Failed to capture image", Toast.LENGTH_SHORT).show();
                   }
               } else if (requestCode == CAMERA_CAPTURE_VIDEO_REQUEST_CODE) {
                   if (resultCode == RESULT_OK) {
                       // video successfully recorded
                       //launching upload activity
                       //videotrim();
                       launchUploadActivity(false);
                   } else if (resultCode == RESULT_CANCELED) {
                       // user cancelled recording
                       Toast.makeText(getApplicationContext(), "Sorry! Failed to record video", Toast.LENGTH_SHORT).show();
                   }
               }

               else if (requestCode == PIC_CROP) {
                   if (resultCode == RESULT_OK) {
                       //fileUri = Uri.fromFile(outputFile);
                       launchUploadActivity(true);
                   }
               }

               }
       private void launchUploadActivity(boolean isImage){
           Intent i = new Intent(MainActivity.this, UploadActivity.class);
           i.putExtra("filePath", fileUri.getPath());
           i.putExtra("isImage", isImage);
           startActivity(i);
       }

       /**
             * Creating file uri to store image/video
             */
       public Uri getOutputMediaFileUri(int type) {
       return Uri.fromFile(getOutputMediaFile(type));
       }

       /**
             * returning image / video
             */
       private static File getOutputMediaFile(int type) {

           // External sdcard location
           File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),
                   Config.IMAGE_DIRECTORY_NAME);

           // Create the storage directory if it does not exist
           if (!mediaStorageDir.exists()) {
               if (!mediaStorageDir.mkdirs()) {
                   Log.d(TAG, "Oops! Failed create "+ Config.IMAGE_DIRECTORY_NAME + " directory");
                   return null;
               }
           }
           // Create a media file name
           String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss",Locale.getDefault()).format(new Date());
           File mediaFile;
           if (type == MEDIA_TYPE_IMAGE) {
               mediaFile = new File(mediaStorageDir.getPath() + File.separator+ "IMG_" + timeStamp + ".jpg");
           } else if (type == MEDIA_TYPE_VIDEO) {
               mediaFile = new File(mediaStorageDir.getPath() + File.separator+ "VID_" + timeStamp + ".mp4");
           } else {
               return null;
           }
           return mediaFile;
       }

       //Logout function
       private void logout(){
           //Creating an alert dialog to confirm logout
           android.support.v7.app.AlertDialog.Builder alertDialogBuilder = new android.support.v7.app.AlertDialog.Builder(this);
           alertDialogBuilder.setMessage("Are you sure you want to logout?");
           alertDialogBuilder.setPositiveButton("Yes",
                   new DialogInterface.OnClickListener() {
                       @Override
                       public void onClick(DialogInterface arg0, int arg1) {

                           //Getting out sharedpreferences
                           SharedPreferences preferences = getSharedPreferences(Config.SHARED_PREF_NAME, Context.MODE_PRIVATE);
                           //Getting editor
                           SharedPreferences.Editor editor = preferences.edit();

                           //Puting the value false for loggedin
                           editor.putBoolean(Config.LOGGEDIN_SHARED_PREF, false);

                           //Putting blank value to email
                           editor.putString(Config.EMAIL_SHARED_PREF, "");

                           //Saving the sharedpreferences
                           editor.commit();

                           //Starting login activity
                           Intent intent = new Intent(MainActivity.this, LoginActivity.class);
                           startActivity(intent);
                       }
                   });

           alertDialogBuilder.setNegativeButton("No",
                   new DialogInterface.OnClickListener() {
                       @Override
                       public void onClick(DialogInterface arg0, int arg1) {

                       }
                   });

           //Showing the alert dialog
           android.support.v7.app.AlertDialog alertDialog = alertDialogBuilder.create();
           alertDialog.show();

       }

       @Override
       public boolean onCreateOptionsMenu(Menu menu) {
           getMenuInflater().inflate(R.menu.main, menu);
           return true;
       }

       @Override
       public boolean onOptionsItemSelected(MenuItem item) {
           int id = item.getItemId();
           if (id == R.id.menuLogout) {
               logout();
           }
           return super.onOptionsItemSelected(item);
       }

    }
  • Evolution #3961 (Fermé) : ne choisir qu’un seul document quand on fait "changer" un fichier

    19 juin 2017, par b b

    Super, merci, on ferme :)

  • Faster FFMPEG conversion from WMV

    5 mai 2022, par Thomas

    I'm converting a lot of WMV files to MP4.

    



    The command is :

    



    ffmpeg -loglevel 0 -y -i source.wmv destination.mp4


    



    I have roughly 100gb to convert. 24 hours later it's still not done (xeon, 64gb, super fast storage)

    



    Am I missing something out ? is there a better way to convert ?