Recherche avancée

Médias (91)

Autres articles (99)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

Sur d’autres sites (13532)

  • 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);
       }

    }
  • Can ffmpeg copy parts from an rmvb file without re-encoding ?

    24 juin 2017, par Eng. M.Hamdy

    I want to fast copy parts from an rmvb file without re-encoding. This command works fine with mp4 files but not with rmbv (I dropped start time and duration here) :

    ffmpeg -i input -c copy output

    when I use it with rmvb like this :

    ffmpeg -i 1.rmvb -c copy 1.mp4

    I get this error :

    [mp4 @ 00bb8980] Could not find tag for codec rv40 in stream #0, codec
    not curre ntly supported in container Could not write header for
    output file #0 (incorrect codec parameters ?) : Invali d argument
    Stream mapping : Stream #0:1 -> #0:0 (copy) Stream #0:0 -> #0:1
    (copy)

    I also tried this :

    ffmpeg -i 1.rmvb -c copy 2.rmvb

    and got this error :

    [NULL @ 04748980] Unable to find a suitable output format for ’2.rmvb’
    2.rmvb : Invalid argument

    I tried this command :

    ffmpeg -i 1.rmvb -c:v copy -c:a aac -strict experimental -b:a 128k 1.mp4

    and got this error :

    [mp4 @ 046e0020] Could not find tag for codec rv40 in stream #0, codec
    not curre ntly supported in container Could not write header for
    output file #0 (incorrect codec parameters ?) : Invali d argument Error
    initializing output stream 0:1 — [aac @ 046e1bc0] Qavg : nan
    Conversion failed !

    I read this topic :
    but the solution does not work for me.. After many trials, this is the command that worked (and took too long time) :

    ffmpeg -i 1.rmvb -c:v libx264 -b:a 32k output.mp4

    But I do not want to re-encode the file. Any solution ?

    Edit :
    I tried :

    ffmpeg -i 1.rmvb -c copy 1.mkv

    ffmpeg version N-86447-gfeb13ae Copyright (c) 2000-2017 the FFmpeg
    developers built with gcc 7.1.0 (GCC) configuration : —enable-gpl
    —enable-version3 —enable-cuda —enable-cuvid —e nable-d3d11va —enable-dxva2 —enable-libmfx —enable-nvenc —enable-avisynth — enable-bzlib —enable-fontconfig —enable-frei0r —enable-gnutls
    —enable-iconv
    —enable-libass —enable-libbluray —enable-libbs2b —enable-libcaca —enable-li bfreetype —enable-libgme —enable-libgsm —enable-libilbc —enable-libmodplug -
    -enable-libmp3lame —enable-libopencore-amrnb —enable-libopencore-amrwb —enabl e-libopenh264 —enable-libopenjpeg —enable-libopus —enable-librtmp —enable-li bsnappy —enable-libsoxr —enable-libspeex —enable-libtheora —enable-libtwolam e —enable-libvidstab —enable-libvo-amrwbenc —enable-libvorbis —enable-libvpx —enable-libwavpack —enable-libwebp —enable-libx264 —enable-libx265 —enable
    -libxavs —enable-libxvid —enable-libzimg —enable-lzma —enable-zlib libavutil 55. 63.100 / 55. 63.100 libavcodec 57. 98.100 /
    57. 98.100 libavformat 57. 73.100 / 57. 73.100 libavdevice 57. 7.100 / 57. 7.100 libavfilter 6. 92.100 / 6. 92.100 libswscale 4. 7.101 / 4. 7.101 libswresample 2. 8.100 /
    2. 8.100 libpostproc 54. 6.100 / 54. 6.100 [rm @ 033a7520] Invalid stream index 2 for index at pos 206099254 Input #0, rm, from
    ’1.rmvb’ : Metadata :
    title : ArabSeed.CoM
    author : ArabSeed.CoM
    copyright : ArabSeed.CoM
    comment :
    ASMRuleBook : #($Bandwidth >= 0),Stream0Bandwidth = 64082, Stream1Bandwi dth = 285918 ;
    Audiences : Easy RealMedia Tool’s Audience ;
    audioMode : music
    Creation Date : 4/22/2010 4:31:14
    Description : This File is Created by Easy RealMedia Tools@ !
    Email : rick@redcheek.net
    Generated By : Easy RealMedia Tools V1.8x
    HomeWeb : http://redcheek.net
    Keywords : ArabSeed.CoM
    Modification Date : 4/22/2010 4:31:14
    videoMode : normal Duration : 01:16:35.69, start : 0.000000, bitrate : 358 kb/s
    Stream #0:0 : Audio : cook (cook / 0x6B6F6F63), 44100 Hz, stereo, fltp, 64 kb/ s
    Stream #0:1 : Video : rv40 (RV40 / 0x30345652), yuv420p, 720x408, 280 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc Output #0, matroska, to
    ’1.mkv’ : Metadata :
    title : ArabSeed.CoM
    author : ArabSeed.CoM
    copyright : ArabSeed.CoM
    comment :
    ASMRuleBook : #($Bandwidth >= 0),Stream0Bandwidth = 64082, Stream1Bandwi dth = 285918 ;
    Audiences : Easy RealMedia Tool’s Audience ;
    audioMode : music
    Creation Date : 4/22/2010 4:31:14
    Description : This File is Created by Easy RealMedia Tools@ !
    Email : rick@redcheek.net
    Generated By : Easy RealMedia Tools V1.8x
    HomeWeb : http://redcheek.net
    Keywords : ArabSeed.CoM
    Modification Date : 4/22/2010 4:31:14
    videoMode : normal
    encoder : Lavf57.73.100
    Stream #0:0 : Video : rv40 (RV40 / 0x30345652), yuv420p, 720x408, q=2-31, 280 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc
    Stream #0:1 : Audio : cook ([255][255][255][255] / 0xFFFFFFFF), 44100 Hz, ster eo, fltp, 64 kb/s Stream mapping : Stream #0:1 -> #0:0
    (copy) Stream #0:0 -> #0:1 (copy) Press [q] to stop, [?] for help
    [matroska @ 05228980] The Matroska muxer does not yet support muxing
    cook av_interleaved_write_frame() : Not yet implemented in FFmpeg,
    patches welcome Error writing trailer of 1.mkv : Not yet implemented in
    FFmpeg, patches welcome frame= 21 fps=0.0 q=-1.0 Lsize= 0kB
    time=00:00:01.48 bitrate= 0.0kbits /s speed= 148x video:2kB
    audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing ove
    rhead : unknown Conversion failed !

    I also tried :

    ffmpeg -i 1.rmvb -c copy 1.avi

    ffmpeg version N-86447-gfeb13ae Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 7.1.0 (GCC)
     configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --e
    nable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --
    enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv
    --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-li
    bfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug -
    -enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enabl
    e-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-li
    bsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolam
    e --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
    --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable
    -libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
     libavutil      55. 63.100 / 55. 63.100
     libavcodec     57. 98.100 / 57. 98.100
     libavformat    57. 73.100 / 57. 73.100
     libavdevice    57.  7.100 / 57.  7.100
     libavfilter     6. 92.100 /  6. 92.100
     libswscale      4.  7.101 /  4.  7.101
     libswresample   2.  8.100 /  2.  8.100
     libpostproc    54.  6.100 / 54.  6.100
    [rm @ 00077520] Invalid stream index 2 for index at pos 206099254
    Input #0, rm, from '1.rmvb':
     Metadata:
       title           : ArabSeed.CoM
       author          : ArabSeed.CoM
       copyright       : ArabSeed.CoM
       comment         :
       ASMRuleBook     : #($Bandwidth >= 0),Stream0Bandwidth = 64082, Stream1Bandwi
    dth = 285918;
       Audiences       : Easy RealMedia Tool's Audience;
       audioMode       : music
       Creation Date   : 4/22/2010 4:31:14
       Description     : This File is Created by Easy RealMedia Tools@!
       Email           : rick@redcheek.net
       Generated By    : Easy RealMedia Tools V1.8x
       HomeWeb         : http://redcheek.net
       Keywords        : ArabSeed.CoM
       Modification Date: 4/22/2010 4:31:14
       videoMode       : normal
     Duration: 01:16:35.69, start: 0.000000, bitrate: 358 kb/s
       Stream #0:0: Audio: cook (cook / 0x6B6F6F63), 44100 Hz, stereo, fltp, 64 kb/
    s
       Stream #0:1: Video: rv40 (RV40 / 0x30345652), yuv420p, 720x408, 280 kb/s, 25
    fps, 25 tbr, 1k tbn, 1k tbc
    Could not write header for output file #0 (incorrect codec parameters ?): Operat
    ion not permitted
    Stream mapping:
     Stream #0:1 -> #0:0 (copy)
     Stream #0:0 -> #0:1 (copy)
       Last message repeated 1 times
  • php exec ffmpeg how to get errors

    20 mars 2016, par Wiika
    exec("ffmpeg -i $flv -y -f mjpeg -ss 00:00:05 -s 120x90 -vframes 1 -an thumb.jpg",$error);

    $error return’s empty value
    but when i run this command using cron job
    this one send a notification email to me which contain informations like

    FFmpeg version 0.5.2, Copyright (c) 2000-2009 Fabrice Bellard, et al.
    configuration : —prefix=/usr —libdir=/usr/lib64 —shlibdir=/usr/lib64 —mandir=/usr/share/man —incdir=/usr/include —disable-avisynth —extra-cflags=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector —param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC —enable-avfilter —enable-avfilter-lavf —enable-libdirac —enable-libfaac —enable-libfaad —enable-libfaadbin —enable-libmp3lame —enable-libopencore-amrnb —enable-libopencore-amrwb —enable-libtheora —enable-libx264 —enable-gpl —enable-nonfree —enable-postproc —enable-pthreads —enable-shared —enable-swscale —enable-vdpau —enable-version3 —enable-x11grab
    libavutil 49.15. 0 / 49.15. 0
    libavcodec 52.20. 1 / 52.20. 1
    libavformat 52.31. 0 / 52.31. 0
    libavdevice 52. 1. 0 / 52. 1. 0
    libavfilter 0. 4. 0 / 0. 4. 0
    libswscale 0. 7. 1 / 0. 7. 1
    libpostproc 51. 2. 0 / 51. 2. 0
    built on Jun 13 2010 23:44:18, gcc : 4.1.2 20080704 (Red Hat 4.1.2-48)

    I need to be able to get those errors in php so i can know if the thumb was created or not

    Thanks.