
Recherche avancée
Autres articles (49)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne 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, parCertains 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, parMediaSPIP 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 connor449I am trying to run a simple video recorder app on android. The code is below :


package com.example.camera

//import android.R
import android.content.DialogInterface
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.arthenica.mobileffmpeg.FFmpeg


const val EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"

class MainActivity : AppCompatActivity() {
 override fun onCreate(savedInstanceState: Bundle?) {
 super.onCreate(savedInstanceState)
 setContentView(R.layout.activity_main)
 if (checkPermission()) {
 //main logic or main code
 FFmpeg.execute("-f android_camera -i 0:0 -r 30 -pixel_format bgr0 -t 00:00:05 /sdcard/test.mp4")

 // . write your main code to execute, It will execute if the permission is already given.
 } else {
 requestPermission()
 }
 }

 private fun checkPermission(): Boolean {
 return if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA)
 != PackageManager.PERMISSION_GRANTED
 ) {
 // Permission is not granted
 false
 } else true
 }

 private fun requestPermission() {
 ActivityCompat.requestPermissions(
 this, arrayOf(android.Manifest.permission.CAMERA),
 PERMISSION_REQUEST_CODE
 )
 }

 override fun onRequestPermissionsResult(
 requestCode: Int,
 permissions: Array<string>,
 grantResults: IntArray
 ) {
 when (requestCode) {
 PERMISSION_REQUEST_CODE -> if (grantResults.size > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED
 ) {
 Toast.makeText(applicationContext, "Permission Granted", Toast.LENGTH_SHORT)
 .show()

 // main logic
 } else {
 Toast.makeText(applicationContext, "Permission Denied", Toast.LENGTH_SHORT)
 .show()
 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
 if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA)
 != PackageManager.PERMISSION_GRANTED
 ) {
 showMessageOKCancel("You need to allow access permissions",
 DialogInterface.OnClickListener { dialog, which ->
 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
 requestPermission()
 }
 })
 }
 }
 }
 }
 }

 private fun showMessageOKCancel(
 message: String,
 okListener: DialogInterface.OnClickListener
 ) {
 AlertDialog.Builder(this@MainActivity)
 .setMessage(message)
 .setPositiveButton("OK", okListener)
 .setNegativeButton("Cancel", null)
 .create()
 .show()
 }

 companion object {
 private const val PERMISSION_REQUEST_CODE = 200
 }
}


</string>


The main command to call the video recorder is here :


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



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 :


2021-03-22 13:42:51.534 31138-31138/com.example.camera E/AndroidRuntime: FATAL EXCEPTION: main
 Process: com.example.camera, PID: 31138
 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 'button2'
 at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.resolveMethod(AppCompatViewInflater.java:436)
 at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:393)
 at android.view.View.performClick(View.java:7161)
 at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:967)
 at android.view.View.performClickInternal(View.java:7133)
 at android.view.View.access$3500(View.java:804)
 at android.view.View$PerformClick.run(View.java:27416)
 at android.os.Handler.handleCallback(Handler.java:883)
 at android.os.Handler.dispatchMessage(Handler.java:100)
 at android.os.Looper.loop(Looper.java:241)
 at android.app.ActivityThread.main(ActivityThread.java:7617)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
2021-03-22 13:42:51.546 31138-31138/com.example.camera I/Process: Sending signal. PID: 31138 SIG: 9



What am I doing wrong ? Please advise.


edit


layout xml


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


 

 




-
Obtaining frames from IP Camera with low latency
5 février 2023, par Russ1337I am currently using this command to get frames from my RTSP stream and reading frames from stdout :


ffmpeg -nostdin -rtsp_transport tcp -i -pix_fmt bgr24 -an -vcodec rawvideo -f rawvideo -



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


ffplay -fflags nobuffer -flags low_delay -tune zerolatency -framedrop -rtsp_transport tcp 



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


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.


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


My current implmentation :


FFMPEG_CMD = "ffmpeg -nostdin -rtsp_transport tcp -i -pix_fmt bgr24 -an -vcodec rawvideo -f rawvideo -".split(" ")
WIDTH = 2560
HEIGHT = 1440

process = subprocess.Popen(FFMPEG_CMD, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)

while True:
 raw_frame = process.stdout.read(WIDTH*HEIGHT*3)
 frame = np.frombuffer(raw_frame, np.uint8) 
 frame = frame.reshape((HEIGHT, WIDTH, 3))

 <do stuff="stuff" with="with" frame="frame"></do> show frame etc.>



Thanks for reading.



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

ffmpeg -nostdin -flags low_delay -rtsp_transport tcp -i -pix_fmt bgr24 -an -vcodec rawvideo -f rawvideo -




Implementation with suggestion(s) from Answers :


import subprocess
import numpy as np

FFMPEG_CMD = "ffmpeg -nostdin -flags low_delay -rtsp_transport tcp -i -pix_fmt bgr24 -an -vcodec rawvideo -f rawvideo -".split(" ")
WIDTH = 2560
HEIGHT = 1440

process = subprocess.Popen(FFMPEG_CMD, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)

raw_frame = np.empty((HEIGHT, WIDTH, 3), np.uint8) 
frame_bytes = memoryview(raw_frame).cast("B")

while process.poll() is None:
 process.stdout.readinto(frame_bytes)
 frame = raw_frame.reshape((HEIGHT, WIDTH, 3))

 <do stuff="stuff" with="with" frame="frame"></do> show frame etc.>



-
Android IP Camera
23 décembre 2014, par CptCattivoI’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
-