Recherche avancée

Médias (1)

Mot : - Tags -/pirate bay

Autres articles (38)

  • L’espace de configuration de MediaSPIP

    29 novembre 2010, par

    L’espace de configuration de MediaSPIP est réservé aux administrateurs. Un lien de menu "administrer" est généralement affiché en haut de la page [1].
    Il permet de configurer finement votre site.
    La navigation de cet espace de configuration est divisé en trois parties : la configuration générale du site qui permet notamment de modifier : les informations principales concernant le site (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (4161)

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

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

    &#xA;&#xA;

    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.

    &#xA;&#xA;

    Encoder and sender code

    &#xA;&#xA;

    &#xA;    //Udp initialisation&#xA;    struct sockaddr_in broadcastAddr;&#xA;    int sock;&#xA;    int yes = 1;&#xA;    int addr_len;&#xA;    int count;&#xA;    fd_set readfd;&#xA;    char buffer[1024];&#xA;    int i;&#xA;&#xA;    sock = socket(AF_INET, SOCK_DGRAM,0);&#xA;&#xA;    if(sock &lt; 0){&#xA;        std::cout &lt;&lt; "Failed to initialise socket!" &lt;&lt; std::endl;&#xA;    }&#xA;&#xA;    int ret = setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char*)&amp;yes, sizeof(yes));&#xA;    if(ret &lt; 0){&#xA;        std::cout &lt;&lt; "setsockopt error!" &lt;/ the size of the address&#xA;&#xA;    memset((void*)&amp;broadcastAddr,0,addr_len); //0 out the address bits&#xA;&#xA;    broadcastAddr.sin_family = AF_INET;&#xA;    broadcastAddr.sin_addr.s_addr = INADDR_BROADCAST;&#xA;    broadcastAddr.sin_port = PORT;&#xA;&#xA;&#xA;&#xA;    //Set the encoder parameters&#xA;    x264_param_t param;&#xA;    x264_param_default_preset(&amp;param,"veryfast","zerolatency");&#xA;    param.i_threads = 1;&#xA;    param.i_width = camera.getWidth();&#xA;    param.i_height = camera.getHeight();&#xA;    param.i_fps_num = 30;&#xA;    param.i_fps_den = 1;&#xA;// Intra refres:&#xA;    param.i_keyint_max = 30;&#xA;    param.b_intra_refresh = 1;&#xA;//Rate control:&#xA;    param.rc.i_rc_method = X264_RC_CRF;&#xA;    param.rc.f_rf_constant = 25;&#xA;    param.rc.f_rf_constant_max = 35;&#xA;//For streaming:&#xA;    param.b_repeat_headers = 1;&#xA;    param.b_annexb = 1;&#xA;    x264_param_apply_profile(&amp;param, "baseline");&#xA;&#xA;    x264_t *encoder = x264_encoder_open(&amp;param); //H.264 encoder object&#xA;    x264_picture_t pic_in, pic_out;&#xA;    x264_picture_alloc(&amp;pic_in, X264_CSP_I420,camera.getWidth(), camera.getHeight());&#xA;&#xA;    //Network abstraction layer units for broadcast&#xA;    x264_nal_t *nals;&#xA;    int i_nals;&#xA;&#xA;    while(true){&#xA;&#xA;        //If there is valid data in the processing queue&#xA;        if(!encoderQueue.empty()){&#xA;&#xA;            //File the x264 input data structure with the file data&#xA;            fillImage(encoderQueue.front(),camera.getWidth(),camera.getHeight(),&amp;pic_in);&#xA;&#xA;            //Encode and send&#xA;            int frame_size = x264_encoder_encode(encoder, &amp;nals, &amp;i_nals, &amp;pic_in, &amp;pic_out);&#xA;            if (frame_size >= 0) {&#xA;                //The frame is ready to be sent over UDP!&#xA;                for(int i = 0; i &lt; i_nals; i&#x2B;&#x2B;){&#xA;                    ret = sendto(sock, &amp;nals[0].p_payload, frame_size,0,(struct sockaddr*)&amp;broadcastAddr,addr_len);&#xA;                    if(ret > 0){&#xA;                        std::cout &lt;&lt; "Streamed frame nal unit " &lt;&lt; i  &lt;&lt; std::endl;&#xA;                    } else{&#xA;                        std::cout &lt;&lt; "Failed to stream nal unit " &lt;&lt; i &lt;&lt; std::endl;&#xA;                    }&#xA;                }&#xA;            }&#xA;            else{&#xA;                std::cout&lt;&lt;"Failed to encode h264 frame!" &lt;&lt; std::endl;&#xA;            }&#xA;            //Finsihed with the current frame, pop it off the queue and remove any nals to do with it&#xA;            encoderQueue.pop();&#xA;            frame_size = 0;&#xA;            nals = nullptr;&#xA;            i_nals = 0;&#xA;        }&#xA;&#xA;&#xA;    }&#xA;

    &#xA;&#xA;

    Receiver application

    &#xA;&#xA;

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

  • Read RTSP stream in Python

    15 avril 2020, par pooorman

    I want to read RTSP stream with low latency. I use this code read frames in 100ms 200ms.&#xA;But this command will failed sometimes when restart program. There are four subprocess that read stream, 3 are success and 1 is failed. Is my command wrong ?

    &#xA;&#xA;

    ffmpeg_cmd = ["ffmpeg", "-v", "debug", "-y",&#xA;                        "-skip_initial_bytes", "2000000",&#xA;                        "-c:v",  "h264",&#xA;                        "-vsync", "1",&#xA;                        "-flags", "low_delay",&#xA;                        "-fflags", "nobuffer",&#xA;                        "-analyzeduration", "100000",&#xA;                        "-max_delay", "100000",&#xA;                        "-reorder_queue_size", "10000",&#xA;                        "-rtsp_transport", "tcp",&#xA;                        "-i", "rtsp://xx:xx@ip/streaming/channels/101",&#xA;                        "-s", "1280x720",&#xA;                        "-preset", "ultrafast",&#xA;                        "-tune", "zerolatency",&#xA;                        "-f", "image2pipe",&#xA;                        "-pix_fmt", "rgb24",&#xA;                        "-vcodec", "rawvideo",&#xA;                        "-r", "25",&#xA;                        "-"]&#xA;ffmpeg = sp.Popen(ffmpeg_cmd, stdout=sp.PIPE, bufsize=1024)&#xA;x = ffmpeg.stdout.read(int(w*h*3))&#xA;

    &#xA;&#xA;

    Error message :

    &#xA;&#xA;

    Codec AVOption preset (Configuration preset) specified for output file #0 (pipe:) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.&#xA;Codec AVOption tune (Tune the encoding to a specific scenario) specified for output file #0 (pipe:) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.&#xA;detected 48 logical cores&#xA;Past duration 0.914436 too large&#xA;[h264 @ 0x55a59a5b8500] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0x55a59a5b8500] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;Clipping frame in rate conversion by 0.339165&#xA;[h264 @ 0x55a59a5b8500] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3&#xA;[h264 @ 0x55a59a5b8500] Format yuvj420p chosen by get_format().&#xA;[h264 @ 0x55a59a5b8500] Reinit context to 1920x1088, pix_fmt: yuvj420p&#xA;[h264 @ 0x55a59a5b8500] Frame num gap 6 4&#xA;[h264 @ 0x55e256eef5c0] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0x55e256eef5c0] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[h264 @ 0x55e256eef5c0] nal_unit_type: 5(IDR), nal_ref_idc: 3&#xA;[h264 @ 0x5649ea893700] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3&#xA;    Last message repeated 3 times&#xA;[rtsp @ 0x5626b5bd85c0] max_analyze_duration 100000 reached at 120000 microseconds st:0&#xA;[rtsp @ 0x5626b5bd85c0] decoding for stream 0 failed&#xA;

    &#xA;