Recherche avancée

Médias (91)

Autres articles (56)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (6044)

  • Write valid free atom when -moov_size is specified.

    18 juillet 2014, par Carl Eugen Hoyos
    Write valid free atom when -moov_size is specified.
    

    Fixes ticket #3769.

    • [DH] libavformat/movenc.c
  • 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 !

  • Why process output reader returns null data ? When same code in other process works correct

    26 août 2019, par Владимир Водов

    I try to get output from ffmpeg process but cant get output.
    In another processes and commands it works correctly but output returns immideately when start !

           using (var process = new Process())
           {
               process.StartInfo = new ProcessStartInfo()
               {
                   FileName = LinkHelper.IPFS_PATH,
                   Arguments = cmd,
                   UseShellExecute = false,
                   CreateNoWindow = true,
                   RedirectStandardOutput = true
               };

               process.ErrorDataReceived += FfmpegErrorRecieved;
               process.Start();

               using (StreamReader reader = process.StandardOutput)
               {
                   string output = await reader.ReadToEndAsync();
                   Console.WriteLine(output);
               }              
               process.WaitForExit();
           }

    Before output handle !

    Update :
    As szatmary said ffmpeg use output error instead standard output, so when you initialize process.StandartInfo don’t forget initialize property "RedirectStandardError" to TRUE !

    Here is correct code :

    private async Task DetectFFmpegCamerasAsync()
       {
           var cmd = "-list_devices true -f dshow -i dummy";
           using (var process = new Process())
           {
               process.StartInfo = new ProcessStartInfo()
               {
                   FileName = LinkHelper.FFMPEG_PATH,
                   Arguments = cmd,
                   UseShellExecute = false,
                   CreateNoWindow = true,
                   RedirectStandardError = true
               };

               process.Start();

               using (StreamReader reader = process.StandardError)
               {
                   string output = await reader.ReadToEndAsync();
                   Console.WriteLine($"Camera detection output: \n {output}");
               }              
               process.WaitForExit();
           }
       }