Recherche avancée

Médias (0)

Mot : - Tags -/clipboard

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (49)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

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

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (5515)

  • Camera app fails on android ffmpeg application

    22 mars 2021, par connor449

    I am trying to run a simple video recorder app on android. The code is below :

    


    package com.example.camera&#xA;&#xA;//import android.R&#xA;import android.content.DialogInterface&#xA;import android.content.pm.PackageManager&#xA;import android.os.Build&#xA;import android.os.Bundle&#xA;import android.widget.Toast&#xA;import androidx.appcompat.app.AlertDialog&#xA;import androidx.appcompat.app.AppCompatActivity&#xA;import androidx.core.app.ActivityCompat&#xA;import androidx.core.content.ContextCompat&#xA;import com.arthenica.mobileffmpeg.FFmpeg&#xA;&#xA;&#xA;const val EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"&#xA;&#xA;class MainActivity : AppCompatActivity() {&#xA;    override fun onCreate(savedInstanceState: Bundle?) {&#xA;        super.onCreate(savedInstanceState)&#xA;        setContentView(R.layout.activity_main)&#xA;        if (checkPermission()) {&#xA;            //main logic or main code&#xA;           FFmpeg.execute("-f android_camera -i 0:0 -r 30 -pixel_format bgr0 -t 00:00:05 /sdcard/test.mp4")&#xA;&#xA;            // . write your main code to execute, It will execute if the permission is already given.&#xA;        } else {&#xA;            requestPermission()&#xA;        }&#xA;    }&#xA;&#xA;    private fun checkPermission(): Boolean {&#xA;        return if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA)&#xA;            != PackageManager.PERMISSION_GRANTED&#xA;        ) {&#xA;            // Permission is not granted&#xA;            false&#xA;        } else true&#xA;    }&#xA;&#xA;    private fun requestPermission() {&#xA;        ActivityCompat.requestPermissions(&#xA;            this, arrayOf(android.Manifest.permission.CAMERA),&#xA;            PERMISSION_REQUEST_CODE&#xA;        )&#xA;    }&#xA;&#xA;    override fun onRequestPermissionsResult(&#xA;        requestCode: Int,&#xA;        permissions: Array<string>,&#xA;        grantResults: IntArray&#xA;    ) {&#xA;        when (requestCode) {&#xA;            PERMISSION_REQUEST_CODE -> if (grantResults.size > 0 &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED&#xA;            ) {&#xA;                Toast.makeText(applicationContext, "Permission Granted", Toast.LENGTH_SHORT)&#xA;                    .show()&#xA;&#xA;                // main logic&#xA;            } else {&#xA;                Toast.makeText(applicationContext, "Permission Denied", Toast.LENGTH_SHORT)&#xA;                    .show()&#xA;                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {&#xA;                    if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA)&#xA;                        != PackageManager.PERMISSION_GRANTED&#xA;                    ) {&#xA;                        showMessageOKCancel("You need to allow access permissions",&#xA;                            DialogInterface.OnClickListener { dialog, which ->&#xA;                                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {&#xA;                                    requestPermission()&#xA;                                }&#xA;                            })&#xA;                    }&#xA;                }&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    private fun showMessageOKCancel(&#xA;        message: String,&#xA;        okListener: DialogInterface.OnClickListener&#xA;    ) {&#xA;        AlertDialog.Builder(this@MainActivity)&#xA;            .setMessage(message)&#xA;            .setPositiveButton("OK", okListener)&#xA;            .setNegativeButton("Cancel", null)&#xA;            .create()&#xA;            .show()&#xA;    }&#xA;&#xA;    companion object {&#xA;        private const val PERMISSION_REQUEST_CODE = 200&#xA;    }&#xA;}&#xA;&#xA;&#xA;</string>

    &#xA;

    The main command to call the video recorder is here :

    &#xA;

               FFmpeg.execute("-f android_camera -i 0:0 -r 30 -pixel_format bgr0 -t 00:00:05 /sdcard/test.mp4")&#xA;

    &#xA;

    The app opens on my android 10 Motorola G Power. I tap 'allow' for allowing permissions. Then the app crashes and I keep getting this error :

    &#xA;

    2021-03-22 13:42:51.534 31138-31138/com.example.camera E/AndroidRuntime: FATAL EXCEPTION: main&#xA;    Process: com.example.camera, PID: 31138&#xA;    java.lang.IllegalStateException: Could not find method sendMessage(View) in a parent or ancestor Context for android:onClick attribute defined on view class com.google.android.material.button.MaterialButton with id &#x27;button2&#x27;&#xA;        at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.resolveMethod(AppCompatViewInflater.java:436)&#xA;        at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:393)&#xA;        at android.view.View.performClick(View.java:7161)&#xA;        at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:967)&#xA;        at android.view.View.performClickInternal(View.java:7133)&#xA;        at android.view.View.access$3500(View.java:804)&#xA;        at android.view.View$PerformClick.run(View.java:27416)&#xA;        at android.os.Handler.handleCallback(Handler.java:883)&#xA;        at android.os.Handler.dispatchMessage(Handler.java:100)&#xA;        at android.os.Looper.loop(Looper.java:241)&#xA;        at android.app.ActivityThread.main(ActivityThread.java:7617)&#xA;        at java.lang.reflect.Method.invoke(Native Method)&#xA;        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)&#xA;        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)&#xA;2021-03-22 13:42:51.546 31138-31138/com.example.camera I/Process: Sending signal. PID: 31138 SIG: 9&#xA;

    &#xA;

    What am I doing wrong ? Please advise.

    &#xA;

    edit

    &#xA;

    layout xml

    &#xA;

    &lt;?xml version="1.0" encoding="utf-8"?>&#xA;&#xA;&#xA;    &#xA;&#xA;    &#xA;&#xA;

    &#xA;

  • Obtaining frames from IP Camera with low latency

    5 février 2023, par Russ1337

    I am currently using this command to get frames from my RTSP stream and reading frames from stdout :

    &#xA;

    ffmpeg -nostdin -rtsp_transport tcp -i  -pix_fmt bgr24 -an -vcodec rawvideo -f rawvideo -&#xA;

    &#xA;

    However, I would like to get the same latency as when I see it via ffplay :

    &#xA;

    ffplay -fflags nobuffer -flags low_delay -tune zerolatency -framedrop -rtsp_transport tcp &#xA;

    &#xA;

    or when I play it via VLC Media > Open Network Stream with :network_caching=300ms.

    &#xA;

    I would like to know what other parameters I can use with my ffmpeg command to get an equivalent (or better) result compared to the ffplay command.

    &#xA;

    I have made references from : How to dump raw RTSP stream to file ?, Open CV RTSP camera buffer lag, How to pipe output from ffmpeg using python ?, bad ffmpeg performace compared to ffplay and VLC, How to minimize the delay in a live streaming with ffmpeg

    &#xA;

    My current implmentation :

    &#xA;

    FFMPEG_CMD = "ffmpeg -nostdin -rtsp_transport tcp -i  -pix_fmt bgr24 -an -vcodec rawvideo -f rawvideo -".split(" ")&#xA;WIDTH = 2560&#xA;HEIGHT = 1440&#xA;&#xA;process = subprocess.Popen(FFMPEG_CMD, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)&#xA;&#xA;while True:&#xA;    raw_frame = process.stdout.read(WIDTH*HEIGHT*3)&#xA;    frame = np.frombuffer(raw_frame, np.uint8) &#xA;    frame = frame.reshape((HEIGHT, WIDTH, 3))&#xA;&#xA;    <do stuff="stuff" with="with" frame="frame"></do> show frame etc.>&#xA;

    &#xA;

    Thanks for reading.

    &#xA;


    &#xA;

    ffmpeg command I am now using for < 1s latency.

    &#xA;

    ffmpeg -nostdin -flags low_delay -rtsp_transport tcp -i  -pix_fmt bgr24 -an -vcodec rawvideo -f rawvideo -&#xA;

    &#xA;


    &#xA;

    Implementation with suggestion(s) from Answers :

    &#xA;

    import subprocess&#xA;import numpy as np&#xA;&#xA;FFMPEG_CMD = "ffmpeg -nostdin -flags low_delay -rtsp_transport tcp -i  -pix_fmt bgr24 -an -vcodec rawvideo -f rawvideo -".split(" ")&#xA;WIDTH = 2560&#xA;HEIGHT = 1440&#xA;&#xA;process = subprocess.Popen(FFMPEG_CMD, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)&#xA;&#xA;raw_frame = np.empty((HEIGHT, WIDTH, 3), np.uint8) &#xA;frame_bytes = memoryview(raw_frame).cast("B")&#xA;&#xA;while process.poll() is None:&#xA;    process.stdout.readinto(frame_bytes)&#xA;    frame = raw_frame.reshape((HEIGHT, WIDTH, 3))&#xA;&#xA;    <do stuff="stuff" with="with" frame="frame"></do> show frame etc.>&#xA;

    &#xA;

  • Android IP Camera

    23 décembre 2014, par CptCattivo

    I’m looking for a good working solution to integrate an IP-Cameras video stream in my Android App. At the moment i am using the "Axis P1214-E" which has a good image quality, but i couldn’t get a "LIVE" stream from it. Either the stream is very laggy or it’s a few seconds delayed (sometimes even more) or the stream is shutting down after awhile. What i tried so far :

    • Using a SurfaceView to get the MJPEG Stream as described in this post : Android and MJPEG
      Problem : Lagging

    • Using a WebView to get the RTSP stream :

    public class MainActivity extends Activity {

            private static final String TAG = "VideoViewExample.MainActivity";
            private static final String RTSP_URL = "rtsp://ip/axis-media/media.amp";
           
           
            private VideoView videoView;
            private MediaController mediaController;

            private OnPreparedListener opl;

            private int position = 0;

           
       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_main);
           
           if(savedInstanceState != null)
               position = savedInstanceState.getInt("POSITION");
           
           
           videoView = (VideoView) findViewById(R.id.videoView);        
         
           
           opl = new OnPreparedListener() {
                           
                            @Override
                            public void onPrepared(MediaPlayer mp) {
                                                                   
                                    videoView.seekTo(position);
                                   
                                    if (position == 0) {
                                            videoView.start();
                                    }
                                    else {
                                           
                                            videoView.pause();
                                    }                               
                            }
                    };
           
           if (mediaController == null){
                   mediaController = new MediaController(this);
           }
           
           mediaController.setAnchorView(videoView);
           
           AsyncTask at = new AsyncTask() {

                            @Override
                            protected Void doInBackground(Void... params) {
                                    try{
                                    videoView.setMediaController(mediaController);                           
                                videoView.setVideoURI(Uri.parse(RTSP_URL));
                            } catch (Exception e) {
                                    Log.d(TAG, e.getMessage());
                            }
                                   
                            videoView.requestFocus();
                            videoView.setOnPreparedListener(opl);                       
                           
                                    return null;
                            }
                  
                    };
           at.execute();
           
       }
       
       @Override
       protected void onPause() {
           position = videoView.getCurrentPosition();
           super.onPause();
       }
       
       @Override
       public void onSaveInstanceState(Bundle outState) {
              
               super.onSaveInstanceState(outState);
               outState.putInt("POSITION", position);      
           
       }

    }

    Problem : Good video Quality, but delayed.

    • Using external frameworks like FFMPEG and GSTREAMER (Only some examples so far)
      Problem : Also very laggy and/or delayed.

    Now i’m running out of ideas to get this working. It’s very important for my Application that the stream is live and not lagging.
    I’m developing on a "Banana Pi" board with Android 4.2.2 (4.4 is possible as well).

    Does anybody know how to get this working ? Or maybe should i use an other camera ? Do you have any suggestions that would work well with android ?

    Thanks in advance

    Christian