Recherche avancée

Médias (1)

Mot : - Tags -/biographie

Autres articles (89)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • 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 (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

Sur d’autres sites (8748)

  • Live555 Multicast RTSP Server - Display in FFMPEG

    31 mai 2021, par BanB

    I made a multicast RTSP server using the Live555 library.
    
It is displayed by VLC but not from VMS (NX Witness) or FFMPEG.
    
If I use the Unicast, I can display it, but I do not know how to change the file that is streaming in the Unicast.
    
Is there a way to change the streaming file in Unicast or make it viewable in FFMPEG with Multicast ?

    


    This is my code.

    


    


    Header

    


    


    #include <iostream>&#xA;#include <string>&#xA;#include <filesystem>&#xA;#include <fstream>&#xA;#include <ctime>&#xA;#include &#xA;#include &#xA;#include  &#xA;#include <opencv2></opencv2>videoio.hpp>&#xA;#include <opencv2></opencv2>imgcodecs.hpp>&#xA;&#xA;void Start(const char* streamPath, int port);&#xA;void AddDataL(BYTE* data, int length);&#xA;AddDataHW(BYTE* data, int height, int width);&#xA;&#xA;void Play();&#xA;void AfterPlaying(void*);&#xA;&#xA;void EncodeToH264(cv::Mat image);&#xA;long long GetTimeMs();&#xA;int GetFileCount();&#xA;const char* GetFirstFilePath();&#xA;&#xA;const int fourcc = cv::VideoWriter::fourcc(&#x27;x&#x27;, &#x27;2&#x27;, &#x27;6&#x27;, &#x27;4&#x27;);&#xA;&#xA;UsageEnvironment* env;&#xA;H264ServerMediaSubsession* h264;&#xA;H264VideoStreamFramer* videoSource;&#xA;RTPSink* videoSink;&#xA;&#xA;const char* dataPath = "data/";&#xA;const char* extension = ".h264";&#xA;</ctime></fstream></filesystem></string></iostream>

    &#xA;

    &#xA;

    CPP

    &#xA;

    &#xA;

    void Start()&#xA;{&#xA;    askScheduler *scheduler = BasicTaskScheduler::createNew();&#xA;    env = BasicUsageEnvironment::createNew(*scheduler);&#xA;&#xA;    RTSPServer *rtspServer = RTSPServer::createNew(*env, 8554);&#xA;&#xA;    if (rtspServer == NULL)&#xA;        throw;&#xA;&#xA;    struct sockaddr_storage destinationAddress;&#xA;    destinationAddress.ss_family = AF_INET;&#xA;    ((struct sockaddr_in &amp;)destinationAddress).sin_addr.s_addr = chooseRandomIPv4SSMAddress(*env);&#xA;&#xA;    const unsigned short rtpPortNum = 18888;&#xA;    const unsigned short rtcpPortNum = rtpPortNum &#x2B; 1;&#xA;    const unsigned char ttl = 255;&#xA;&#xA;    const Port rtpPort(rtpPortNum);&#xA;    const Port rtcpPort(rtcpPortNum);&#xA;&#xA;    Groupsock rtpGroupsock(*env, destinationAddress, rtpPort, ttl);&#xA;    rtpGroupsock.multicastSendOnly();&#xA;    Groupsock rtcpGroupsock(*env, destinationAddress, rtcpPort, ttl);&#xA;    rtcpGroupsock.multicastSendOnly();&#xA;&#xA;    OutPacketBuffer::maxSize = 300000;&#xA;    videoSink = H264VideoRTPSink::createNew(*env, &amp;rtpGroupsock, 96);&#xA;&#xA;    const unsigned estimatedSessionBandwidth = 5000;&#xA;    const unsigned maxCNAMElen = 100;&#xA;    unsigned char CNAME[maxCNAMElen &#x2B; 1];&#xA;    gethostname((char *)CNAME, maxCNAMElen);&#xA;    CNAME[maxCNAMElen] = &#x27;\0&#x27;;&#xA;&#xA;    RTCPInstance *rtcp = RTCPInstance::createNew(*env, &amp;rtcpGroupsock, estimatedSessionBandwidth, CNAME, videoSink, NULL, True);&#xA;&#xA;    ServerMediaSession *sms = ServerMediaSession::createNew(*env, "live", "live", "Session streamed by \"Test Server\"", True);&#xA;    sms->addSubsession(PassiveServerMediaSubsession::createNew(*videoSink, rtcp));&#xA;    rtspServer->addServerMediaSession(sms);&#xA;&#xA;    *env &lt;&lt; "Start > " &lt;&lt; rtspServer->rtspURL(sms) &lt;&lt; "\n";&#xA;&#xA;    Play();&#xA;&#xA;    env->taskScheduler().doEventLoop();&#xA;}&#xA;&#xA;void AddData(BYTE* data, int length)&#xA;{&#xA;    EncodeToH264(cv::imdecode(cv::Mat(1, length, CV_8UC3, data), 1));&#xA;}&#xA;&#xA;void EncodeToH264(cv::Mat image)&#xA;{&#xA;    std::string fileName = dataPath &#x2B; std::to_string(GetTimeMs()) &#x2B; extension;&#xA;    cv::VideoWriter writer(fileName.c_str(), fourcc, 1, image.size());&#xA;    writer.write(image);&#xA;    writer.write(image);&#xA;    writer.release();&#xA;}&#xA;&#xA;void Play()&#xA;{&#xA;    while (GetFileCount() == 0);&#xA;&#xA;    const char* fileName = GetFirstFilePath();&#xA;&#xA;    ByteStreamFileSource* fileSource;&#xA;    while ((fileSource = ByteStreamFileSource::createNew(*env, fileName)) == NULL);&#xA;&#xA;    FramedSource* videoES = fileSource;&#xA;&#xA;    videoSource = H264VideoStreamFramer::createNew(*env, videoES);&#xA;&#xA;    videoSink->startPlaying(*videoSource, AfterPlaying, videoSink);&#xA;}&#xA;&#xA;void AfterPlaying(void*)&#xA;{&#xA;    videoSink->stopPlaying();&#xA;    Medium::close(videoSource);&#xA;&#xA;    if (GetFileCount() > 1)&#xA;        std::filesystem::remove(GetFirstFilePath());&#xA;&#xA;    Play();&#xA;}&#xA;&#xA;long long GetTimeMs()&#xA;{&#xA;    return std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count();&#xA;}&#xA;&#xA;int GetFileCount() &#xA;{&#xA;    return std::distance(std::filesystem::directory_iterator(dataPath), std::filesystem::directory_iterator());&#xA;}&#xA;&#xA;const char* GetFirstFilePath()&#xA;{&#xA;    for (const auto&amp; entry : std::filesystem::directory_iterator(dataPath))&#xA;        return entry.path().string().c_str();&#xA;}&#xA;

    &#xA;

  • How to use ffmpeg to record video from SDP ?

    17 août 2024, par Thomas Carlton

    I'm running Ubuntu 18.04 and I have the following SDP Offer from Kurento Media Server. The offer is saved to the file a.sdp :

    &#xA;

        v=0&#xA;    o=- 3831476180 3831476180 IN IP4 172.31.46.122&#xA;    s=Kurento Media Server&#xA;    c=IN IP4 172.31.46.122&#xA;    t=0 0&#xA;    m=audio 28460 RTP/AVPF 96 0 97&#xA;    a=setup:actpass&#xA;    a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time&#xA;    a=rtpmap:96 opus/48000/2&#xA;    a=rtpmap:97 AMR/8000&#xA;    a=rtcp:28461&#xA;    a=sendrecv&#xA;    a=mid:audio0&#xA;    a=ssrc:1797155263 cname:user1913428254@host-e7ab0454&#xA;    m=video 18122 RTP/AVPF 102 103&#xA;    a=setup:actpass&#xA;    a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time&#xA;    a=rtpmap:102 VP8/90000&#xA;    a=rtpmap:103 H264/90000&#xA;    a=fmtp:103 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f&#xA;    a=rtcp:18123&#xA;    a=sendrecv&#xA;    a=mid:video0&#xA;    a=rtcp-fb:102 nack&#xA;    a=rtcp-fb:102 nack pli&#xA;    a=rtcp-fb:102 goog-remb&#xA;    a=rtcp-fb:102 ccm fir&#xA;    a=rtcp-fb:103 nack&#xA;    a=rtcp-fb:103 nack pli&#xA;    a=rtcp-fb:103 ccm fir&#xA;    a=ssrc:2822275190 cname:user1913428254@host-e7ab0454&#xA;

    &#xA;

    Then, I'm calling ffmpeg to record this flow to a file :

    &#xA;

    ffmpeg -max_delay 5000 -reorder_queue_size 16384 -protocol_whitelist file,crypto,udp,rtp -re -i a.sdp -vcodec copy -acodec aac -y output.mp4&#xA;

    &#xA;

    172.31.46.122 is the local IP adress and I'm running ffmpeg from the same machine as SDP offer. So ffmpeg has access to this IP address.

    &#xA;

    I'm getting the error :

    &#xA;

    &#xA;

    bind failed : Address already in use.

    &#xA;

    a.sdp : Invalid data found when processing input

    &#xA;

    &#xA;

    How can I solve that ?

    &#xA;

  • Python ffmpeg subprocess never exits on Linux, works on Windows

    24 mai 2021, par Chris

    I wonder if someone can help explain what is happening ?

    &#xA;

    I run 2 subprocesses, 1 for ffprobe and 1 for ffmpeg.

    &#xA;

    popen = subprocess.Popen(ffprobecmd, stderr=subprocess.PIPE, shell=True)&#xA;

    &#xA;

    And

    &#xA;

    popen = subprocess.Popen(ffmpegcmd, shell=True, stdout=subprocess.PIPE)&#xA;

    &#xA;

    On both Windows and Linux the ffprobe command fires, finishes and gets removed from taskmanager/htop. But only on Windows does the same happen to ffmpeg. On Linux the command remains in htop...

    &#xA;

    enter image description here

    &#xA;

    Can anyone explain what is going on, if it matters and how I can stop it from happening please ?

    &#xA;

    EDIT : Here are the commands...

    &#xA;

    ffprobecmd = &#x27;ffprobe&#x27; &#x2B; \&#xA;&#x27; -user_agent "&#x27; &#x2B; request.headers[&#x27;User-Agent&#x27;] &#x2B; &#x27;"&#x27; &#x2B; \&#xA;&#x27; -headers "Referer: &#x27; &#x2B; request.headers[&#x27;Referer&#x27;] &#x2B; &#x27;"&#x27; &#x2B; \&#xA;&#x27; -timeout "5000000"&#x27; &#x2B; \&#xA;&#x27; -v error -select_streams v -show_entries stream=height -of default=nw=1:nk=1&#x27; &#x2B; \&#xA;&#x27; -i "&#x27; &#x2B; request.url &#x2B; &#x27;"&#x27;&#xA;

    &#xA;

    and

    &#xA;

    ffmpegcmd = &#x27;ffmpeg&#x27; &#x2B; \&#xA;&#x27; -re&#x27; &#x2B; \&#xA;&#x27; -user_agent "&#x27; &#x2B; r.headers[&#x27;User-Agent&#x27;] &#x2B; &#x27;"&#x27; &#x2B; \&#xA;&#x27; -headers "Referer: &#x27; &#x2B; r.headers[&#x27;Referer&#x27;] &#x2B; &#x27;"&#x27; &#x2B; \&#xA;&#x27; -timeout "10"&#x27; &#x2B; \&#xA;&#x27; -i "&#x27; &#x2B; r.url &#x2B; &#x27;"&#x27; &#x2B; \&#xA;&#x27; -c copy&#x27; &#x2B; \&#xA;&#x27; -f mpegts&#x27; &#x2B; \&#xA;&#x27; pipe:&#x27;&#xA;

    &#xA;

    EDIT : Here is a example that behaves as described...

    &#xA;

    import flask&#xA;from flask import Response&#xA;import subprocess&#xA;&#xA;app = flask.Flask(__name__)&#xA;&#xA;@app.route(&#x27;/&#x27;, methods=[&#x27;GET&#x27;])&#xA;def go():&#xA;    def stream(ffmpegcmd):&#xA;        popen = subprocess.Popen(ffmpegcmd, stdout=subprocess.PIPE, shell=True)&#xA;        try:&#xA;            for stdout_line in iter(popen.stdout.readline, ""):&#xA;                yield stdout_line&#xA;        except GeneratorExit:&#xA;            raise&#xA;&#xA;    url = "https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8"&#xA;&#xA;    ffmpegcmd = &#x27;ffmpeg&#x27; &#x2B; \&#xA;                &#x27; -re&#x27; &#x2B; \&#xA;                &#x27; -timeout "10"&#x27; &#x2B; \&#xA;                &#x27; -i "&#x27; &#x2B; url &#x2B; &#x27;"&#x27; &#x2B; \&#xA;                &#x27; -c copy&#x27; &#x2B; \&#xA;                &#x27; -f mpegts&#x27; &#x2B; \&#xA;                &#x27; pipe:&#x27;&#xA;    return Response(stream(ffmpegcmd))&#xA;&#xA;if __name__ == &#x27;__main__&#x27;:&#xA;    app.run(host= &#x27;0.0.0.0&#x27;, port=5000)&#xA;

    &#xA;