
Recherche avancée
Médias (1)
-
Richard Stallman et le logiciel libre
19 octobre 2011, par
Mis à jour : Mai 2013
Langue : français
Type : Texte
Autres articles (89)
-
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 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, parChaque 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, parAccé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 BanBI 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>
#include <string>
#include <filesystem>
#include <fstream>
#include <ctime>
#include 
#include 
#include 
#include <opencv2></opencv2>videoio.hpp>
#include <opencv2></opencv2>imgcodecs.hpp>

void Start(const char* streamPath, int port);
void AddDataL(BYTE* data, int length);
AddDataHW(BYTE* data, int height, int width);

void Play();
void AfterPlaying(void*);

void EncodeToH264(cv::Mat image);
long long GetTimeMs();
int GetFileCount();
const char* GetFirstFilePath();

const int fourcc = cv::VideoWriter::fourcc('x', '2', '6', '4');

UsageEnvironment* env;
H264ServerMediaSubsession* h264;
H264VideoStreamFramer* videoSource;
RTPSink* videoSink;

const char* dataPath = "data/";
const char* extension = ".h264";
</ctime></fstream></filesystem></string></iostream>




CPP




void Start()
{
 askScheduler *scheduler = BasicTaskScheduler::createNew();
 env = BasicUsageEnvironment::createNew(*scheduler);

 RTSPServer *rtspServer = RTSPServer::createNew(*env, 8554);

 if (rtspServer == NULL)
 throw;

 struct sockaddr_storage destinationAddress;
 destinationAddress.ss_family = AF_INET;
 ((struct sockaddr_in &)destinationAddress).sin_addr.s_addr = chooseRandomIPv4SSMAddress(*env);

 const unsigned short rtpPortNum = 18888;
 const unsigned short rtcpPortNum = rtpPortNum + 1;
 const unsigned char ttl = 255;

 const Port rtpPort(rtpPortNum);
 const Port rtcpPort(rtcpPortNum);

 Groupsock rtpGroupsock(*env, destinationAddress, rtpPort, ttl);
 rtpGroupsock.multicastSendOnly();
 Groupsock rtcpGroupsock(*env, destinationAddress, rtcpPort, ttl);
 rtcpGroupsock.multicastSendOnly();

 OutPacketBuffer::maxSize = 300000;
 videoSink = H264VideoRTPSink::createNew(*env, &rtpGroupsock, 96);

 const unsigned estimatedSessionBandwidth = 5000;
 const unsigned maxCNAMElen = 100;
 unsigned char CNAME[maxCNAMElen + 1];
 gethostname((char *)CNAME, maxCNAMElen);
 CNAME[maxCNAMElen] = '\0';

 RTCPInstance *rtcp = RTCPInstance::createNew(*env, &rtcpGroupsock, estimatedSessionBandwidth, CNAME, videoSink, NULL, True);

 ServerMediaSession *sms = ServerMediaSession::createNew(*env, "live", "live", "Session streamed by \"Test Server\"", True);
 sms->addSubsession(PassiveServerMediaSubsession::createNew(*videoSink, rtcp));
 rtspServer->addServerMediaSession(sms);

 *env << "Start > " << rtspServer->rtspURL(sms) << "\n";

 Play();

 env->taskScheduler().doEventLoop();
}

void AddData(BYTE* data, int length)
{
 EncodeToH264(cv::imdecode(cv::Mat(1, length, CV_8UC3, data), 1));
}

void EncodeToH264(cv::Mat image)
{
 std::string fileName = dataPath + std::to_string(GetTimeMs()) + extension;
 cv::VideoWriter writer(fileName.c_str(), fourcc, 1, image.size());
 writer.write(image);
 writer.write(image);
 writer.release();
}

void Play()
{
 while (GetFileCount() == 0);

 const char* fileName = GetFirstFilePath();

 ByteStreamFileSource* fileSource;
 while ((fileSource = ByteStreamFileSource::createNew(*env, fileName)) == NULL);

 FramedSource* videoES = fileSource;

 videoSource = H264VideoStreamFramer::createNew(*env, videoES);

 videoSink->startPlaying(*videoSource, AfterPlaying, videoSink);
}

void AfterPlaying(void*)
{
 videoSink->stopPlaying();
 Medium::close(videoSource);

 if (GetFileCount() > 1)
 std::filesystem::remove(GetFirstFilePath());

 Play();
}

long long GetTimeMs()
{
 return std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count();
}

int GetFileCount() 
{
 return std::distance(std::filesystem::directory_iterator(dataPath), std::filesystem::directory_iterator());
}

const char* GetFirstFilePath()
{
 for (const auto& entry : std::filesystem::directory_iterator(dataPath))
 return entry.path().string().c_str();
}



-
How to use ffmpeg to record video from SDP ?
17 août 2024, par Thomas CarltonI'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 :


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



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


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



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.


I'm getting the error :




bind failed : Address already in use.


a.sdp : Invalid data found when processing input




How can I solve that ?


-
Python ffmpeg subprocess never exits on Linux, works on Windows
24 mai 2021, par ChrisI wonder if someone can help explain what is happening ?


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


popen = subprocess.Popen(ffprobecmd, stderr=subprocess.PIPE, shell=True)



And


popen = subprocess.Popen(ffmpegcmd, shell=True, stdout=subprocess.PIPE)



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...




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


EDIT : Here are the commands...


ffprobecmd = 'ffprobe' + \
' -user_agent "' + request.headers['User-Agent'] + '"' + \
' -headers "Referer: ' + request.headers['Referer'] + '"' + \
' -timeout "5000000"' + \
' -v error -select_streams v -show_entries stream=height -of default=nw=1:nk=1' + \
' -i "' + request.url + '"'



and


ffmpegcmd = 'ffmpeg' + \
' -re' + \
' -user_agent "' + r.headers['User-Agent'] + '"' + \
' -headers "Referer: ' + r.headers['Referer'] + '"' + \
' -timeout "10"' + \
' -i "' + r.url + '"' + \
' -c copy' + \
' -f mpegts' + \
' pipe:'



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


import flask
from flask import Response
import subprocess

app = flask.Flask(__name__)

@app.route('/', methods=['GET'])
def go():
 def stream(ffmpegcmd):
 popen = subprocess.Popen(ffmpegcmd, stdout=subprocess.PIPE, shell=True)
 try:
 for stdout_line in iter(popen.stdout.readline, ""):
 yield stdout_line
 except GeneratorExit:
 raise

 url = "https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8"

 ffmpegcmd = 'ffmpeg' + \
 ' -re' + \
 ' -timeout "10"' + \
 ' -i "' + url + '"' + \
 ' -c copy' + \
 ' -f mpegts' + \
 ' pipe:'
 return Response(stream(ffmpegcmd))

if __name__ == '__main__':
 app.run(host= '0.0.0.0', port=5000)