
Recherche avancée
Médias (91)
-
999,999
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Demon seed (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
The four of us are dying (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Corona radiata (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Lights in the sky (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
Autres articles (40)
-
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Menus personnalisés
14 novembre 2010, parMediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
Menus créés à l’initialisation du site
Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)
Sur d’autres sites (6340)
-
avutil/float_dsp : Unavpriv avpriv_scalarproduct_float_c()
15 mars, par Andreas Rheinhardtavutil/float_dsp : Unavpriv avpriv_scalarproduct_float_c()
Not worth the overhead of exporting it.
Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by : James Almer <jamrial@gmail.com>- [DH] libavcodec/Makefile
- [DH] libavcodec/acelp_pitch_delay.c
- [DH] libavcodec/acelp_vectors.c
- [DH] libavcodec/float_scalarproduct.c
- [DH] libavcodec/qcelpdec.c
- [DH] libavcodec/ra288.c
- [DH] libavcodec/sipr.c
- [DH] libavcodec/sipr16k.c
- [DH] libavcodec/wmavoice.c
- [DH] libavutil/Makefile
- [DH] libavutil/float_dsp.c
- [DH] libavutil/float_dsp.h
- [DH] libavutil/float_scalarproduct.c
-
FFMpeg delay while streaming RTSP Stream
15 mars 2024, par VikrantWhat the code is doing ?


- 

- Collecting live frames from IP camera, adding date-time on the frame using OpenCV.
- Using
cv2.imshow('preview',frame)
, we display live feed. - Now same frame(s) are also sent to other RTSP Server on port 8554 using FFMpeg








Using the code


- 

- Using VLC, FFMPEG Stream is visible with date-time over it.




Why I am doing this ?


- 

- To create a custom RTSP stream with modifications over camera feed.




Defining Issue :


There is around 3-4 seconds delay / latency in the stream on VLC via FFMpeg as compared to original preview using OpenCV
imshow
.

Following is the code :


import cv2
import subprocess
import threading
import datetime

rtsp_width = 1280
rtsp_height = 720

#system stream
rtsp_url = "rtsp://ip_address:8554/system/cam_preview" 

command = ['ffmpeg',
 '-fflags', 'nobuffer',
 '-flags', 'low_delay',
 '-loglevel' , '0', 
 '-analyzeduration', '0', 
 '-re',
 '-y',
 '-init_hw_device', 'cuda:0',
 '-hwaccel', 'cuda',
 '-hwaccel_output_format', 'cuda', 
 '-f', 'rawvideo',
 '-vcodec', 'rawvideo',
 '-pix_fmt', 'bgr24',
 '-s', "{}x{}".format(rtsp_width, rtsp_height), 
 '-r', "15",
 '-an', 
 '-i', '-', 
 '-g', '15', 
 '-c:v', 'h264_nvenc',
 '-use_wallclock_as_timestamps', '1',
 '-f', 'rtsp', 
 '-rtsp_transport','tcp',
 str(rtsp_url)]
 
print("MAIN > RTSP URL:", str(rtsp_url))

process = subprocess.Popen(command, stdin=subprocess.PIPE)

#camera rtsp url
path = "rtsp://username:password@ip_address/axis-media/media.amp" 

cap = cv2.VideoCapture(path)

def read_frames():
 global process

 while True:
 if cap.grab():
 ret, frame = cap.retrieve()
 if ret: 
 date_format = '%Y-%m-%d %H:%M:%S'
 today_str = datetime.datetime.now().strftime(date_format)
 cv2.rectangle(frame, (445,5), (580,20), (0,0,0), -1)
 cv2.putText(frame,today_str,(450,15), cv2.FONT_HERSHEY_SIMPLEX, 0.35, (255, 255, 255), 1 ) 
 process.stdin.write(frame.tobytes())
 cv2.imshow('preview',frame)
 else:
 print("Error grabbing frame")
 cap.release()
 process.kill()
 cv2.destroyAllWindows() 
 break
 if cv2.waitKey(1) & 0xFF == ord('q'):
 cap.release()
 process.kill()
 cv2.destroyAllWindows()
 break

thread = threading.Thread(target=lambda: read_frames())
thread.start()



Things to note


cv2 package is compiled with CUDA ARCH 7.5


Following are some FFMpeg research parameters :


'-fflags', 'nobuffer',

 '-flags', 'low_delay',

 '-tune', 'zerolatency'



Few others, but they did not made any impact over latency, on average about 4 seconds of delay might worth be reducing, for applications like motion-tracking, object-detection.
How to reduce this latency ?


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