Recherche avancée

Médias (91)

Autres articles (40)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The 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 2013

    Puis-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, par

    MediaSPIP 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 Rheinhardt
    avutil/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 Vikrant

    What the code is doing ?

    &#xA;

      &#xA;
    • Collecting live frames from IP camera, adding date-time on the frame using OpenCV.
    • &#xA;

    • Using cv2.imshow(&#x27;preview&#x27;,frame), we display live feed.
    • &#xA;

    • Now same frame(s) are also sent to other RTSP Server on port 8554 using FFMpeg
    • &#xA;

    &#xA;

    Using the code

    &#xA;

      &#xA;
    • Using VLC, FFMPEG Stream is visible with date-time over it.
    • &#xA;

    &#xA;

    Why I am doing this ?

    &#xA;

      &#xA;
    • To create a custom RTSP stream with modifications over camera feed.
    • &#xA;

    &#xA;

    Defining Issue :

    &#xA;

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

    &#xA;

    Following is the code :

    &#xA;

    import cv2&#xA;import subprocess&#xA;import threading&#xA;import datetime&#xA;&#xA;rtsp_width = 1280&#xA;rtsp_height = 720&#xA;&#xA;#system stream&#xA;rtsp_url = "rtsp://ip_address:8554/system/cam_preview" &#xA;&#xA;command = [&#x27;ffmpeg&#x27;,&#xA;        &#x27;-fflags&#x27;, &#x27;nobuffer&#x27;,&#xA;        &#x27;-flags&#x27;, &#x27;low_delay&#x27;,&#xA;        &#x27;-loglevel&#x27; , &#x27;0&#x27;,   &#xA;        &#x27;-analyzeduration&#x27;, &#x27;0&#x27;, &#xA;        &#x27;-re&#x27;,&#xA;        &#x27;-y&#x27;,&#xA;        &#x27;-init_hw_device&#x27;, &#x27;cuda:0&#x27;,&#xA;        &#x27;-hwaccel&#x27;, &#x27;cuda&#x27;,&#xA;        &#x27;-hwaccel_output_format&#x27;, &#x27;cuda&#x27;,    &#xA;        &#x27;-f&#x27;, &#x27;rawvideo&#x27;,&#xA;        &#x27;-vcodec&#x27;, &#x27;rawvideo&#x27;,&#xA;        &#x27;-pix_fmt&#x27;, &#x27;bgr24&#x27;,&#xA;        &#x27;-s&#x27;, "{}x{}".format(rtsp_width, rtsp_height),             &#xA;        &#x27;-r&#x27;, "15",&#xA;        &#x27;-an&#x27;,                  &#xA;        &#x27;-i&#x27;, &#x27;-&#x27;,   &#xA;        &#x27;-g&#x27;, &#x27;15&#x27;,    &#xA;        &#x27;-c:v&#x27;, &#x27;h264_nvenc&#x27;,&#xA;        &#x27;-use_wallclock_as_timestamps&#x27;, &#x27;1&#x27;,&#xA;        &#x27;-f&#x27;, &#x27;rtsp&#x27;,     &#xA;        &#x27;-rtsp_transport&#x27;,&#x27;tcp&#x27;,&#xA;        str(rtsp_url)]&#xA;    &#xA;print("MAIN > RTSP URL:", str(rtsp_url))&#xA;&#xA;process = subprocess.Popen(command, stdin=subprocess.PIPE)&#xA;&#xA;#camera rtsp url&#xA;path = "rtsp://username:password@ip_address/axis-media/media.amp" &#xA;&#xA;cap = cv2.VideoCapture(path)&#xA;&#xA;def read_frames():&#xA;    global process&#xA;&#xA;    while True:&#xA;        if cap.grab():&#xA;            ret, frame = cap.retrieve()&#xA;            if ret:    &#xA;                date_format = &#x27;%Y-%m-%d %H:%M:%S&#x27;&#xA;                today_str = datetime.datetime.now().strftime(date_format)&#xA;                cv2.rectangle(frame, (445,5), (580,20), (0,0,0), -1)&#xA;                cv2.putText(frame,today_str,(450,15), cv2.FONT_HERSHEY_SIMPLEX, 0.35, (255, 255, 255), 1 )                      &#xA;                process.stdin.write(frame.tobytes())&#xA;                cv2.imshow(&#x27;preview&#x27;,frame)&#xA;            else:&#xA;                print("Error grabbing frame")&#xA;                cap.release()&#xA;                process.kill()&#xA;                cv2.destroyAllWindows()           &#xA;                break&#xA;        if cv2.waitKey(1) &amp; 0xFF == ord(&#x27;q&#x27;):&#xA;            cap.release()&#xA;            process.kill()&#xA;            cv2.destroyAllWindows()&#xA;            break&#xA;&#xA;thread = threading.Thread(target=lambda: read_frames())&#xA;thread.start()&#xA;

    &#xA;

    Things to note

    &#xA;

    cv2 package is compiled with CUDA ARCH 7.5

    &#xA;

    Following are some FFMpeg research parameters :

    &#xA;

       &#x27;-fflags&#x27;, &#x27;nobuffer&#x27;,&#xA;&#xA;   &#x27;-flags&#x27;, &#x27;low_delay&#x27;,&#xA;&#xA;   &#x27;-tune&#x27;, &#x27;zerolatency&#x27;&#xA;

    &#xA;

    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.&#xA;How to reduce this latency ?

    &#xA;

  • How To Call JAVA Methods from inside of a Thread in JNI

    16 novembre 2019, par Falcuun

    TL ;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 have JNIEnv* && 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 pass JNIEnv and jobject and assign those to global variables

    JNIEnv* 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(&amp;m_jvm);

    After that, in my onFrame I call
    jvm->AttachCurrentThread(&amp;m_globalEnv, NULL);
    And then I try to call a JAVA method from somewhere inside the code (It’s irrelevant where/when in the onFrame 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 the jni.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);