Recherche avancée

Médias (1)

Mot : - Tags -/intégration

Autres articles (67)

  • (Dés)Activation de fonctionnalités (plugins)

    18 février 2011, par

    Pour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
    SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
    Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
    MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)

  • Le plugin : Podcasts.

    14 juillet 2010, par

    Le problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
    Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
    Types de fichiers supportés dans les flux
    Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

Sur d’autres sites (8477)

  • ffmpeg live stream to Youtube command line

    30 juin 2020, par brainoverflowse

    Would anyone assist myself with creating the correct ffmpeg command line for an audio and video rtsp camera feed that is 1440 and scale it to 1080 with a max bitrate of 10000 ?

    


  • x264 output video is blank when threading is enabled

    15 juillet 2020, par NewbieCoder

    I am using libx264 compiled from source. It was configured to get both .dll and .lib by this command

    


    ./configure --disable-cli --enable-shared --extra-ldflags=-Wl,--output-def=libx264.def`

    


    I am using the libx264 API in my screen-sharing program with the preset - "veryfast", tune - "zerolatency", profile - "high" and also the following settings.

    


            param.i_csp = X264_CSP_BGRA;
        param.i_threads = 1;
        param.i_width = width;
        param.i_height = height;
        param.i_fps_num = fps;
        param.i_fps_den = 1;
        param.rc.i_bitrate = bitrate;
        param.rc.i_rc_method = X264_RC_ABR;
        param.rc.b_filler = true;
        param.rc.f_rf_constant = (float)0;
        param.rc.i_vbv_max_bitrate = param.rc.i_bitrate;
        param.rc.i_vbv_buffer_size = param.rc.i_bitrate;
        param.b_repeat_headers = 0;
        param.b_annexb = 1;


    


    For these settings the program works fine. I specified it as single threaded by setting param.i_threads = 1.
If this is removed, x264 defaults to using multiple threads and sets param.i_threads as 1.5x of number of cores in the CPU automatically. This will give faster performance than running in single thread.

    


    But when I remove the param.i_threads = 1 to make it multi-threaded, the generated output is fully grey. I cannot see any output when I view the live stream with VLC or some times I can view a weird output.

    


    I am using this bitmap image as an example (https://imgur.com/a/l8LCd1l). Only this same image is being encoded multiple times. When it is saved into .h264 video, it is viewable clearly. But when the encoded payload is sent through rtmp, the live stream produces very bad and weird output (or sometimes no output). This is the weird output which im seeing most of the time for this image : https://imgur.com/a/VdyX1Zm

    


    This is the full example code in which I am both streaming and writing video file of the same picture. This is using the srs librtmp library. There is no error but the stream has weird output.

    


    In this code if you set add param.i_threads = 1; then only the output stream will be viewable. The problem is that it should be viewable in both single-threaded and multi-threaded encoding.

    


    #include <iostream>&#xA;#include &#xA;#include <sstream>&#xA;#include &#xA;#include "srs_librtmp.h"&#xA;&#xA;#pragma comment(lib, "C:/Softwares/x264/libx264.lib")&#xA;&#xA;using namespace std;&#xA;&#xA;int check_ret(int ret);&#xA;&#xA;int main()&#xA;{&#xA;    int dts = 0;&#xA;&#xA;    x264_param_t param;&#xA;    x264_t* h;&#xA;    x264_nal_t* nals;&#xA;    int i_nal;&#xA;    int pts = 0;&#xA;    int i_frame_size;&#xA;    x264_picture_t picIn;&#xA;    x264_picture_t picOut;&#xA;&#xA;    x264_param_default_preset(&amp;param, "veryfast", "zerolatency");&#xA;&#xA;    //x264 settings&#xA;    param.i_csp = X264_CSP_BGRA;&#xA;    param.i_width = 1920;&#xA;    param.i_height = 1080;&#xA;    param.i_fps_num = 30;&#xA;    param.i_fps_den = 1;&#xA;    param.rc.i_bitrate = 2500;&#xA;    param.rc.i_rc_method = X264_RC_ABR;&#xA;    param.rc.b_filler = true;&#xA;    param.rc.f_rf_constant = (float)0;&#xA;    param.rc.i_vbv_max_bitrate = param.rc.i_bitrate;&#xA;    param.rc.i_vbv_buffer_size = param.rc.i_bitrate;&#xA;    param.b_repeat_headers = 0;&#xA;    param.b_annexb = 1;&#xA;&#xA;    x264_param_apply_profile(&amp;param, "high");&#xA;    h = x264_encoder_open(&amp;param);&#xA;&#xA;    //allocate picture&#xA;    x264_picture_alloc(&amp;picIn, param.i_csp, param.i_width, param.i_height);&#xA;&#xA;    //picture settings&#xA;    picIn.img.i_plane = 1;&#xA;    picIn.img.i_stride[0] = 4 * param.i_width;&#xA;    picIn.i_type = X264_TYPE_AUTO;&#xA;&#xA;    int header_size = x264_encoder_headers(h, &amp;nals, &amp;i_nal);&#xA;    FILE* fptr;&#xA;    fopen_s(&amp;fptr, "example1.h264", "wb");&#xA;    // write sps and pps in the video file&#xA;    fwrite(nals->p_payload, header_size, 1, fptr);&#xA;&#xA;    int size = 1920 * 1080 * 4;&#xA;    char* bmp = new char[size];&#xA;    FILE* bitptr;&#xA;    errno_t err = fopen_s(&amp;bitptr, "flower.bmp", "rb");&#xA;    fseek(bitptr, 54, SEEK_SET);&#xA;    fread(bmp, size, 1, bitptr);&#xA;    fclose(bitptr);&#xA;&#xA;    srs_rtmp_t rtmp = srs_rtmp_create("127.0.0.1:1935/live/test");&#xA;&#xA;    if (srs_rtmp_handshake(rtmp) != 0)&#xA;    {&#xA;        std::cout &lt;&lt; "Simple handshake failed.";&#xA;        return -1;&#xA;    }&#xA;&#xA;    std::cout &lt;&lt; "Handshake completed successfully.\n";&#xA;&#xA;    if (srs_rtmp_connect_app(rtmp) != 0) {&#xA;        std::cout &lt;&lt; "Connecting to host failed.";&#xA;        return -1;&#xA;    }&#xA;&#xA;    std::cout &lt;&lt; "Connected to host successfully.\n";&#xA;&#xA;    if (srs_rtmp_publish_stream(rtmp) != 0) {&#xA;        std::cout &lt;&lt; "Publish signal failed.";&#xA;    }&#xA;&#xA;    std::cout &lt;&lt; "Publish signal success\n";&#xA;&#xA;    // write sps and pps in the live stream&#xA;    int ret = srs_h264_write_raw_frames(rtmp, reinterpret_cast(nals->p_payload), header_size, 0, 0);&#xA;    ret = check_ret(ret);&#xA;    if (!ret)&#xA;        return -1;&#xA;    std::cout &lt;&lt; "SPS and PPS sent.\n";&#xA;&#xA;    // main loop&#xA;    std::cout &lt;&lt; "Now streaming and encoding\n";&#xA;    int i = 1800;&#xA;    while (i--)&#xA;    {&#xA;&#xA;        picIn.img.plane[0] = reinterpret_cast(bmp);&#xA;        picIn.i_pts = pts&#x2B;&#x2B;;&#xA;        i_frame_size = x264_encoder_encode(h, &amp;nals, &amp;i_nal, &amp;picIn, &amp;picOut);&#xA;        if (i_frame_size)&#xA;        {&#xA;            for (int j = 0; j &lt; i_nal; j&#x2B;&#x2B;)&#xA;            {&#xA;&#xA;                x264_nal_t* nal = nals &#x2B; j;&#xA;                // write data in the video file&#xA;                fwrite(nal->p_payload, nal->i_payload, 1, fptr);&#xA;                // write data in the live stream&#xA;                ret = srs_h264_write_raw_frames(rtmp, reinterpret_cast(nal->p_payload), nal->i_payload, dts, dts);&#xA;                ret = check_ret(ret);&#xA;                if (!ret)&#xA;                {&#xA;                    return -1;&#xA;                }&#xA;            }&#xA;        }&#xA;        else&#xA;        {&#xA;            std::cout &lt;&lt; "i_frame_size = 0 (encoder failed)\n";&#xA;        }&#xA;        dts &#x2B;= 33;&#xA;    }&#xA;&#xA;    while (x264_encoder_delayed_frames(h))&#xA;    {&#xA;        i_frame_size = x264_encoder_encode(h, &amp;nals, &amp;i_nal, NULL, &amp;picOut);&#xA;        if (i_frame_size)&#xA;        {&#xA;            fwrite(nals->p_payload, i_frame_size, 1, fptr);&#xA;        }&#xA;    }&#xA;&#xA;    std::cout &lt;&lt; "\nAll done\n";&#xA;    std::cout &lt;&lt; "Output video is example1.h264 and it is viewable in VLC";&#xA;&#xA;    return 0;&#xA;}&#xA;&#xA;int check_ret(int ret)&#xA;{&#xA;    if (ret != 0) {&#xA;        if (srs_h264_is_dvbsp_error(ret)) {&#xA;            srs_human_trace("ignoring drop video error, code=%d", ret);&#xA;        }&#xA;        else if (srs_h264_is_duplicated_sps_error(ret)) {&#xA;            srs_human_trace("ignoring duplicated sps, code=%d", ret);&#xA;        }&#xA;        else if (srs_h264_is_duplicated_pps_error(ret)) {&#xA;            srs_human_trace("ignoring duplicated pps, code=%d", ret);&#xA;        }&#xA;        else {&#xA;            srs_human_trace("sending h264 raw data failed. ret=%d", ret);&#xA;            return 0;&#xA;        }&#xA;    }&#xA;    return 1;&#xA;}&#xA;</sstream></iostream>

    &#xA;

    If you would like to download the original flower.bmp file, here is the link : https://gofile.io/d/w2kX56&#xA;This error can be reproduced in any other bmp file also.

    &#xA;

    Please tell me what is causing this problem when multi-threading is enabled. Am I setting wrong values ? Is the code in which I am streaming the encoded data wrong ?

    &#xA;

  • x264 output video is blank when threading is enabled

    15 juillet 2020, par NewbieCoder

    I am using libx264 compiled from source. It was configured to get both .dll and .lib by this command

    &#xA;

    ./configure --disable-cli --enable-shared --extra-ldflags=-Wl,--output-def=libx264.def`

    &#xA;

    I am using the libx264 API in my screen-sharing program with the preset - "veryfast", tune - "zerolatency", profile - "high" and also the following settings.

    &#xA;

            param.i_csp = X264_CSP_BGRA;&#xA;        param.i_threads = 1;&#xA;        param.i_width = width;&#xA;        param.i_height = height;&#xA;        param.i_fps_num = fps;&#xA;        param.i_fps_den = 1;&#xA;        param.rc.i_bitrate = bitrate;&#xA;        param.rc.i_rc_method = X264_RC_ABR;&#xA;        param.rc.b_filler = true;&#xA;        param.rc.f_rf_constant = (float)0;&#xA;        param.rc.i_vbv_max_bitrate = param.rc.i_bitrate;&#xA;        param.rc.i_vbv_buffer_size = param.rc.i_bitrate;&#xA;        param.b_repeat_headers = 0;&#xA;        param.b_annexb = 1;&#xA;

    &#xA;

    For these settings the program works fine. I specified it as single threaded by setting param.i_threads = 1.&#xA;If this is removed, x264 defaults to using multiple threads and sets param.i_threads as 1.5x of number of cores in the CPU automatically. This will give faster performance than running in single thread.

    &#xA;

    But when I remove the param.i_threads = 1 to make it multi-threaded, the generated output is fully grey. I cannot see any output when I view the live stream with VLC or some times I can view a weird output.

    &#xA;

    I am using this bitmap image as an example (https://imgur.com/a/l8LCd1l). Only this same image is being encoded multiple times. When it is saved into .h264 video, it is viewable clearly. But when the encoded payload is sent through rtmp, the live stream produces very bad and weird output (or sometimes no output). This is the weird output which im seeing most of the time for this image : https://imgur.com/a/VdyX1Zm

    &#xA;

    This is the full example code in which I am both streaming and writing video file of the same picture. This is using the srs librtmp library. There is no error but the stream has weird output.

    &#xA;

    In this code if you set add param.i_threads = 1; then only the output stream will be viewable. The problem is that it should be viewable in both single-threaded and multi-threaded encoding.

    &#xA;

    #include <iostream>&#xA;#include &#xA;#include <sstream>&#xA;#include &#xA;#include "srs_librtmp.h"&#xA;&#xA;#pragma comment(lib, "C:/Softwares/x264/libx264.lib")&#xA;&#xA;using namespace std;&#xA;&#xA;int check_ret(int ret);&#xA;&#xA;int main()&#xA;{&#xA;    int dts = 0;&#xA;&#xA;    x264_param_t param;&#xA;    x264_t* h;&#xA;    x264_nal_t* nals;&#xA;    int i_nal;&#xA;    int pts = 0;&#xA;    int i_frame_size;&#xA;    x264_picture_t picIn;&#xA;    x264_picture_t picOut;&#xA;&#xA;    x264_param_default_preset(&amp;param, "veryfast", "zerolatency");&#xA;&#xA;    //x264 settings&#xA;    param.i_csp = X264_CSP_BGRA;&#xA;    param.i_width = 1920;&#xA;    param.i_height = 1080;&#xA;    param.i_fps_num = 30;&#xA;    param.i_fps_den = 1;&#xA;    param.rc.i_bitrate = 2500;&#xA;    param.rc.i_rc_method = X264_RC_ABR;&#xA;    param.rc.b_filler = true;&#xA;    param.rc.f_rf_constant = (float)0;&#xA;    param.rc.i_vbv_max_bitrate = param.rc.i_bitrate;&#xA;    param.rc.i_vbv_buffer_size = param.rc.i_bitrate;&#xA;    param.b_repeat_headers = 0;&#xA;    param.b_annexb = 1;&#xA;&#xA;    x264_param_apply_profile(&amp;param, "high");&#xA;    h = x264_encoder_open(&amp;param);&#xA;&#xA;    //allocate picture&#xA;    x264_picture_alloc(&amp;picIn, param.i_csp, param.i_width, param.i_height);&#xA;&#xA;    //picture settings&#xA;    picIn.img.i_plane = 1;&#xA;    picIn.img.i_stride[0] = 4 * param.i_width;&#xA;    picIn.i_type = X264_TYPE_AUTO;&#xA;&#xA;    int header_size = x264_encoder_headers(h, &amp;nals, &amp;i_nal);&#xA;    FILE* fptr;&#xA;    fopen_s(&amp;fptr, "example1.h264", "wb");&#xA;    // write sps and pps in the video file&#xA;    fwrite(nals->p_payload, header_size, 1, fptr);&#xA;&#xA;    int size = 1920 * 1080 * 4;&#xA;    char* bmp = new char[size];&#xA;    FILE* bitptr;&#xA;    errno_t err = fopen_s(&amp;bitptr, "flower.bmp", "rb");&#xA;    fseek(bitptr, 54, SEEK_SET);&#xA;    fread(bmp, size, 1, bitptr);&#xA;    fclose(bitptr);&#xA;&#xA;    srs_rtmp_t rtmp = srs_rtmp_create("127.0.0.1:1935/live/test");&#xA;&#xA;    if (srs_rtmp_handshake(rtmp) != 0)&#xA;    {&#xA;        std::cout &lt;&lt; "Simple handshake failed.";&#xA;        return -1;&#xA;    }&#xA;&#xA;    std::cout &lt;&lt; "Handshake completed successfully.\n";&#xA;&#xA;    if (srs_rtmp_connect_app(rtmp) != 0) {&#xA;        std::cout &lt;&lt; "Connecting to host failed.";&#xA;        return -1;&#xA;    }&#xA;&#xA;    std::cout &lt;&lt; "Connected to host successfully.\n";&#xA;&#xA;    if (srs_rtmp_publish_stream(rtmp) != 0) {&#xA;        std::cout &lt;&lt; "Publish signal failed.";&#xA;    }&#xA;&#xA;    std::cout &lt;&lt; "Publish signal success\n";&#xA;&#xA;    // write sps and pps in the live stream&#xA;    int ret = srs_h264_write_raw_frames(rtmp, reinterpret_cast(nals->p_payload), header_size, 0, 0);&#xA;    ret = check_ret(ret);&#xA;    if (!ret)&#xA;        return -1;&#xA;    std::cout &lt;&lt; "SPS and PPS sent.\n";&#xA;&#xA;    // main loop&#xA;    std::cout &lt;&lt; "Now streaming and encoding\n";&#xA;    int i = 1800;&#xA;    while (i--)&#xA;    {&#xA;&#xA;        picIn.img.plane[0] = reinterpret_cast(bmp);&#xA;        picIn.i_pts = pts&#x2B;&#x2B;;&#xA;        i_frame_size = x264_encoder_encode(h, &amp;nals, &amp;i_nal, &amp;picIn, &amp;picOut);&#xA;        if (i_frame_size)&#xA;        {&#xA;            for (int j = 0; j &lt; i_nal; j&#x2B;&#x2B;)&#xA;            {&#xA;&#xA;                x264_nal_t* nal = nals &#x2B; j;&#xA;                // write data in the video file&#xA;                fwrite(nal->p_payload, nal->i_payload, 1, fptr);&#xA;                // write data in the live stream&#xA;                ret = srs_h264_write_raw_frames(rtmp, reinterpret_cast(nal->p_payload), nal->i_payload, dts, dts);&#xA;                ret = check_ret(ret);&#xA;                if (!ret)&#xA;                {&#xA;                    return -1;&#xA;                }&#xA;            }&#xA;        }&#xA;        else&#xA;        {&#xA;            std::cout &lt;&lt; "i_frame_size = 0 (encoder failed)\n";&#xA;        }&#xA;        dts &#x2B;= 33;&#xA;    }&#xA;&#xA;    while (x264_encoder_delayed_frames(h))&#xA;    {&#xA;        i_frame_size = x264_encoder_encode(h, &amp;nals, &amp;i_nal, NULL, &amp;picOut);&#xA;        if (i_frame_size)&#xA;        {&#xA;            fwrite(nals->p_payload, i_frame_size, 1, fptr);&#xA;        }&#xA;    }&#xA;&#xA;    std::cout &lt;&lt; "\nAll done\n";&#xA;    std::cout &lt;&lt; "Output video is example1.h264 and it is viewable in VLC";&#xA;&#xA;    return 0;&#xA;}&#xA;&#xA;int check_ret(int ret)&#xA;{&#xA;    if (ret != 0) {&#xA;        if (srs_h264_is_dvbsp_error(ret)) {&#xA;            srs_human_trace("ignoring drop video error, code=%d", ret);&#xA;        }&#xA;        else if (srs_h264_is_duplicated_sps_error(ret)) {&#xA;            srs_human_trace("ignoring duplicated sps, code=%d", ret);&#xA;        }&#xA;        else if (srs_h264_is_duplicated_pps_error(ret)) {&#xA;            srs_human_trace("ignoring duplicated pps, code=%d", ret);&#xA;        }&#xA;        else {&#xA;            srs_human_trace("sending h264 raw data failed. ret=%d", ret);&#xA;            return 0;&#xA;        }&#xA;    }&#xA;    return 1;&#xA;}&#xA;</sstream></iostream>

    &#xA;

    If you would like to download the original flower.bmp file, here is the link : https://gofile.io/d/w2kX56&#xA;This error can be reproduced in any other bmp file also.

    &#xA;

    Please tell me what is causing this problem when multi-threading is enabled. Am I setting wrong values ? Is the code in which I am streaming the encoded data wrong ?

    &#xA;