
Recherche avancée
Médias (91)
-
Spoon - Revenge !
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
My Morning Jacket - One Big Holiday
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Zap Mama - Wadidyusay ?
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
David Byrne - My Fair Lady
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Beastie Boys - Now Get Busy
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Granite de l’Aber Ildut
9 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
Autres articles (47)
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.
Sur d’autres sites (3947)
-
Problems with Streaming a Multicast RTSP Stream with Live555
16 juin 2014, par ALM865I am having trouble setting up a Multicast RTSP session using Live555. The examples included with Live555 are mostly irrelevant as they deal with reading in files and my code differs because it reads in encoded frames generated from a FFMPEG thread within my own program (no pipes, no saving to disk, it is genuinely passing pointers to memory that contain the encoded frames for Live555 to stream).
My Live555 project that uses a custom Server Media Subsession so that I can receive data from an FFMPEG thread within my program (instead of Live555’s default reading from a file, yuk !). This is a requirement of my program as it reads in a GigEVision stream in one thread, sends the decoded raw RGB packets to the FFMPEG thread, which then in turn sends the encoded frames off to Live555 for RTSP streaming.
For the life of me I can’t work out how to send the RTSP stream as multicast instead of unicast !
Just a note, my program works perfectly at the moment streaming Unicast, so there is nothing wrong with my Live555 implementation (before you go crazy picking out irrelevant errors !). I just need to know how to modify my existing code to stream Multicast instead of Unicast.
My program is way too big to upload and share so I’m just going to share the important bits :
Live_AnalysingServerMediaSubsession.h
#ifndef _ANALYSING_SERVER_MEDIA_SUBSESSION_HH
#define _ANALYSING_SERVER_MEDIA_SUBSESSION_HH
#include
#include "Live_AnalyserInput.h"
class AnalysingServerMediaSubsession: public OnDemandServerMediaSubsession {
public:
static AnalysingServerMediaSubsession*
createNew(UsageEnvironment& env, AnalyserInput& analyserInput, unsigned estimatedBitrate,
Boolean iFramesOnly = False,
double vshPeriod = 5.0
/* how often (in seconds) to inject a Video_Sequence_Header,
if one doesn't already appear in the stream */);
protected: // we're a virtual base class
AnalysingServerMediaSubsession(UsageEnvironment& env, AnalyserInput& AnalyserInput, unsigned estimatedBitrate, Boolean iFramesOnly, double vshPeriod);
virtual ~AnalysingServerMediaSubsession();
protected:
AnalyserInput& fAnalyserInput;
unsigned fEstimatedKbps;
private:
Boolean fIFramesOnly;
double fVSHPeriod;
// redefined virtual functions
virtual FramedSource* createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate);
virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* inputSource);
};
#endifAnd "Live_AnalysingServerMediaSubsession.cpp"
#include "Live_AnalysingServerMediaSubsession.h"
#include
#include
#include
AnalysingServerMediaSubsession* AnalysingServerMediaSubsession::createNew(UsageEnvironment& env, AnalyserInput& wisInput, unsigned estimatedBitrate,
Boolean iFramesOnly,
double vshPeriod) {
return new AnalysingServerMediaSubsession(env, wisInput, estimatedBitrate,
iFramesOnly, vshPeriod);
}
AnalysingServerMediaSubsession
::AnalysingServerMediaSubsession(UsageEnvironment& env, AnalyserInput& analyserInput, unsigned estimatedBitrate, Boolean iFramesOnly, double vshPeriod)
: OnDemandServerMediaSubsession(env, True /*reuse the first source*/),
fAnalyserInput(analyserInput), fIFramesOnly(iFramesOnly), fVSHPeriod(vshPeriod) {
fEstimatedKbps = (estimatedBitrate + 500)/1000;
}
AnalysingServerMediaSubsession
::~AnalysingServerMediaSubsession() {
}
FramedSource* AnalysingServerMediaSubsession ::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) {
estBitrate = fEstimatedKbps;
// Create a framer for the Video Elementary Stream:
//LOG_MSG("Create Net Stream Source [%d]", estBitrate);
return MPEG1or2VideoStreamDiscreteFramer::createNew(envir(), fAnalyserInput.videoSource());
}
RTPSink* AnalysingServerMediaSubsession ::createNewRTPSink(Groupsock* rtpGroupsock, unsigned char /*rtpPayloadTypeIfDynamic*/, FramedSource* /*inputSource*/) {
setVideoRTPSinkBufferSize();
/*
struct in_addr destinationAddress;
destinationAddress.s_addr = inet_addr("239.255.12.42");
rtpGroupsock->addDestination(destinationAddress,8888);
rtpGroupsock->multicastSendOnly();
*/
return MPEG1or2VideoRTPSink::createNew(envir(), rtpGroupsock);
}Live_AnalyserSouce.h
#ifndef _ANALYSER_SOURCE_HH
#define _ANALYSER_SOURCE_HH
#ifndef _FRAMED_SOURCE_HH
#include "FramedSource.hh"
#endif
class FFMPEG;
// The following class can be used to define specific encoder parameters
class AnalyserParameters {
public:
FFMPEG * Encoding_Source;
};
class AnalyserSource: public FramedSource {
public:
static AnalyserSource* createNew(UsageEnvironment& env, FFMPEG * E_Source);
static unsigned GetRefCount();
public:
static EventTriggerId eventTriggerId;
protected:
AnalyserSource(UsageEnvironment& env, FFMPEG * E_Source);
// called only by createNew(), or by subclass constructors
virtual ~AnalyserSource();
private:
// redefined virtual functions:
virtual void doGetNextFrame();
private:
static void deliverFrame0(void* clientData);
void deliverFrame();
private:
static unsigned referenceCount; // used to count how many instances of this class currently exist
FFMPEG * Encoding_Source;
unsigned int Last_Sent_Frame_ID;
};
#endifLive_AnalyserSource.cpp
#include "Live_AnalyserSource.h"
#include // for "gettimeofday()"
#include "FFMPEGClass.h"
AnalyserSource* AnalyserSource::createNew(UsageEnvironment& env, FFMPEG * E_Source) {
return new AnalyserSource(env, E_Source);
}
EventTriggerId AnalyserSource::eventTriggerId = 0;
unsigned AnalyserSource::referenceCount = 0;
AnalyserSource::AnalyserSource(UsageEnvironment& env, FFMPEG * E_Source) : FramedSource(env), Encoding_Source(E_Source) {
if (referenceCount == 0) {
// Any global initialization of the device would be done here:
}
++referenceCount;
// Any instance-specific initialization of the device would be done here:
Last_Sent_Frame_ID = 0;
/* register us with the Encoding thread so we'll get notices when new frame data turns up.. */
Encoding_Source->RegisterRTSP_Source(&(env.taskScheduler()), this);
// We arrange here for our "deliverFrame" member function to be called
// whenever the next frame of data becomes available from the device.
//
// If the device can be accessed as a readable socket, then one easy way to do this is using a call to
// envir().taskScheduler().turnOnBackgroundReadHandling( ... )
// (See examples of this call in the "liveMedia" directory.)
//
// If, however, the device *cannot* be accessed as a readable socket, then instead we can implement is using 'event triggers':
// Create an 'event trigger' for this device (if it hasn't already been done):
if (eventTriggerId == 0) {
eventTriggerId = envir().taskScheduler().createEventTrigger(deliverFrame0);
}
}
AnalyserSource::~AnalyserSource() {
// Any instance-specific 'destruction' (i.e., resetting) of the device would be done here:
/* de-register this source from the Encoding thread, since we no longer need notices.. */
Encoding_Source->Un_RegisterRTSP_Source(this);
--referenceCount;
if (referenceCount == 0) {
// Any global 'destruction' (i.e., resetting) of the device would be done here:
// Reclaim our 'event trigger'
envir().taskScheduler().deleteEventTrigger(eventTriggerId);
eventTriggerId = 0;
}
}
unsigned AnalyserSource::GetRefCount() {
return referenceCount;
}
void AnalyserSource::doGetNextFrame() {
// This function is called (by our 'downstream' object) when it asks for new data.
//LOG_MSG("Do Next Frame..");
// Note: If, for some reason, the source device stops being readable (e.g., it gets closed), then you do the following:
//if (0 /* the source stops being readable */ /*%%% TO BE WRITTEN %%%*/) {
unsigned int FrameID = Encoding_Source->GetFrameID();
if (FrameID == 0){
//LOG_MSG("No Data. Close");
handleClosure(this);
return;
}
// If a new frame of data is immediately available to be delivered, then do this now:
if (Last_Sent_Frame_ID != FrameID){
deliverFrame();
//DEBUG_MSG("Frame ID: %d",FrameID);
}
// No new data is immediately available to be delivered. We don't do anything more here.
// Instead, our event trigger must be called (e.g., from a separate thread) when new data becomes available.
}
void AnalyserSource::deliverFrame0(void* clientData) {
((AnalyserSource*)clientData)->deliverFrame();
}
void AnalyserSource::deliverFrame() {
if (!isCurrentlyAwaitingData()) return; // we're not ready for the data yet
static u_int8_t* newFrameDataStart;
static unsigned newFrameSize = 0;
/* get the data frame from the Encoding thread.. */
if (Encoding_Source->GetFrame(&newFrameDataStart, &newFrameSize, &Last_Sent_Frame_ID)){
if (newFrameDataStart!=NULL) {
/* This should never happen, but check anyway.. */
if (newFrameSize > fMaxSize) {
fFrameSize = fMaxSize;
fNumTruncatedBytes = newFrameSize - fMaxSize;
} else {
fFrameSize = newFrameSize;
}
gettimeofday(&fPresentationTime, NULL); // If you have a more accurate time - e.g., from an encoder - then use that instead.
// If the device is *not* a 'live source' (e.g., it comes instead from a file or buffer), then set "fDurationInMicroseconds" here.
/* move the data to be sent off.. */
memmove(fTo, newFrameDataStart, fFrameSize);
/* release the Mutex we had on the Frame's buffer.. */
Encoding_Source->ReleaseFrame();
}
else {
//AM Added, something bad happened
//ALTRACE("LIVE555: FRAME NULL\n");
fFrameSize=0;
fTo=NULL;
handleClosure(this);
}
}
else {
//LOG_MSG("Closing Connection due to Frame Error..");
handleClosure(this);
}
// After delivering the data, inform the reader that it is now available:
FramedSource::afterGetting(this);
}Live_AnalyserInput.cpp
#include "Live_AnalyserInput.h"
#include "Live_AnalyserSource.h"
////////// WISInput implementation //////////
AnalyserInput* AnalyserInput::createNew(UsageEnvironment& env, FFMPEG *Encoder) {
if (!fHaveInitialized) {
//if (!initialize(env)) return NULL;
fHaveInitialized = True;
}
return new AnalyserInput(env, Encoder);
}
FramedSource* AnalyserInput::videoSource() {
if (fOurVideoSource == NULL || AnalyserSource::GetRefCount() == 0) {
fOurVideoSource = AnalyserSource::createNew(envir(), m_Encoder);
}
return fOurVideoSource;
}
AnalyserInput::AnalyserInput(UsageEnvironment& env, FFMPEG *Encoder): Medium(env), m_Encoder(Encoder) {
}
AnalyserInput::~AnalyserInput() {
/* When we get destroyed, make sure our source is also destroyed.. */
if (fOurVideoSource != NULL && AnalyserSource::GetRefCount() != 0) {
AnalyserSource::handleClosure(fOurVideoSource);
}
}
Boolean AnalyserInput::fHaveInitialized = False;
int AnalyserInput::fOurVideoFileNo = -1;
FramedSource* AnalyserInput::fOurVideoSource = NULL;Live_AnalyserInput.h
#ifndef _ANALYSER_INPUT_HH
#define _ANALYSER_INPUT_HH
#include
#include "FFMPEGClass.h"
class AnalyserInput: public Medium {
public:
static AnalyserInput* createNew(UsageEnvironment& env, FFMPEG *Encoder);
FramedSource* videoSource();
private:
AnalyserInput(UsageEnvironment& env, FFMPEG *Encoder); // called only by createNew()
virtual ~AnalyserInput();
private:
friend class WISVideoOpenFileSource;
static Boolean fHaveInitialized;
static int fOurVideoFileNo;
static FramedSource* fOurVideoSource;
FFMPEG *m_Encoder;
};
// Functions to set the optimal buffer size for RTP sink objects.
// These should be called before each RTPSink is created.
#define VIDEO_MAX_FRAME_SIZE 300000
inline void setVideoRTPSinkBufferSize() { OutPacketBuffer::maxSize = VIDEO_MAX_FRAME_SIZE; }
#endifAnd finally the relevant code from my Live555 worker thread that starts the whole process :
Stop_RTSP_Loop=0;
// MediaSession *ms;
TaskScheduler *scheduler;
UsageEnvironment *env ;
// RTSPClient *rtsp;
// MediaSubsession *Video_Sub;
char RTSP_Address[1024];
RTSP_Address[0]=0x00;
if (m_Encoder == NULL){
//DEBUG_MSG("No Video Encoder registered for the RTSP Encoder");
return 0;
}
scheduler = BasicTaskScheduler::createNew();
env = BasicUsageEnvironment::createNew(*scheduler);
UserAuthenticationDatabase* authDB = NULL;
#ifdef ACCESS_CONTROL
// To implement client access control to the RTSP server, do the following:
if (m_Enable_Pass){
authDB = new UserAuthenticationDatabase;
authDB->addUserRecord(UserN, PassW);
}
////////// authDB = new UserAuthenticationDatabase;
////////// authDB->addUserRecord((char*)"Admin", (char*)"Admin"); // replace these with real strings
// Repeat the above with each <username>, <password> that you wish to allow
// access to the server.
#endif
// Create the RTSP server:
RTSPServer* rtspServer = RTSPServer::createNew(*env, 554, authDB);
ServerMediaSession* sms;
AnalyserInput* inputDevice;
if (rtspServer == NULL) {
TRACE("LIVE555: Failed to create RTSP server: %s\n", env->getResultMsg());
return 0;
}
else {
char const* descriptionString = "Session streamed by \"IMC Server\"";
// Initialize the WIS input device:
inputDevice = AnalyserInput::createNew(*env, m_Encoder);
if (inputDevice == NULL) {
TRACE("Live555: Failed to create WIS input device\n");
return 0;
}
else {
// A MPEG-1 or 2 video elementary stream:
/* Increase the buffer size so we can handle the high res stream.. */
OutPacketBuffer::maxSize = 300000;
// NOTE: This *must* be a Video Elementary Stream; not a Program Stream
sms = ServerMediaSession::createNew(*env, RTSP_Address, RTSP_Address, descriptionString);
//sms->addSubsession(MPEG1or2VideoFileServerMediaSubsession::createNew(*env, inputFileName, reuseFirstSource, iFramesOnly));
sms->addSubsession(AnalysingServerMediaSubsession::createNew(*env, *inputDevice, m_Encoder->Get_Bitrate()));
//sms->addSubsession(WISMPEG1or2VideoServerMediaSubsession::createNew(sms->envir(), inputDevice, videoBitrate));
rtspServer->addServerMediaSession(sms);
//announceStream(rtspServer, sms, streamName, inputFileName);
//LOG_MSG("Play this stream using the URL %s", rtspServer->rtspURL(sms));
}
}
Stop_RTSP_Loop=0;
for (;;)
{
/* The actual work is all carried out inside the LIVE555 Task scheduler */
env->taskScheduler().doEventLoop(&Stop_RTSP_Loop); // does not return
if (mStop) {
break;
}
}
Medium::close(rtspServer); // will also reclaim "sms" and its "ServerMediaSubsession"s
Medium::close(inputDevice);
</password></username> -
FFMPEG excute error from C# with "setup factory"setups
15 mars 2012, par Savas Adari am developing an application and i am using ffmpeg in this application for convert audio file "mp3" to "amr".
My application running successfully when i debug it or when if i copy debug folder another computer, it is running.
But, i am create a setup with "Setup Factory" application. When i install application which i create with setup factory, ffmpeg code block is not running, i get "OutputPackage" as null.
here is code ;
Converter converter = new Converter();
//varsa sil
if (File.Exists(PathTargetPre + "_orijinal.amr"))
File.Delete(PathTargetPre + "_orijinal.amr");
//dosyayı convert et ve olustur
OutputPackage oo = converter.ConvertToAMR(PathSource, PathTargetPre + "_orijinal.amr");
if (oo == null)
{
MessageBox.Show("Convert Error!");
return;
}
//dosya hazırlandı
if (oo.AudioStream == null)
{
MessageBox.Show("Convert Error 2!");
return;
}
lblGercekBoyut.Text = Convert.ToString((oo.AudioStream.Length / 1000)) + " KB";
lblSikismisBoyut.Text = Convert.ToString((oo.AudioStream.Length / 1000)) + " KB";
actualBitrate = converter.GetVideoInfo(PathTargetPre + "_orijinal.amr").BitRate;here is "ConvertToAMR" method ;
public OutputPackage ConvertToAMR(string sourcePath, string destPath)
{
OutputPackage ou = new OutputPackage();
string Params = string.Format("-i {0} -ar 8000 -ac 1 {1}", sourcePath, destPath);
//-ab 320k
string output = RunProcess(Params);
if (File.Exists(destPath))
{
ou.AudioStream = LoadMemoryStreamFromFile(destPath);
}
return ou;
} -
ffmpeg converter php script not working as expected
8 juillet 2012, par mintuzI have been looking into a php video converter method and have followed a tutorial on how to get one set up. It can read the source video file fine, my script shows an md5, fps rate, bit rate etc but it does not create the destination file. Any suggestions on why my code is not working.
I have tried both system() ; and exec() ; commands, both do not work and safe_mode is off. I have also tried a more basic command
"/usr/bin/ffmpeg -i /home/mintuz/video.avi /var/www/video.flv"
This command however works through the terminal.
<?php
define('FFMPEG_LIBRARY', '/usr/bin/ffmpeg');
//ALTER STUFF HERE
$srcFile = "/home/mintuz/video.avi"; //source file
$destFile = "/var/www/video.flv"; //destination file
if (strpos($srcFile, '.avi'))
{
$type = "avi";
echo $type;
}
if (strpos($srcFile, '.mp4'))
{
$type = "mp4";
echo $type;
}
if (strpos($srcFile, '.mov'))
{
$type = "mov";
echo $type;
}
//-------------------------------------------------------------------------------------------------------------------
// Create our FFMPEG-PHP class
$ffmpegObj = new ffmpeg_movie($srcFile);
// Save our needed variables
$srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
echo "<br />".$srcWidth."<br />";
$srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
echo $srcHeight."<br />";
$srcFPS = $ffmpegObj->getFrameRate();
echo $srcFPS."<br />";
$srcAB = intval($ffmpegObj->getAudioBitRate()/1000);
$srcAR = $ffmpegObj->getAudioSampleRate();
// Call our convert using exec()
$cmd = FFMPEG_LIBRARY." -i ".$srcFile." -ar ".$srcAR." -ab ".$srcAB." -f flv -s ".$srcWidth."x".$srcHeight." ".$destFile;
system($cmd);
echo "Source File MD5 : ".md5_file($srcFile)."<br />";
echo "Destination File MD5 : ".md5_file($destFile);
// Make multiples function
function makeMultipleTwo ($value)
{
$sType = gettype($value/2);
if($sType == "integer")
{
return $value;
} else {
return ($value-1);
}
}
?>