Recherche avancée

Médias (1)

Mot : - Tags -/framasoft

Autres articles (92)

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

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (10478)

  • How would I send x264 encoded frames correctly over a network using UDP ?

    5 avril 2020, par Eoin McBennett

    I'm trying to send the encoded h264 frames I have over a network as I get them, currently I'm only streaming the nal units I get from each frame as it is encoded, is this the correct approach ?

    



    I wrote a receiver application on a different computer to get the nals and wrote them all to a file sequentially, when played with vlc I didn't get any video and instead just got a screeching noise. I'm not sure exactly where the problem would lie here. I have included the result of the FFmpeg -I command on the file created.

    



    Encoder and sender code

    



    
    //Udp initialisation
    struct sockaddr_in broadcastAddr;
    int sock;
    int yes = 1;
    int addr_len;
    int count;
    fd_set readfd;
    char buffer[1024];
    int i;

    sock = socket(AF_INET, SOCK_DGRAM,0);

    if(sock < 0){
        std::cout << "Failed to initialise socket!" << std::endl;
    }

    int ret = setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char*)&yes, sizeof(yes));
    if(ret < 0){
        std::cout << "setsockopt error!" </ the size of the address

    memset((void*)&broadcastAddr,0,addr_len); //0 out the address bits

    broadcastAddr.sin_family = AF_INET;
    broadcastAddr.sin_addr.s_addr = INADDR_BROADCAST;
    broadcastAddr.sin_port = PORT;



    //Set the encoder parameters
    x264_param_t param;
    x264_param_default_preset(&param,"veryfast","zerolatency");
    param.i_threads = 1;
    param.i_width = camera.getWidth();
    param.i_height = camera.getHeight();
    param.i_fps_num = 30;
    param.i_fps_den = 1;
// Intra refres:
    param.i_keyint_max = 30;
    param.b_intra_refresh = 1;
//Rate control:
    param.rc.i_rc_method = X264_RC_CRF;
    param.rc.f_rf_constant = 25;
    param.rc.f_rf_constant_max = 35;
//For streaming:
    param.b_repeat_headers = 1;
    param.b_annexb = 1;
    x264_param_apply_profile(&param, "baseline");

    x264_t *encoder = x264_encoder_open(&param); //H.264 encoder object
    x264_picture_t pic_in, pic_out;
    x264_picture_alloc(&pic_in, X264_CSP_I420,camera.getWidth(), camera.getHeight());

    //Network abstraction layer units for broadcast
    x264_nal_t *nals;
    int i_nals;

    while(true){

        //If there is valid data in the processing queue
        if(!encoderQueue.empty()){

            //File the x264 input data structure with the file data
            fillImage(encoderQueue.front(),camera.getWidth(),camera.getHeight(),&pic_in);

            //Encode and send
            int frame_size = x264_encoder_encode(encoder, &nals, &i_nals, &pic_in, &pic_out);
            if (frame_size >= 0) {
                //The frame is ready to be sent over UDP!
                for(int i = 0; i < i_nals; i++){
                    ret = sendto(sock, &nals[0].p_payload, frame_size,0,(struct sockaddr*)&broadcastAddr,addr_len);
                    if(ret > 0){
                        std::cout << "Streamed frame nal unit " << i  << std::endl;
                    } else{
                        std::cout << "Failed to stream nal unit " << i << std::endl;
                    }
                }
            }
            else{
                std::cout<<"Failed to encode h264 frame!" << std::endl;
            }
            //Finsihed with the current frame, pop it off the queue and remove any nals to do with it
            encoderQueue.pop();
            frame_size = 0;
            nals = nullptr;
            i_nals = 0;
        }


    }


    



    Receiver application

    



    #include <iostream>&#xA;#include &#xA;#include <network></network>Network.h>&#xA;#include <netinet></netinet>in.h>&#xA;#include <arpa></arpa>inet.h>&#xA;#include <sys></sys>types.h>&#xA;#include <sys></sys>socket.h>&#xA;#include <queue>&#xA;&#xA;&#xA;#define BUFFER_LEN 10000&#xA;#define PORT_NO 3879&#xA;&#xA;&#xA;&#xA;int main(int argc, const char * argv[]) {&#xA;&#xA;&#xA;    FILE *file; //File to write the h264 nals too&#xA;&#xA;    //Declare the address memory space&#xA;    struct sockaddr_in sockAddr , bcAddr;&#xA;    socklen_t bcAddr_len = sizeof(&amp;bcAddr); //Store the length of the broadcast address structure&#xA;    //0 out the assigned memory&#xA;    memset(&amp;sockAddr, 0, sizeof(sockAddr));&#xA;    memset(&amp;bcAddr, 0 ,sizeof(bcAddr));&#xA;&#xA;    //Set the address parameters to look for incoming IpV4/UDP data&#xA;    sockAddr.sin_family = AF_INET;&#xA;    sockAddr.sin_port = htons(PORT_NO);&#xA;    sockAddr.sin_addr.s_addr = htonl(INADDR_ANY);&#xA;&#xA;    bcAddr.sin_family = AF_INET;&#xA;    bcAddr.sin_port = PORT_NO;&#xA;    inet_aton("255.255.255.255",&amp;bcAddr.sin_addr);&#xA;&#xA;    //Initialise a udp socket to read broadcast bytes&#xA;    int soc = socket(AF_INET, SOCK_DGRAM,0);&#xA;&#xA;    //Check socket init&#xA;    if(soc &lt; 0){&#xA;        std::cout &lt;&lt; "Failed to initialise UDP socket!" &lt;&lt; std::endl;&#xA;        return -1;&#xA;    }&#xA;&#xA;    //Bind the address details to the socket, check for errors&#xA;    if(bind(soc, (struct sockaddr*)&amp;sockAddr, sizeof(sockAddr)) &lt; 0){&#xA;        std::cout &lt;&lt; "Failed to bind address structure to socket!" &lt;&lt; std::endl;&#xA;        return -2;&#xA;    }&#xA;&#xA;    file = fopen("stream.h264","wb"); // Open the file for writing&#xA;&#xA;    unsigned char buffer[BUFFER_LEN];&#xA;&#xA;    while(true){&#xA;&#xA;&#xA;        memset(&amp;buffer, 0, sizeof(unsigned char) * BUFFER_LEN);&#xA;&#xA;        int recv_len = recvfrom(soc, buffer, BUFFER_LEN, 0, (struct sockaddr *)&amp;bcAddr, &amp;bcAddr_len);&#xA;&#xA;        std::cout&lt;&lt; "Received " &lt;&lt; recv_len &lt;&lt; "bytes on broadcast address" &lt;&lt; std::endl;&#xA;&#xA;        fwrite(&amp;buffer, sizeof(unsigned char), recv_len, file);&#xA;    }&#xA;&#xA;    return 0;&#xA;}&#xA;</queue></iostream>

    &#xA;&#xA;

    FFMPEG -I output

    &#xA;&#xA;

    FFMPEG -I output

    &#xA;&#xA;

    Any help would be greatly appreciated.

    &#xA;

  • network : Add RFC 8305 style "Happy Eyeballs"/"Fast Fallback" helper function

    10 août 2018, par Martin Storsjö
    network : Add RFC 8305 style "Happy Eyeballs"/"Fast Fallback" helper function
    

    For cases with dual stack (IPv4 + IPv6) connectivity, but where one
    stack potentially is less reliable, strive to trying to connect over
    both protocols in parallel, using whichever address connected first.

    In cases with a hostname resolving to multiple IPv4 and IPv6
    addresses, the current connection mechanism would try all addresses
    in the order returned by getaddrinfo (with all IPv6 addresses ordered
    before the IPv4 addresses normally). If connection attempts to the
    IPv6 addresses return quickly with an error, this was no problem, but
    if they were unsuccessful leading up to timeouts, the connection process
    would have to wait for timeouts on all IPv6 target addresses before
    attempting any IPv4 address.

    Similar to what RFC 8305 suggests, reorder the list of addresses to
    try connecting to, interleaving address families. After starting one
    connection attempt, start another one in parallel after a small delay
    (200 ms as suggested by the RFC).

    For cases with unreliable IPv6 but reliable IPv4, this should make
    connection attempts work as reliably as with plain IPv4, with only an
    extra 200 ms of connection delay.

    Signed-off-by : Martin Storsjö <martin@martin.st>

    • [DBH] libavformat/network.c
    • [DBH] libavformat/network.h
  • Why do I get "method DESCRIBE failed : 401 Unauthorized "

    28 juillet 2021, par TheOliveTurtle

    Let me explain my problem, I am trying to access different channels in a DVR system.&#xA;I have successfully gotten access to a single camera (channel 1) by using opencv as such :

    &#xA;

    public_link = &#x27;rtsp://test:test@192.168.1.48/cam/realmonitor&#x27;&#xA;&#xA;cap = cv2.VideoCapture(public_link, cv2.CAP_FFMPEG)&#xA;

    &#xA;

    The problem is I can't access the other channels with these parameters :

    &#xA;

    public_link = &#x27;rtsp://test:test@192.168.1.48/cam/realmonitor?channel=3&amp;subtype=0&#x27;&#xA;&#xA;cap = cv2.VideoCapture(public_link, cv2.CAP_FFMPEG)&#xA;

    &#xA;

    I've tried the following links :

    &#xA;

      &#xA;
    • rtsp ://test:test@192.168.1.48/cam/realmonitor ?channel=3&subtype=0
    • &#xA;

    • rtsp ://test:test@192.168.1.48/cam/realmonitor ?channel=3&subtype=1
    • &#xA;

    • rtsp ://192.168.1.48/cam/realmonitor ?channel=3&subtype=0&authbasic=dGVzdDp0ZXN0
    • &#xA;

    &#xA;

    I get this following error :

    &#xA;

    &#xA;

    [rtsp @ 00000201ce582cc0] method DESCRIBE failed : 401 Unauthorized

    &#xA;

    &#xA;

    I've noticed that even if I test with this URL (rtsp ://test:test@192.168.1.48/blablabla) it works just fine ! (ONLY Channel #1) but when I insert the symbol '=' into the URL string, I get the above error.

    &#xA;

    It's really frustrating, Any sort of help would be much appreciated.

    &#xA;

    PS : the user 'test' has admin privileges in the system.

    &#xA;

    I've tried to run the test with plain ffmpeg command like such :&#xA;ffmpeg -loglevel debug -i "rtsp://test:test@192.168.1.48/cam/monitor?channel=3&amp;subtype=0" ./folder/output.m3u8

    &#xA;

    I get the following error :

    &#xA;

    PS C:\Users\cjhou> ffmpeg -loglevel debug -i "rtsp://test:test@192.168.1.48/cam/realmonitor?channel=3&amp;subtype=0" .\folder\output.m3u8 &#xA;ffmpeg version 4.4-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers&#xA;built with gcc 10.2.0 (Rev6, Built by MSYS2 project)&#xA;configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint&#xA;libavutil      56. 70.100 / 56. 70.100&#xA;libavcodec     58.134.100 / 58.134.100&#xA;libavformat    58. 76.100 / 58. 76.100&#xA;libavdevice    58. 13.100 / 58. 13.100&#xA;libavfilter     7.110.100 /  7.110.100&#xA;libswscale      5.  9.100 /  5.  9.100&#xA;libswresample   3.  9.100 /  3.  9.100&#xA;libpostproc    55.  9.100 / 55.  9.100&#xA;Splitting the commandline.&#xA;Reading option &#x27;-loglevel&#x27; ... matched as option &#x27;loglevel&#x27; (set logging level) with argument &#x27;debug&#x27;.&#xA;Reading option &#x27;-i&#x27; ... matched as input url with argument &#x27;rtsp://test:test@192.168.1.48/cam/realmonitor?channel=3&amp;subtype=0&#x27;.&#xA;Reading option &#x27;.\folder\output.m3u8&#x27; ... matched as output url. &#xA;Finished splitting the commandline. &#xA;Parsing a group of options: global. &#xA;Applying option loglevel (set logging level) with argument debug. &#xA;Successfully parsed a group of options. &#xA;Parsing a group of options: input url rtsp://test:test@192.168.1.48/cam/realmonitor?channel=3&amp;subtype=0.&#xA;Successfully parsed a group of options.&#xA;Opening an input file: rtsp://houssem:152400@192.168.1.48/cam/realmonitor?channel=3&amp;subtype=0.&#xA;[tcp @ 000001882b592240] No default whitelist set &#xA;[tcp @ 000001882b592240] Original list of addresses: &#xA;[tcp @ 000001882b592240] Address 192.168.1.48 port 554 &#xA;[tcp @ 000001882b592240] Interleaved list of addresses: &#xA;[tcp @ 000001882b592240] Address 192.168.1.48 port 554 [tcp @ 000001882b592240] Starting connection attempt to 192.168.1.48 port 554  &#xA;[tcp @ 000001882b592240] Successfully connected to 192.168.1.48 port 554 &#xA;[rtsp @ 000001882b58f080] method DESCRIBE failed: 401 Unauthorized &#xA;[rtsp @ 000001882b58f080] Cseq: 3  Server: Rtsp Server 960*576*30*4096&#xA;&#xA;WWW-Authenticate: Digest realm="Surveillance Server", nonce="44976150"&#xA;&#xA;rtsp://test:test@192.168.1.48/cam/realmonitor?channel=3&amp;subtype=0: Server returned 401 Unauthorized (authorization failed)&#xA;

    &#xA;

    With this command ffplay "rtsp://test:test@192.168.1.48/cam/realmonitor?channel=3&amp;subtype=0", I get this output :

    &#xA;

    PS C:\Users\cjhou> ffplay "rtsp://test:test@192.168.1.48/cam/realmonitor?channel=3&amp;subtype=0"&#xA;ffplay version 4.4-full_build-www.gyan.dev Copyright (c) 2003-2021 the FFmpeg developers&#xA;  built with gcc 10.2.0 (Rev6, Built by MSYS2 project)&#xA;  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint&#xA;  libavutil      56. 70.100 / 56. 70.100&#xA;  libavcodec     58.134.100 / 58.134.100&#xA;  libavformat    58. 76.100 / 58. 76.100&#xA;  libavdevice    58. 13.100 / 58. 13.100&#xA;  libavfilter     7.110.100 /  7.110.100&#xA;  libswscale      5.  9.100 /  5.  9.100&#xA;  libswresample   3.  9.100 /  3.  9.100&#xA;  libpostproc    55.  9.100 / 55.  9.100&#xA;[rtsp @ 000001d413d2f640] method DESCRIBE failed: 401 Unauthorized&#xA;rtsp://test:test@192.168.1.48/cam/realmonitor?channel=3&amp;subtype=0: Server returned 401 Unauthorized (authorization failed)&#xA;    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0&#xA;

    &#xA;

    By the way, I am using this device :

    &#xA;

      &#xA;
    • Device Name : Digital Video Record
    • &#xA;

    • Model Number : 16-CHANNEL
    • &#xA;

    • Software Version : XVR_HI3521A_16_v6.1.52.1
    • &#xA;

    • Date : Dec 19 2016 14:36:39
    • &#xA;

    &#xA;

    Hope this helps !

    &#xA;