Recherche avancée

Médias (10)

Mot : - Tags -/wav

Autres articles (63)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

  • (Dés)Activation de fonctionnalités (plugins)

    18 février 2011, par

    Pour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
    SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
    Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
    MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)

  • Activation de l’inscription des visiteurs

    12 avril 2011, par

    Il est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
    Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
    Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...)

Sur d’autres sites (11102)

  • FFmpeg Video Streaming on android app

    18 avril 2017, par Johnny Roger

    I’m trying to do a streaming of my laptop webcam to my android smartphone.
    So I set an ffserver in this way

    HTTPPort 1234
    RTSPPort 1235

    <feed>
           File /tmp/feed2.ffm
           FileMaxSize 2M
           ACL allow 127.0.0.1
    </feed>

    <stream>
       Feed feed2.ffm
       Format rtp
       Noaudio
       VideoCodec libx264
       AVOptionVideo flags +global_header
       AVOptionVideo me_range 16
       AVOptionVideo qdiff 4
       AVOptionVideo qmin 10
       AVOptionVideo qmax 51
       ACL allow 192.168.0.0 192.168.255.255
    </stream>

    and I used the following ffmpeg instruction

    ffmpeg -i /dev/video0 -vcodec libx264 -tune zerolatency -crf 18 http://localhost:1234/feed2.ffm

    in my android studio project i set in the manifest file

    That is my MainActivity.java

    package com.example.johnny.ffmpeg;

    import android.app.ProgressDialog;
    import android.content.Context;
    import android.media.MediaPlayer;
    import android.os.Bundle;
    import android.app.Activity;
    import android.support.v7.app.AppCompatActivity;
    import android.util.Log;
    import android.view.SurfaceView;
    import android.view.View;
    import android.net.Uri;
    import android.widget.Button;
    import android.widget.ImageButton;
    import android.widget.ImageView;
    import android.widget.MediaController;
    import android.widget.Toast;
    import android.widget.VideoView;


    public class MainActivity extends AppCompatActivity implements VideoView.OnClickListener
    {

       ProgressDialog mDialog;
       VideoView videoView;
       ImageView btnPlayPause;
       MediaController mediaController;

       String videoURL ="rtsp://192.168.1.100:1235/test1.sdp";


       @Override
       protected void onCreate(Bundle savedInstanceState)
       {
           super.onCreate(savedInstanceState);


           setContentView(R.layout.activity_main);

           videoView =(VideoView)findViewById(R.id.videoView);
           mediaController= new MediaController(this);
           mediaController.setAnchorView(videoView);
           btnPlayPause = (ImageButton)findViewById(R.id.btn_play_pause);
           btnPlayPause.setOnClickListener(this);

       }

       @Override
       public void onClick(View v) {
           mDialog = new ProgressDialog(MainActivity.this);
           mDialog.setMessage("Please wait...");
           mDialog.setCanceledOnTouchOutside(false);
           mDialog.show();

           Uri uri = Uri.parse(videoURL);
           videoView.setVideoURI(uri);

           try{
               if(!videoView.isPlaying()) {


                   videoView.setMediaController(mediaController);
                   videoView.requestFocus();

                   videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
                       @Override
                       public void onCompletion(MediaPlayer mp) {
                           btnPlayPause.setImageResource(R.drawable.ic_aplay);
                       }
                   });
               }
               else
               {
                   videoView.pause();
                   btnPlayPause.setImageResource(R.drawable.ic_pause);
               }
           }
           catch(Exception ex)
           {

               Context context = getApplicationContext();
               String text = ex.toString();
               int duration = Toast.LENGTH_SHORT;

               Toast toast = Toast.makeText(context, text, duration);
               toast.show();
           }

           videoView.requestFocus();
           videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener(){
               @Override
               public void onPrepared(MediaPlayer mp){
                   mDialog.dismiss();
                   mp.setLooping(true);



                   videoView.start();
                   btnPlayPause.setImageResource(R.drawable.ic_pause);
               }
           });

           videoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {

               @Override
               public boolean onError(MediaPlayer mp, int what, int extra) {
                   Log.d("video", "setOnErrorListener ");
                   return true;
               }
           });

       }
    }

    and that is the relative activity_main.xml file :

    <relativelayout>

        <videoview></videoview>

       

       <textview></textview>

       <textview></textview>

    </relativelayout>

    I tested the streaming on vlc and it work well (even if with dealy, it’s not in real time).
    The app instead give me the message "can’t play this video" and the following error :

    V/MediaPlayer: message received msg=100, ext1=1, ext2=-38
    E/MediaPlayer: Error (1,-38)
    D/VideoView: Error: 1,-38
    D/video: setOnErrorListener
    E/MediaPlayer: error (1, -38)
    V/MediaPlayer: callback application
    V/MediaPlayer: back from callback
    E/MediaPlayer: Error (1,-38)
    D/VideoView: Error: 1,-38
    D/video: setOnErrorListener

    E/ViewRootImpl: sendUserActionEvent() mView == null

    I saw that the problem could be the format of the video, but i tried also with an mp4 file

    ffmpeg -i test.mp4 -vcodec libx264 -tune zerolatency -crf 18 http://localhost:1234/feed2.ffm

    and the result was the same. How Can I fix it and let my app work well ?

  • ffmpeg command not working with white space of directory path in Android

    13 avril 2017, par Sakib Syed

    I am working with FFMPEG library in which I want to rotate video using this library which works fine if I am file path has no any white space. But in my case I have white space of video directory (you can see full path in String commandStr onPreExecute() method of asynctask) path then it is not working at all. I have also seen same question like this and some more but not get any idea how to resolved it properly. Below is my code of MainActivity.class

       public class MainActivity extends AppCompatActivity implements View.OnClickListener{

       String workFolder = null;
       String demoVideoFolder = null;
       String vkLogPath = null;
       private boolean commandValidationFailedFlag = false;

       private Button btnRun;


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

           GeneralUtils.checkForPermissionsMAndAbove(MainActivity.this, true);


           setIds();
           setListner();


           demoVideoFolder = Environment.getExternalStorageDirectory().getAbsolutePath() + "/videokit/";

           Log.i(Prefs.TAG, getString(R.string.app_name) + " version: " + GeneralUtils.getVersionName(getApplicationContext()) );
           workFolder = getApplicationContext().getFilesDir().getAbsolutePath() + "/";
           vkLogPath = workFolder + "vk.log";

           GeneralUtils.copyLicenseFromAssetsToSDIfNeeded(this, workFolder);
           GeneralUtils.copyDemoVideoFromAssetsToSDIfNeeded(this, demoVideoFolder);


           int rc = GeneralUtils.isLicenseValid(getApplicationContext(), workFolder);
           Log.i(Prefs.TAG, "License check RC: " + rc);
       }

       private void setListner() {
           btnRun.setOnClickListener(this);
       }

       private void setIds() {
           try {
               btnRun =  (Button)findViewById(R.id.btnRun);
           } catch (Exception e) {
               e.printStackTrace();
           }
       }

       @Override
       public void onClick(View view) {
           switch (view.getId()){
               case R.id.btnRun:

                   Log.i(Prefs.TAG, "run clicked.");
                   if (GeneralUtils.checkIfFileExistAndNotEmpty(workFolder)) {
                       new TranscdingBackground(MainActivity.this).execute();
                   }
                   else {
                       Toast.makeText(getApplicationContext(), workFolder + " not found", Toast.LENGTH_LONG).show();
                   }
                   break;
           }
       }

       public class TranscdingBackground extends AsyncTask
       {

           ProgressDialog progressDialog;
           Activity _act;
           String commandStr;

           public TranscdingBackground (Activity act) {
               _act = act;
           }



           @Override
           protected void onPreExecute() {

    //            commandStr = "ffmpeg -y -i /storage/emulated/0/WhatsApp/Media/in.mp4 -vf rotate=270*(PI/180) /sdcard/videokit/out.mp4";
               commandStr = "ffmpeg -y -i /storage/emulated/0/WhatsApp/Media/WhatsApp Video/in.mp4 -vf rotate=270*(PI/180) /sdcard/videokit/out.mp4";


               progressDialog = new ProgressDialog(_act);
               progressDialog.setMessage("FFmpeg4Android Transcoding in progress...");
               progressDialog.show();

           }

           protected Integer doInBackground(String... paths) {
               Log.i(Prefs.TAG, "doInBackground started...");

               // delete previous log
               boolean isDeleted = GeneralUtils.deleteFileUtil(workFolder + "/vk.log");
               Log.i(Prefs.TAG, "vk deleted: " + isDeleted);

               PowerManager powerManager = (PowerManager)_act.getSystemService(Activity.POWER_SERVICE);
               PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VK_LOCK");
               Log.d(Prefs.TAG, "Acquire wake lock");
               wakeLock.acquire();



               LoadJNI vk = new LoadJNI();
               try {

                   vk.run(GeneralUtils.utilConvertToComplex(commandStr), workFolder, getApplicationContext());

                   // copying vk.log (internal native log) to the videokit folder
                   GeneralUtils.copyFileToFolder(vkLogPath, demoVideoFolder);

               } catch (CommandValidationException e) {
                   Log.e(Prefs.TAG, "vk run exeption.", e);
                   commandValidationFailedFlag = true;

               } catch (Throwable e) {
                   Log.e(Prefs.TAG, "vk run exeption.", e);
               }
               finally {
                   if (wakeLock.isHeld())
                       wakeLock.release();
                   else{
                       Log.i(Prefs.TAG, "Wake lock is already released, doing nothing");
                   }
               }
               Log.i(Prefs.TAG, "doInBackground finished");
               return Integer.valueOf(0);
           }

           protected void onProgressUpdate(Integer... progress) {
           }

           @Override
           protected void onCancelled() {
               Log.i(Prefs.TAG, "onCancelled");
               //progressDialog.dismiss();
               super.onCancelled();
           }


           @Override
           protected void onPostExecute(Integer result) {
               Log.i(Prefs.TAG, "onPostExecute");
               progressDialog.dismiss();
               super.onPostExecute(result);

               // finished Toast
               String rc = null;
               if (commandValidationFailedFlag) {
                   rc = "Command Vaidation Failed";
               }
               else {
                   rc = GeneralUtils.getReturnCodeFromLog(vkLogPath);
               }
               final String status = rc;
               MainActivity.this.runOnUiThread(new Runnable() {
                   public void run() {
                       Toast.makeText(MainActivity.this, status, Toast.LENGTH_LONG).show();
                       if (status.equals("Transcoding Status: Failed")) {
                           Toast.makeText(MainActivity.this, "Check: " + vkLogPath + " for more information.", Toast.LENGTH_LONG).show();
                       }
                   }
               });
           }
       }

    }

    Here onPreExecute() method I have given video file path.

  • ffmpegmediaMetadataRetriever cannot be used for m3u8 format ?

    19 juillet 2017, par Nandz

    I want to get the frames from the video URL which is of m3u8 format. I couldn’t retrieve the frame at the specified time. When i tried with mp4 format, it worked. ( Am using android videoview)

    Here is my code.

    public class VideoViewAdapterClass extends RecyclerView.Adapter {

           private List<videomodelactivity> videoListModel;
           private Context context;
           public Bitmap bitmap;
          String videoPath = "https://xxxxxx.xxxxxx.xxxxx/HLS/xxxxxxxx/fruit_milkshake-master-playlist.m3u8";

           public VideoViewAdapterClass(List<videomodelactivity> videoList, Context context) {
               this.context = context;

               videoListModel = videoList;

           }

           @Override
           public VideoViewAdapterClass.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

               View itemLayoutView = LayoutInflater.from(parent.getContext()).inflate(
                       R.layout.customized_layout, null);

               ViewHolder viewHolder = new ViewHolder(itemLayoutView);
               return viewHolder;

           }

           @Override
           public void onBindViewHolder(final VideoViewAdapterClass.ViewHolder holder, int position) {


              final VideoModelActivity videoModel = videoListModel.get(position);
               holder.movieName.setText(videoModel.getMovieName());

               MediaMetadataRetriever mediaMetadataRetriever = null;

               try {
                   mediaMetadataRetriever = new MediaMetadataRetriever();
                   if (Build.VERSION.SDK_INT >= 14)

                       mediaMetadataRetriever.setDataSource(videoPath, new HashMap());
                   bitmap = mediaMetadataRetriever.getFrameAtTime(2000000, MediaMetadataRetriever.OPTION_CLOSEST_SYNC);


               } catch (Exception e) {
                   e.printStackTrace();

               } finally {
                   if (mediaMetadataRetriever != null)
                       mediaMetadataRetriever.release();
               }

               holder.vidImg.setImageBitmap(bitmap);

                       holder.vidImg.setOnClickListener(new View.OnClickListener() {
                   @Override
                   public void onClick(View view) {

                       Intent intent = new Intent (context, VideoViewActivity.class);
                       intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                       context.startActivity(intent);

                   }
               });


           }

           @Override
           public int getItemCount() {
               return videoListModel.size();
           }

           public class ViewHolder extends RecyclerView.ViewHolder {

               ImageView vidImg;
               TextView movieName;
               public ViewHolder(View itemView) {
                   super(itemView);

                   vidImg = (ImageView) itemView.findViewById(R.id.imageVid);
                   movieName = (TextView) itemView.findViewById(R.id.movieName);
               }
           }
       }
    </videomodelactivity></videomodelactivity>