Recherche avancée

Médias (91)

Autres articles (102)

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

  • L’agrémenter visuellement

    10 avril 2011

    MediaSPIP est basé sur un système de thèmes et de squelettes. Les squelettes définissent le placement des informations dans la page, définissant un usage spécifique de la plateforme, et les thèmes l’habillage graphique général.
    Chacun peut proposer un nouveau thème graphique ou un squelette et le mettre à disposition de la communauté.

Sur d’autres sites (11134)

  • Android : Select from images extracted with FFMPEG

    21 juillet 2017, par Tix

    I’m currently able to extract images(frames) from a video, and display all the extracted images using the code below, how do i make it so that the displayed images could be selected by user and passed as a bitmap to another activity ?

    FFMPEG Compiled using

    compile ’com.writingminds:FFmpegAndroid:0.3.2’

    Complex Command used to get the frames/images

    String[] complexCommand = "-y", "-i", yourRealPath, "-an", "-framerate", "60", "-vf", "select=’gte(n,45)’", "-vsync", "0", dest.getAbsolutePath() ;

    Main Activity

           /**
            * Command for extracting images from video
            */
           private void extractImagesVideo(int startMs, int endMs) {
               File moviesDir = Environment.getExternalStoragePublicDirectory(
                       Environment.DIRECTORY_PICTURES
               );

               String filePrefix = "extract_picture";
               String fileExtn = ".jpg";
               String yourRealPath = getPath(MainActivity.this, selectedVideoUri);

               File dir = new File(moviesDir, "VideoEditor");
               int fileNo = 0;
               while (dir.exists()) {
                   fileNo++;
                   dir = new File(moviesDir, "VideoEditor" + fileNo);

               }
               dir.mkdir();
               filePath = dir.getAbsolutePath();
               File dest = new File(dir, filePrefix + "%03d" + fileExtn);


               Log.d(TAG, "startTrim: src: " + yourRealPath);
               Log.d(TAG, "startTrim: dest: " + dest.getAbsolutePath());

               String[] complexCommand = {"-y", "-i", yourRealPath, "-an", "-r", "1/2", "-ss", "" + startMs / 1000, "-t", "" + (endMs - startMs) / 1000, dest.getAbsolutePath()};

               execFFmpegBinary(complexCommand);

           }

        /**
            * Executing ffmpeg binary
            */
           private void execFFmpegBinary(final String[] command) {
               try {
                   ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {
                       @Override
                       public void onFailure(String s) {
                           Log.d(TAG, "FAILED with output : " + s);
                       }

                       @Override
                       public void onSuccess(String s) {
                           Log.d(TAG, "SUCCESS with output : " + s);
                           if (choice == 1 || choice == 2 || choice == 5 || choice == 6 || choice == 7) {
                               Intent intent = new Intent(MainActivity.this, PreviewActivity.class);
                               intent.putExtra(FILEPATH, filePath);
                               startActivity(intent);
                           } else if (choice == 3) {
                               Intent intent = new Intent(MainActivity.this, PreviewImageActivity.class);
                               intent.putExtra(FILEPATH, filePath);
                               startActivity(intent);
                           } else if (choice == 4) {
                               Intent intent = new Intent(MainActivity.this, AudioPreviewActivity.class);
                               intent.putExtra(FILEPATH, filePath);
                               startActivity(intent);
                           } else if (choice == 8) {
                               choice = 9;
                               reverseVideoCommand();
                           } else if (Arrays.equals(command, lastReverseCommand)) {
                               choice = 10;
                               concatVideoCommand();
                           } else if (choice == 10) {
                               File moviesDir = Environment.getExternalStoragePublicDirectory(
                                       Environment.DIRECTORY_MOVIES
                               );
                               File destDir = new File(moviesDir, ".VideoPartsReverse");
                               File dir = new File(moviesDir, ".VideoSplit");
                               if (dir.exists())
                                   deleteDir(dir);
                               if (destDir.exists())
                                   deleteDir(destDir);
                               choice = 11;
                               Intent intent = new Intent(MainActivity.this, PreviewActivity.class);
                               intent.putExtra(FILEPATH, filePath);
                               startActivity(intent);
                           }
                       }

    PreviewImageActivity

       public class PreviewImageActivity extends AppCompatActivity {

           private static final String FILEPATH = "filepath";
               @Override
               protected void onCreate(@Nullable Bundle savedInstanceState) {
                   super.onCreate(savedInstanceState);
                   setContentView(R.layout.activity_gallery);
                   getSupportActionBar().setDisplayHomeAsUpEnabled(true);
                   getSupportActionBar().setDisplayShowHomeEnabled(true);
                   TextView tvInstruction=(TextView)findViewById(R.id.tvInstruction) ;

                   GridLayoutManager lLayoutlLayout = new GridLayoutManager(PreviewImageActivity.this, 4);
                   RecyclerView rView = (RecyclerView)findViewById(R.id.recycler_view);
                   rView.setHasFixedSize(true);
                   rView.setLayoutManager(lLayoutlLayout);
                   String filePath = getIntent().getStringExtra(FILEPATH);
                   ArrayList<string> f = new ArrayList<string>();



      File dir = new File(filePath);
               tvInstruction.setText("Images stored at path "+filePath);
               File[] listFile;

                   listFile = dir.listFiles();



               for(File e:listFile)
               {
                   f.add(e.getAbsolutePath());
               }

               PreviewImageAdapter rcAdapter = new PreviewImageAdapter( f);
               rView.setAdapter(rcAdapter);


           }
       @Override
       public boolean onOptionsItemSelected(MenuItem item) {
           // handle arrow click here
           if (item.getItemId() == android.R.id.home) {
               finish(); // close this activity and return to preview activity (if there is any)
           }

           return super.onOptionsItemSelected(item);
       }
    }
    </string></string>

    PreviewImageAdapter

    public class PreviewImageAdapter extends RecyclerView.Adapter {

       private ArrayList<string> paths;

       public PreviewImageAdapter( ArrayList<string> paths) {
           this.paths = paths;
       }

       @Override
       public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
           View itemView = LayoutInflater.from(parent.getContext())
                   .inflate(R.layout.item_gallery, parent, false);

           return new MyViewHolder(itemView);
       }

       @Override
       public void onBindViewHolder(MyViewHolder holder, int position) {
           Bitmap bmp = BitmapFactory.decodeFile(paths.get(position));
           holder.ivPhoto.setImageBitmap(bmp);
       }

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

       public class MyViewHolder extends RecyclerView.ViewHolder {
           private ImageView ivPhoto;

           public MyViewHolder(View itemView) {
               super(itemView);

               ivPhoto = (ImageView) itemView.findViewById(R.id.ivPhoto);
           }
       }

    }
    </string></string>
  • FFmpeg record and stream

    16 janvier 2019, par Robert

    I’m getting the following error.

      E/FFmpeg: Exception while trying to run:
      [/data/user/0/com.example.pathways.testipcam/files/ffmpeg, -y, -i,
     rtsp://log:pass@IP:port/video.h264, -acodec, copy, -vcodec, copy, -t,
    00:03:00,
    content://com.example.android.fileprovider/external_files/Android/data/com.example.pathways.testipcam/files/Movies/IPcam_20190116_150628_6019720208966811003.m>kv]
    java.io.IOException: Cannot run program "/data/user/0/com.example.pathways.testipcam/files/ffmpeg": error=2, No such >file or directory

    OK I’m trying to learn how to record and stream my IP cam on android. I can stream the video in a surface view media player no problem so I then went to the record task. Now I’m a bit lost. I know this is possible as I have read people say they used this to do it.

    I started with implamenting

    implementation 'nl.bravobit:android-ffmpeg:1.1.5'

    But I can’t figure out what I am missing or doing wrong as there aren’t really any tutorials explaining this completely. So hopefully this can be the thread everyone else finds for a solution. I have listed my code below. Exactly what have I got wrong here. It runs and goes to onStart...then right on onFailure.
    DO I need to have 2 streams in order to view and watch ? or what the deal.
    I know FFmpeg can do that.
    "ffmpeg supports multiple outputs created out of the same input(s) in the same process. The usual way to accomplish this is :

    ffmpeg -i input1 -i input2 \
    -acodec … -vcodec … output1 \
    -acodec … -vcodec … output2 \"

    but I have no idea how to sue that.
    Anyway, I know I’m kind of close, at least I hope I need a little help on getting over the finish line on this. What have I done wrong, how does this work.

    Here is what I did, I streamed the video as the app does. no problem

       surfaceView = (SurfaceView) findViewById(R.id.videoView);
       _surfaceHolder = surfaceView.getHolder();
       _surfaceHolder.addCallback(this);
       _surfaceHolder.setFixedSize(320, 240);

    ....

    @Override
    public void surfaceCreated(SurfaceHolder holder) {
       mpPlayerRun();

    }

    public void mpPlayerRun(){
       _mediaPlayer = new MediaPlayer();
       _mediaPlayer.setDisplay(_surfaceHolder);

       try {
           // Specify the IP camera's URL and auth headers.
           _mediaPlayer.setDataSource(RTSP_URL);

           // Begin the process of setting up a video stream.
           _mediaPlayer.setOnPreparedListener(this);
           _mediaPlayer.prepareAsync();
       }
       catch (Exception e) {}
    }
    ...
    @Override
    public void onPrepared(MediaPlayer mp) {
       _mediaPlayer.start();
    }

    OK, so then I created a button to record.

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

           case R.id.IPcamrecord:
               if (ContextCompat.checkSelfPermission(this,
                       Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
                   takeIPvid();
               } else {
                   requestIPCamPermission();
               }

    .....

    requested permission then results.

       private void requestIPCamPermission() {
       if (ActivityCompat.shouldShowRequestPermissionRationale(this,
               Manifest.permission.WRITE_EXTERNAL_STORAGE)) {

           new AlertDialog.Builder(this)
                   .setTitle("Permission needed")
                   .setMessage("This permission is needed do to android safety protocol")
                   .setPositiveButton("ok", new DialogInterface.OnClickListener() {
                       @Override
                       public void onClick(DialogInterface dialog, int which) {
                           ActivityCompat.requestPermissions(MainActivity.this,
                                   new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, 420);
                       }
                   })
                   .setNegativeButton("cancel", new DialogInterface.OnClickListener() {
                       @Override
                       public void onClick(DialogInterface dialog, int which) {
                           dialog.dismiss();
                       }
                   })
                   .create().show();

       } else {
           ActivityCompat.requestPermissions(this,
                   new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, 420);
       }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {

       if (requestCode == 420)  {
           if (grantResults.length > 0 &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED) {
               takeIPvid();
           } else {
               Toast.makeText(this, "Permission DENIED", Toast.LENGTH_SHORT).show();
           }
    .....

    then I made the file provider and createVideoOutputFile() method and the takeIPvid method.

    private File createVideoOutputFile() throws IOException {
       String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
       String imageFileName = "IPcam_" + timeStamp + "_";
       IPstorageDir = getExternalFilesDir(Environment.DIRECTORY_MOVIES);
       IPvideo_file = File.createTempFile(
               imageFileName,  /* prefix */
               ".mp4",         /* suffix */
               IPstorageDir      /* directory */
       );

       // Save a file: path for use with ACTION_VIEW intents
       String IPmVideoFilename = IPvideo_file.getAbsolutePath();
       return IPvideo_file;
    }

      private void takeIPvid() {

           File ipfile = null;
           try {
               ipfile = createVideoOutputFile();
           } catch (IOException e) {
               e.printStackTrace();
           }
       IPvideo_uri = FileProvider.getUriForFile(this,
               "com.example.android.fileprovider",
               ipfile);


       String[] cmd = {"-y", "-i", "rtsp://Login:Passord@IP:port/video.h264", "-acodec", "copy", "-vcodec", "copy","-t","00:00:20", IPvideo_uri.toString() };

       FFmpeg.getInstance(this).execute(cmd,new ExecuteBinaryResponseHandler(){

           @Override
           public void onStart() {
               super.onStart();


           }

           @Override
           public void onFailure(String message) {
               super.onFailure(message);



           }

           @Override
           public void onSuccess(String message) {
               super.onSuccess(message);


           }

           @Override
           public void onProgress(String message) {
               super.onProgress(message);

           }

           @Override
           public void onFinish() {
               super.onFinish();

           }
       });

    }
  • Why does ffmpeg need DNS resolver as its dependencies ?

    20 décembre 2019, par Kshitij

    I was installing FFmpeg and libav today using brew install ffmpeg libav when I noticed unbound in the dependencies list.

    It’s very strange because unbound is DNS resolver and why ffmpeg would need it.

    ❯ brew install ffmpeg libav
    ==> Installing dependencies for ffmpeg: aom, frei0r, gmp, libtasn1, nettle, p11-kit, unbound, gnutls, lame, libass, libbluray, libsoxr, libvidstab, libvpx, opencore-amr, opus, libsndfile, libsamplerate, rubberband, sdl2, speex, giflib, leptonica, tesseract, theora, x264, x265 and xvid

    I even checked the info list for ffmpeg but unbound was not present there

    ❯ brew info ffmpeg
    ffmpeg: stable 4.2.1 (bottled), HEAD
    Play, record, convert, and stream audio and video
    https://ffmpeg.org/
    /usr/local/Cellar/ffmpeg/4.2.1_2 (287 files, 56.6MB)*
    - Poured from bottle on 2019-12-19 at 10:45:56
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ffmpeg.rb
    ==> Dependencies
    Build: nasm ✘, pkg-config ✔, texi2html ✘
    Required: aom ✔, fontconfig ✔, freetype ✔, frei0r ✔, gnutls ✔, lame ✔, libass ✔, libbluray ✔, libsoxr ✔, libvidstab ✔, libvorbis ✔, libvpx ✔, opencore-amr ✔, openjpeg ✔, opus ✔, rtmpdump ✔, rubberband ✔, sdl2 ✔, snappy ✔, speex ✔, tesseract ✔, theora ✔, x264 ✔, x265 ✔, xvid ✔, xz ✔
    ==> Options
    --HEAD
       Install HEAD version
    ==> Analytics
    install: 66,434 (30 days), 280,128 (90 days), 1,079,492 (365 days)
    install-on-request: 48,053 (30 days), 203,583 (90 days), 759,254 (365 days)
    build-error: 0 (30 days)

    Links for reference