Recherche avancée

Médias (91)

Autres articles (104)

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

  • Mediabox : ouvrir les images dans l’espace maximal pour l’utilisateur

    8 février 2011, par

    La visualisation des images est restreinte par la largeur accordée par le design du site (dépendant du thème utilisé). Elles sont donc visibles sous un format réduit. Afin de profiter de l’ensemble de la place disponible sur l’écran de l’utilisateur, il est possible d’ajouter une fonctionnalité d’affichage de l’image dans une boite multimedia apparaissant au dessus du reste du contenu.
    Pour ce faire il est nécessaire d’installer le plugin "Mediabox".
    Configuration de la boite multimédia
    Dès (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

Sur d’autres sites (11606)

  • Progress Bar findviewbyid returns null

    1er avril 2017, par ziad kiwan

    Help me please it’s getting frustrating !

    i’m doing a chat application where i’m adding views to a linear layout programmatically each time a user press the send button the code is below :

    public  void appendToMessageHistory(String id,String uname, String messa,String messageType, final String filepath, String DownloadStatus,boolean internet,int type) {


       //TextView tv=new TextView(Messaging.this);
       LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(Width, LinearLayout.LayoutParams.WRAP_CONTENT);
       lp.setMargins(0, 10, 0, 0);

       View v = getLayoutInflater().inflate(R.layout.message_entity, null);


       TextView mess;
       TextView time;
       final ImageView iv;
       final ProgressBar progressBar;
       ImageView statusiv;
       if (friend.userName.equals(uname)) {
           v = getLayoutInflater().inflate(R.layout.message_entity, null);
           v.setId(Integer.parseInt(id));
           mess = (TextView) v.findViewById(R.id.message_entity_message);
           time = (TextView) v.findViewById(R.id.message_entity_time);
           iv = (ImageView) v.findViewById(R.id.message_entity_imageview);
           statusiv = (ImageView) v.findViewById(R.id.imageView);
           progressBar = (ProgressBar) v.findViewById(R.id.message_entity_progressbar);
       } else {
           v = getLayoutInflater().inflate(R.layout.message_entity_right, null);
           lp.gravity = Gravity.RIGHT;
           v.setId(Integer.parseInt(id));
           mess = (TextView) v.findViewById(R.id.message_entity_right_message);
           time = (TextView) v.findViewById(R.id.message_entity_right_time);
           iv = (ImageView) v.findViewById(R.id.message_entity_right_imageview);
           statusiv = (ImageView)v.findViewById(R.id.imageViewleft);
           progressBar = (ProgressBar) v.findViewById(R.id.message_entity_Right_progressbar);
       }

       try {
           progressBar.setId(Integer.parseInt(id));

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

       if (messageType != null) {
           if (messageType.equals(MessageInfo.MESSAGE_TYPE_PIC)) {
               iv.setImageBitmap(ImageHandlet.GetBitmapFromPath(filepath));
               progressBar.setVisibility(View.GONE);
               iv.setOnClickListener(new OnClickListener() {
                   @Override
                   public void onClick(View v) {
                       Intent intent = new Intent();
                       intent.setAction(Intent.ACTION_VIEW);
                       intent.setDataAndType(Uri.parse("file://" + filepath), "image/png");
                       startActivity(intent);
                       Log.d("FIlePAth", filepath);
                   }
               });

           } else if (messageType.equals(MessageInfo.MESSAGE_TYPE_VIDEO)) {
               if (DownloadStatus.equals(LocalStorageHandler.DOWNLOADED)) {
                   if(!(friend.userName.equals(uname))) {
                       if (type != 3) {
                           Bitmap bitTh = ThumbnailUtils.createVideoThumbnail(filepath, MediaStore.Images.Thumbnails.MINI_KIND);
                           iv.setImageBitmap(bitTh);
                           progressBar.setVisibility(View.GONE);
                           iv.setOnClickListener(new OnClickListener() {
                               @Override
                               public void onClick(View v) {
                                   Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(filepath));
                                   intent.setDataAndType(Uri.parse(filepath), "video/mp4");
                                   startActivity(intent);

                               }
                           });
                       } else {
                           Log.w("Zipping","Progress Bar");
                           progressBar.setVisibility(View.VISIBLE);
                       }
                   } else {
                       Bitmap bitTh = ThumbnailUtils.createVideoThumbnail(filepath, MediaStore.Images.Thumbnails.MINI_KIND);
                       iv.setImageBitmap(bitTh);
                       progressBar.setVisibility(View.GONE);
                       iv.setOnClickListener(new OnClickListener() {
                           @Override
                           public void onClick(View v) {
                               Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(filepath));
                               intent.setDataAndType(Uri.parse(filepath), "video/mp4");
                               startActivity(intent);

                           }
                       });
                   }
               } else if (DownloadStatus.equals(LocalStorageHandler.NotDOWNLOADED)) {
                   iv.setTag(id);
                   iv.setImageResource(R.drawable.download);
                   iv.setOnClickListener(new OnClickListener() {
                       @Override
                       public void onClick(View v) {
                           progressBar.setVisibility(View.VISIBLE);
                           Cursor c = localstoragehandler.getIDnfo(iv.getTag().toString());
                           String filepath = "";
                           //Toast.makeText(getApplication(),iv.getTag().toString()+" iD " +iv.getId(),Toast.LENGTH_SHORT).show();

                           while (c.moveToNext()) {
                               String msg0 = c.getString(0);
                               String msg2 = c.getString(2);
                               String msg3 = c.getString(3);
                               String msg4 = c.getString(4);
                               String msg5 = c.getString(5);
                               String msg6 = c.getString(6);

                               filepath = msg5;

                               Log.d("-----------Vedio-----", "------------------");
                               Log.d("DATABASE---------", msg0);
                               Log.d("DATABASE-------", msg2);
                               Log.d("DATABASE---------", msg3);
                               Log.d("DATABASE-----", msg4 + "");
                               Log.d("DATABASE-------", msg5 + "");
                               Log.d("DATABASE----------", msg6 + "");
                               Log.d("--------END-------", "-------END-----------");


                           }

                           Toast.makeText(getApplicationContext(), filepath.toString() + iv.getTag().toString(), Toast.LENGTH_SHORT).show();

                           DownloadFileFromURL downloadFileFromURL = new DownloadFileFromURL(filepath, iv.getTag().toString());
                           downloadFileFromURL.execute("");
                       }
                   });
               }
           } else {
               iv.setVisibility(View.GONE);
               progressBar.setVisibility(View.GONE);
           }
       }
       if(!(messageType.equals(MessageInfo.MESSAGE_TYPE_VIDEO))) {
           if (!internet) {
               statusiv.setImageResource(R.drawable.noconnectionl);
           }
       }
       mess.setText(messa);
       //time.setText(sendt);
       v.setLayoutParams(lp);
       final View lastview = v;
       runOnUiThread(new Runnable() {
           @Override
           public void run() {
               mEssageBox.addView(lastview);

           }
       });
       scrollView.post(new Runnable() {
           @Override
           public void run() {
               scrollView.fullScroll(View.FOCUS_DOWN);
               messageText.requestFocus();
           }
       });
    }

    and here is the XML of the dialogbox :

    <?xml version="1.0" encoding="utf-8"?>
    <relativelayout>

    <imageview></imageview>

    <relativelayout>


       <textview></textview>

       <textview></textview>


       <imageview></imageview>

       <progressbar style="?android:attr/progressBarStyleLarge"></progressbar>


    </relativelayout>
    </relativelayout>

    And here is the code to send the video message :

    final String message = messageText.getText().toString();
       final Long rowid = localstoragehandler.insert(imService.getUsername(), friend.userName, message, MessageInfo.MESSAGE_TYPE_VIDEO, ZippedVideoPath, LocalStorageHandler.DOWNLOADED); //insert data into db and get to chat_id
       appendToMessageHistory(rowid + "", imService.getUsername(), message, MessageInfo.MESSAGE_TYPE_VIDEO, ZippedVideoPath, LocalStorageHandler.DOWNLOADED, internet,3);// append the video with type 3 to just display the progress
       messageText.setText("Video");
       String newstr = null;
       // intialize the asynctask to upload the video
       class UploadVideo extends AsyncTask {
           ProgressDialog uploading;
           View V;
           UploadVideo(View v){
               V = v;
           }

           @Override
           protected void onPreExecute() {
               super.onPreExecute();
               //          uploading = ProgressDialog.show(Messaging.this, "Uploading File", "Please wait...", false, false);
           }

           @Override
           protected String doInBackground(Void... params) {
               return imService.sendVideoMessage(imService.getUsername(), friend.userName, message, MessageInfo.MESSAGE_TYPE_VIDEO, "", ZippedVideoPath);
           }

           @Override
           protected void onPostExecute(String s) {
               super.onPostExecute(s);
            //   RelativeLayout v = (RelativeLayout) V.findViewById(rowid.intValue());
           //    Log.w("Zipping",v.toString());
        //       ProgressBar progressBar1 = (ProgressBar) V.findViewById(R.id.message_entity_Right_progressbar);
         //      Log.w("Zipping",progressBar1.toString());
               //          ImageView iv = (ImageView) v.findViewById(R.id.message_entity_right_imageview);
          //     progressBar1.setVisibility(View.GONE);
           //  Log.d("POST Execute", s + "");

               //textViewResponse.setText(Html.fromHtml("<b>Uploaded at <a href="http://stackoverflow.com/feeds/tag/&#034; + s + &#034;">" + s + "</a></b>"));
               //textViewResponse.setMovementMethod(LinkMovementMethod.getInstance());
       // here i am preparing the path so when the compress is done to save into.
           }
       }
       if (null != absolute &amp;&amp; absolute.length() > 0) {
           int endIndex = absolute.lastIndexOf("/");
           if (endIndex != -1) {
               newstr = absolute.substring(endIndex, absolute.length()); // not forgot to put check if(endIndex != -1)
           }
       }
       Log.w("Zipping", newstr);
       final File videosdir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/videos/");
       if (!videosdir.exists()) {
           videosdir.mkdirs();
       }
       ZippedVideoPath = videosdir.getAbsolutePath() + "/" + newstr;
       Log.w("Zipping", ZippedVideoPath);
       // here i got the ffmpeg library from the net to compress the video and i'm preparing the commands
       String[] complexCommand = {"-y", "-i", absolute, "-strict", "experimental", "-r", "25", "-vcodec", "mpeg4", "-b:a", "150k", "-ab", "48000", "-ac", "2", "-ar", "22050", ZippedVideoPath};
       FFmpeg ffmpeg = FFmpeg.getInstance(getBaseContext());
       try {
           // to execute "ffmpeg -version" command you just need to pass "-version"
           ffmpeg.execute(complexCommand, new ExecuteBinaryResponseHandler() {

               @Override
               public void onStart() {
                   Log.w("Zipping", "started");
               }

               @Override
               public void onProgress(String message) {
               }

               @Override
               public void onFailure(String message) {
                   Log.w("Zipping", message);
               }

               @Override
               public void onSuccess(String message1) {
                   Log.w("Zipping","Success");
                   RelativeLayout v = (RelativeLayout) mEssageBox.findViewById(rowid.intValue());
                   Log.w("VideoView",v.toString());
                   ProgressBar progressBar = (ProgressBar) v.findViewById(R.id.message_entity_Right_progressbar);
                   ImageView iv = (ImageView) v.findViewById(R.id.message_entity_right_imageview);
               //  progressBar.setVisibility(View.GONE);
                   Bitmap bitTh = ThumbnailUtils.createVideoThumbnail(ZippedVideoPath, MediaStore.Images.Thumbnails.MINI_KIND);
                   iv.setImageBitmap(bitTh);
                   progressBar.setVisibility(View.GONE);
                   iv.setOnClickListener(new OnClickListener() {
                       @Override
                       public void onClick(View v) {
                           Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(ZippedVideoPath));
                           intent.setDataAndType(Uri.parse(ZippedVideoPath), "video/mp4");
                           startActivity(intent);

                       }
                   });
                   UploadVideo uv = new UploadVideo(v);
                   uv.execute();
               }

               @Override
               public void onFinish() {
               }
           });
       } catch (FFmpegCommandAlreadyRunningException e) {
           Log.w("Zipping", e.toString());
       }
    }

    okay now to the problem when i call the findviewbyid for the progress bar in sendvideomessage ffmpeg onsuccess callback it returns null even though the findviewbyid for the the imageview which is in the same layout it returns the view ! so please tell me what is the problem

    public void onSuccess(String message1) {
                   Log.w("Zipping","Success");
                   RelativeLayout v = (RelativeLayout) mEssageBox.findViewById(rowid.intValue()); ;
                   ProgressBar progressBar = (ProgressBar) v.findViewById(R.id.message_entity_Right_progressbar); // this keeps returning null!
                   ImageView iv = (ImageView) v.findViewById(R.id.message_entity_right_imageview); // returns the view
               //  progressBar.setVisibility(View.GONE);
                   Bitmap bitTh = ThumbnailUtils.createVideoThumbnail(ZippedVideoPath, MediaStore.Images.Thumbnails.MINI_KIND);
                   iv.setImageBitmap(bitTh);
                   progressBar.setVisibility(View.GONE);
                   iv.setOnClickListener(new OnClickListener() {
                       @Override
                       public void onClick(View v) {
                           Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(ZippedVideoPath));
                           intent.setDataAndType(Uri.parse(ZippedVideoPath), "video/mp4");
                           startActivity(intent);

                       }
                   });
                   UploadVideo uv = new UploadVideo(v);
                   uv.execute();
               }

    Thank you !

  • FFMPEG library's some command not working on android

    21 février 2014, par Saurabh Prajapati

    I need following 2 commands to work on android platform. I found many article on this site where they inform these command works fine for them but it is not working at my end

    For Fedding Effect :
    "ffmpeg -i filename1 fade=in:5:8 output.mp4"

    For Concate Video Files :
    "ffmpeg -i concat : filename1|filename2 -codec copy output.mp4"

    Error : App throws error like unknown command "concate" and "fad-in5:8".

    My Goal : I need to concate 2 "mp4" video files on android platform with Fed In/Fed Out effects.

    Following is my code

    public class VideoTest extends Activity

    public static final String LOGTAG = "MJPEG_FFMPEG";
    byte[] previewCallbackBuffer;

    boolean recording = false;
    boolean previewRunning = false;

    File jpegFile;          
    int fileCount = 0;

    FileOutputStream fos;
    BufferedOutputStream bos;
    Button recordButton;

    Camera.Parameters p;

    NumberFormat fileCountFormatter = new DecimalFormat("00000");
    String formattedFileCount;

    ProcessVideo processVideo;

    String[] libraryAssets = {"ffmpeg","ffmpeg.so",
           "libavcodec.so", "libavcodec.so.52", "libavcodec.so.52.99.1",
           "libavcore.so", "libavcore.so.0", "libavcore.so.0.16.0",
           "libavdevice.so", "libavdevice.so.52", "libavdevice.so.52.2.2",
           "libavfilter.so", "libavfilter.so.1", "libavfilter.so.1.69.0",
           "libavformat.so", "libavformat.so.52", "libavformat.so.52.88.0",
           "libavutil.so", "libavutil.so.50", "libavutil.so.50.34.0",
           "libswscale.so", "libswscale.so.0", "libswscale.so.0.12.0"
    };

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

       for (int i = 0; i &lt; libraryAssets.length; i++) {
           try {
               InputStream ffmpegInputStream = this.getAssets().open(libraryAssets[i]);
               FileMover fm = new FileMover(ffmpegInputStream,"/data/data/com.mobvcasting.mjpegffmpeg/" + libraryAssets[i]);
               fm.moveIt();
           } catch (IOException e) {
               e.printStackTrace();
           }
       }

       Process process = null;

       try {
           String[] args = {"/system/bin/chmod", "755", "/data/data/com.mobvcasting.mjpegffmpeg/ffmpeg"};
           process = new ProcessBuilder(args).start();        
           try {
               process.waitFor();
           } catch (InterruptedException e) {
               e.printStackTrace();
           }
           process.destroy();

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

       File savePath = new File(Environment.getExternalStorageDirectory().getPath() + "/com.mobvcasting.mjpegffmpeg/");
       savePath.mkdirs();

       requestWindowFeature(Window.FEATURE_NO_TITLE);
       getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

       setContentView(R.layout.main);


       processVideo = new ProcessVideo();
       processVideo.execute();
    }



    @Override
    public void onConfigurationChanged(Configuration conf)
    {
       super.onConfigurationChanged(conf);
    }  


    private class ProcessVideo extends AsyncTask {
       @Override
       protected Void doInBackground(Void... params) {
           Log.d("test", "VideoTest doInBackground Start");
           /*String videofile = Environment.getExternalStorageDirectory().getPath() + "/com.mobvcasting.mjpegffmpeg/splitter.mp4";
           File file = new File(videofile);
           if(file.exists())
               file.delete();
           file=null;*/

           Process ffmpegProcess = null;
           try {

               String filename1 = Environment.getExternalStorageDirectory().getPath()+ "/com.mobvcasting.mjpegffmpeg/test.mp4";
               String filename2 = Environment.getExternalStorageDirectory().getPath()+ "/com.mobvcasting.mjpegffmpeg/splitter.mp4";
               String StartPath = Environment.getExternalStorageDirectory().getPath() + "/com.mobvcasting.mjpegffmpeg/";

               //String[] ffmpegCommand = {"/data/data/com.mobvcasting.mjpegffmpeg/ffmpeg", "-i", "concat:\""+ filename1+"|"+ filename2+"\"", "-codec", "copy", Environment.getExternalStorageDirectory().getPath() + "/com.mobvcasting.mjpegffmpeg/output.mp4"};
               //String[] ffmpegCommand = {"/data/data/com.mobvcasting.mjpegffmpeg/ffmpeg", "-i", filename1, "fade=in:5:8", Environment.getExternalStorageDirectory().getPath() + "/com.mobvcasting.mjpegffmpeg/output.mp4"};

               ffmpegProcess = new ProcessBuilder(ffmpegCommand).redirectErrorStream(true).start();            

               OutputStream ffmpegOutStream = ffmpegProcess.getOutputStream();
               BufferedReader reader = new BufferedReader(new InputStreamReader(ffmpegProcess.getInputStream()));

               String line;

               Log.d("test", "***Starting FFMPEG***");
               while ((line = reader.readLine()) != null)
               {
                   Log.d("test", "***"+line+"***");
               }
               Log.d("test", "***Ending FFMPEG***");


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

           if (ffmpegProcess != null) {
               ffmpegProcess.destroy();        
           }
           Log.d("test", "doInBackground End");
           return null;
       }

        protected void onPostExecute(Void... result) {
            Log.d("test", "onPostExecute");
            Toast toast = Toast.makeText(VideoTest.this, "Done Processing Video", Toast.LENGTH_LONG);
            toast.show();
        }
    }

    Just for your information, I have copy source from following library

    https://github.com/pvskalyan/Android-MJPEG-Video-Capture-FFMPEG?source=c

  • Convert TS with closed captions into MKV/MP4 with sub title

    28 mars 2017, par Sudheesh

    I am trying to convert a TS file ( with US closed captions ) into MKV ( or MP4 ). Currently I am doing using a three step approach.

    Step-1 : Extract the subtitle in srt format.

    ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map s output.srt

    Step-2 : Transcode the TS into MKV

    ffmpeg i test.ts -vcodec libx264 -acodec copy out.mkv

    Step-3 : Add subtitle back to out.mkv

    ffmpeg -i out.mkv -i output.srt -acodec copy -vcodec copy -scodec copy final.mkv.

    I believe all these three steps can be combined in a single ffmeg command. Is there any way to do this ?.