
Recherche avancée
Autres articles (52)
-
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;
Sur d’autres sites (8493)
-
Revision 6241 : mauvais article de doc
28 novembre 2011, par kent1 — Logmauvais article de doc
-
How To Call JAVA Methods from inside of a Thread in JNI
16 novembre 2019, par FalcuunTL ;DR ; I’m having a problem with passing my FFMPEG raw data from C++ code to JAVA code, for displaying, through a thread.
There is a server set up that sends out encoded frames to its clients. Those encoded frames are encoded with some FFMPEG magic. When received on client side, the fore-mentioned frames are getting decoded into raw RGB data (as a unsigned char *). The problem now is that frames are being received in a "listener" of sorts. Just a thread running in the background polling the server and running specific
onFrame
function once a new frame is available.The current solution for displaying the frames in a video-format is to save each frame to internal storage in C++, and then have a
FileObserver
on java side that displays an image as soon as it’s written in the memory. Sadly, that approach yields a 6 FPS video on phone, for a 10 FPS video from Server.I need a way of passing that unsigned char * (jbytearray) to my JAVA code so I can decode it and display it from RAM rather than Disk.
It’s worth mentioning that
onFrame
function cannot haveJNIEnv*
&&jobject
inside it’s arguments list (Library requirements).What I have tried so far is making a native method in my
MainActivity
through which I passJNIEnv
andjobject
and assign those to global variablesJNIEnv* m_globalEnv = env;
jobject m_globalObject = thiz;
JavaVM m_jvm = 0;
jclass mainActivity = m_globalEnv->GetObjectClass(m_globalObject);
jmethodID testMethod = m_globalEnv->GetMethodID(mainClass, "testMethod", "(I)V");
m_globalEnv->GetJavaVM(&m_jvm);After that, in my
onFrame
I call
jvm->AttachCurrentThread(&m_globalEnv, NULL);
And then I try to call a JAVA method from somewhere inside the code (It’s irrelevant where/when in theonFrame
I call it) by doing :m_globalEnv->CallVoidMethod(m_globalObject, "testMethod", 5);
And then all crashes with either :
1- JNI DETECTED ERROR IN APPLICATION: use of invalid jobject 0xffe8ea7c
2- JNI DETECTED ERROR IN APPLICATION: Thread is making JNI calls without being attached
.
.
.EDIT 1
After Trying out the code from Michael’s solution, I got the
java_vm_ext.cc:542] JNI DETECTED ERROR IN APPLICATION: use of invalid jobject 0xc94f7f8c
error.
After running the app in debug mode to catch the error, I got to thejni.h
; Line of code that triggers the error is :
m_env->CallVoidMethod(m_globalObject, testMethod, 5);
(5 being the number I am trying to pass for testing purposes).
The line of code inside jni.h that is being highlighted by the debugger is inside of
void CallVoidMethod(jobject obj, jmethodID methodID, ...)
and it’s
functions->CallVoidMethodV(this, obj, methodID, args);
which is defined on line 228 :
void (*CallVoidMethodV)(JNIEnv*, jobject, jmethodID, va_list);
-
Javacv : Mat data becomes null after using methods
5 avril 2017, par rarroubaI’m working on an android application for object detection and counting. For the image processing I am using JavaCV (Java wrapper for OpenCV and FFmpeg). After importing the library, I’m able to successfully use the FFmpegFrameGrabber to get the frames of a video.
My problem : After I convert the Frame to a Mat object and perform some operation on that Mat object the data becomes null.
Code :
MainActivity
public class MainActivity extends AppCompatActivity {
OpenCVFrameConverter.ToMat converterToMat = new OpenCVFrameConverter.ToMat();
private CountModule countModule;
FFmpegFrameGrabber retriever;
ArrayList frames;
boolean frameloaded = false;
File folder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);
File video = new File(folder, "test.mp4");
AndroidFrameConverter converterToBitmap = new AndroidFrameConverter();
private static WebStreamer webStreamer;
static {
System.loadLibrary("native-lib");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button button = (Button) findViewById(R.id.btnLdFrames);
final ImageView img = (ImageView) findViewById(R.id.imageView);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
((TextView) button).setText("Loading");
new Thread(new Runnable() {
public void run() {
try {
button.setClickable(false);
button.setAlpha((float) 0.3);
LoadFrames();
button.setAlpha((float) 1);
} catch (FrameGrabber.Exception e) {
e.printStackTrace();
}
}
}).start();
}
});
}
private void LoadFrames() throws FrameGrabber.Exception {
if (!frameloaded){
frameloaded = true;
retriever = new FFmpegFrameGrabber(video);
frames = new ArrayList<>();
Log.d("Frame",": Start of loop");
retriever.start();
final ImageView img = (ImageView) findViewById(R.id.imageView);
for (int i=0;i<50;i++){//155430
retriever.setFrameNumber(i*100);
Frame temp = new Frame();
temp = retriever.grab();
frames.add(converterToMat.convert(temp));
Log.d("Frame",": " + i*100);
}
retriever.stop();
countModule = new CountModule(frames);
Log.d("Frame","CountModule instantiated");
}
}
}Constructor of Countmodule
public CountModule(ArrayList<mat> frames){
fgGBG = new Mat(frames.get(0).rows(),frames.get(0).cols(),frames.get(0).type());
gbg = createBackgroundSubtractorMOG2();
Mat maTemp = new Mat(frames.get(0).rows(),frames.get(0).cols(),frames.get(0).type());
median = new Mat(frames.get(0).rows(),frames.get(0).cols(),frames.get(0).type());
frames.get(0).copyTo(median);
;
median = getMedian(frames);
kernel2 = Mat.ones(11,11,CV_8U).asMat();
kernel = Mat.ones(3,1,CV_8U).asMat();
gbg.apply(median,fgGBG,0.001);
}
</mat>Variables (images) :
After convert from Frame to Mat. Data has values.
As you can see everytime I use a OpenCV specific method, the returned Mat is not what is expected.