
Recherche avancée
Médias (1)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
Autres articles (65)
-
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
Participer à sa traduction
10 avril 2011Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
Actuellement MediaSPIP n’est disponible qu’en français et (...) -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
Sur d’autres sites (9195)
-
Live555 : X264 Stream Live source based on "testOnDemandRTSPServer"
26 octobre 2017, par user2660369I am trying to create a rtsp Server that streams the OpenGL output of my program. I had a look at How to write a Live555 FramedSource to allow me to stream H.264 live, but I need the stream to be unicast. So I had a look at testOnDemandRTSPServer. Using the same Code fails. To my understanding I need to provide memory in which I store my h264 frames so the OnDemandServer can read them on Demand.
H264VideoStreamServerMediaSubsession.cpp
H264VideoStreamServerMediaSubsession*
H264VideoStreamServerMediaSubsession::createNew(UsageEnvironment& env,
Boolean reuseFirstSource) {
return new H264VideoStreamServerMediaSubsession(env, reuseFirstSource);
}
H264VideoStreamServerMediaSubsession::H264VideoStreamServerMediaSubsession(UsageEnvironment& env, Boolean reuseFirstSource)
: OnDemandServerMediaSubsession(env, reuseFirstSource), fAuxSDPLine(NULL), fDoneFlag(0), fDummyRTPSink(NULL) {
}
H264VideoStreamServerMediaSubsession::~H264VideoStreamServerMediaSubsession() {
delete[] fAuxSDPLine;
}
static void afterPlayingDummy(void* clientData) {
H264VideoStreamServerMediaSubsession* subsess = (H264VideoStreamServerMediaSubsession*)clientData;
subsess->afterPlayingDummy1();
}
void H264VideoStreamServerMediaSubsession::afterPlayingDummy1() {
// Unschedule any pending 'checking' task:
envir().taskScheduler().unscheduleDelayedTask(nextTask());
// Signal the event loop that we're done:
setDoneFlag();
}
static void checkForAuxSDPLine(void* clientData) {
H264VideoStreamServerMediaSubsession* subsess = (H264VideoStreamServerMediaSubsession*)clientData;
subsess->checkForAuxSDPLine1();
}
void H264VideoStreamServerMediaSubsession::checkForAuxSDPLine1() {
char const* dasl;
if (fAuxSDPLine != NULL) {
// Signal the event loop that we're done:
setDoneFlag();
} else if (fDummyRTPSink != NULL && (dasl = fDummyRTPSink->auxSDPLine()) != NULL) {
fAuxSDPLine = strDup(dasl);
fDummyRTPSink = NULL;
// Signal the event loop that we're done:
setDoneFlag();
} else {
// try again after a brief delay:
int uSecsToDelay = 100000; // 100 ms
nextTask() = envir().taskScheduler().scheduleDelayedTask(uSecsToDelay,
(TaskFunc*)checkForAuxSDPLine, this);
}
}
char const* H264VideoStreamServerMediaSubsession::getAuxSDPLine(RTPSink* rtpSink, FramedSource* inputSource) {
if (fAuxSDPLine != NULL) return fAuxSDPLine; // it's already been set up (for a previous client)
if (fDummyRTPSink == NULL) { // we're not already setting it up for another, concurrent stream
// Note: For H264 video files, the 'config' information ("profile-level-id" and "sprop-parameter-sets") isn't known
// until we start reading the file. This means that "rtpSink"s "auxSDPLine()" will be NULL initially,
// and we need to start reading data from our file until this changes.
fDummyRTPSink = rtpSink;
// Start reading the file:
fDummyRTPSink->startPlaying(*inputSource, afterPlayingDummy, this);
// Check whether the sink's 'auxSDPLine()' is ready:
checkForAuxSDPLine(this);
}
envir().taskScheduler().doEventLoop(&fDoneFlag);
return fAuxSDPLine;
}
FramedSource* H264VideoStreamServerMediaSubsession::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) {
estBitrate = 500; // kb
megamol::remotecontrol::View3D_MRC *parent = (megamol::remotecontrol::View3D_MRC*)this->parent;
return H264VideoStreamFramer::createNew(envir(), parent->h264FramedSource);
}
RTPSink* H264VideoStreamServerMediaSubsession::createNewRTPSink(Groupsock* rtpGroupsock, unsigned char rtpPayloadTypeIfDynamic, FramedSource* /*inputSource*/) {
return H264VideoRTPSink::createNew(envir(), rtpGroupsock, rtpPayloadTypeIfDynamic);
}FramedSource.cpp
H264FramedSource* H264FramedSource::createNew(UsageEnvironment& env,
unsigned preferredFrameSize,
unsigned playTimePerFrame)
{
return new H264FramedSource(env, preferredFrameSize, playTimePerFrame);
}
H264FramedSource::H264FramedSource(UsageEnvironment& env,
unsigned preferredFrameSize,
unsigned playTimePerFrame)
: FramedSource(env),
fPreferredFrameSize(fMaxSize),
fPlayTimePerFrame(playTimePerFrame),
fLastPlayTime(0),
fCurIndex(0)
{
x264_param_default_preset(&param, "veryfast", "zerolatency");
param.i_threads = 1;
param.i_width = 1024;
param.i_height = 768;
param.i_fps_num = 30;
param.i_fps_den = 1;
// Intra refres:
param.i_keyint_max = 60;
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;
param.i_sps_id = 7;
//For streaming:
param.b_repeat_headers = 1;
param.b_annexb = 1;
x264_param_apply_profile(&param, "baseline");
param.i_log_level = X264_LOG_ERROR;
encoder = x264_encoder_open(&param);
pic_in.i_type = X264_TYPE_AUTO;
pic_in.i_qpplus1 = 0;
pic_in.img.i_csp = X264_CSP_I420;
pic_in.img.i_plane = 3;
x264_picture_alloc(&pic_in, X264_CSP_I420, 1024, 768);
convertCtx = sws_getContext(1024, 768, PIX_FMT_RGBA, 1024, 768, PIX_FMT_YUV420P, SWS_FAST_BILINEAR, NULL, NULL, NULL);
eventTriggerId = envir().taskScheduler().createEventTrigger(deliverFrame0);
}
H264FramedSource::~H264FramedSource()
{
envir().taskScheduler().deleteEventTrigger(eventTriggerId);
eventTriggerId = 0;
}
void H264FramedSource::AddToBuffer(uint8_t* buf, int surfaceSizeInBytes)
{
uint8_t* surfaceData = (new uint8_t[surfaceSizeInBytes]);
memcpy(surfaceData, buf, surfaceSizeInBytes);
int srcstride = 1024*4;
sws_scale(convertCtx, &surfaceData, &srcstride,0, 768, pic_in.img.plane, pic_in.img.i_stride);
x264_nal_t* nals = NULL;
int i_nals = 0;
int frame_size = -1;
frame_size = x264_encoder_encode(encoder, &nals, &i_nals, &pic_in, &pic_out);
static bool finished = false;
if (frame_size >= 0)
{
static bool alreadydone = false;
if(!alreadydone)
{
x264_encoder_headers(encoder, &nals, &i_nals);
alreadydone = true;
}
for(int i = 0; i < i_nals; ++i)
{
m_queue.push(nals[i]);
}
}
delete [] surfaceData;
surfaceData = nullptr;
envir().taskScheduler().triggerEvent(eventTriggerId, this);
}
void H264FramedSource::doGetNextFrame()
{
deliverFrame();
}
void H264FramedSource::deliverFrame0(void* clientData)
{
((H264FramedSource*)clientData)->deliverFrame();
}
void H264FramedSource::deliverFrame()
{
x264_nal_t nalToDeliver;
if (fPlayTimePerFrame > 0 && fPreferredFrameSize > 0) {
if (fPresentationTime.tv_sec == 0 && fPresentationTime.tv_usec == 0) {
// This is the first frame, so use the current time:
gettimeofday(&fPresentationTime, NULL);
} else {
// Increment by the play time of the previous data:
unsigned uSeconds = fPresentationTime.tv_usec + fLastPlayTime;
fPresentationTime.tv_sec += uSeconds/1000000;
fPresentationTime.tv_usec = uSeconds%1000000;
}
// Remember the play time of this data:
fLastPlayTime = (fPlayTimePerFrame*fFrameSize)/fPreferredFrameSize;
fDurationInMicroseconds = fLastPlayTime;
} else {
// We don't know a specific play time duration for this data,
// so just record the current time as being the 'presentation time':
gettimeofday(&fPresentationTime, NULL);
}
if(!m_queue.empty())
{
m_queue.wait_and_pop(nalToDeliver);
uint8_t* newFrameDataStart = (uint8_t*)0xD15EA5E;
newFrameDataStart = (uint8_t*)(nalToDeliver.p_payload);
unsigned newFrameSize = nalToDeliver.i_payload;
// Deliver the data here:
if (newFrameSize > fMaxSize) {
fFrameSize = fMaxSize;
fNumTruncatedBytes = newFrameSize - fMaxSize;
}
else {
fFrameSize = newFrameSize;
}
memcpy(fTo, nalToDeliver.p_payload, nalToDeliver.i_payload);
FramedSource::afterGetting(this);
}
}Relevant part of the RTSP-Server Therad
RTSPServer* rtspServer = RTSPServer::createNew(*(parent->env), 8554, NULL);
if (rtspServer == NULL) {
*(parent->env) << "Failed to create RTSP server: " << (parent->env)->getResultMsg() << "\n";
exit(1);
}
char const* streamName = "Stream";
parent->h264FramedSource = H264FramedSource::createNew(*(parent->env), 0, 0);
H264VideoStreamServerMediaSubsession *h264VideoStreamServerMediaSubsession = H264VideoStreamServerMediaSubsession::createNew(*(parent->env), true);
h264VideoStreamServerMediaSubsession->parent = parent;
sms->addSubsession(h264VideoStreamServerMediaSubsession);
rtspServer->addServerMediaSession(sms);
parent->env->taskScheduler().doEventLoop(); // does not returnOnce a connection exists the render loop calls
h264FramedSource->AddToBuffer(videoData, 1024*768*4);
-
Cant link against ffmpeg with openssl using cmake
24 mars 2017, par David BarishevI have build ffmpeg libraries statically for x86 android using a custom configuration.Now i wanted to add them in my android project.
Im using ffmpeg 3.2.git, android studio 2.3.
I created a folder named distribution which had my binaries, and the minimum headers i needed for it to not tell me about missing header (Except for the avutil- i just included them all), located the root of my project.
I edited my cmake to include the libraries :add_library(
native-lib
SHARED
src/main/cpp/native-lib.cpp )
set(distribution_DIR ${CMAKE_SOURCE_DIR}/../distribution)
add_library(lib_avcodec STATIC IMPORTED)
set_target_properties(lib_avcodec PROPERTIES IMPORTED_LOCATION
${distribution_DIR}/libavcodec/lib/${ANDROID_ABI}/libavcodec.a)
add_library(lib_avfilter STATIC IMPORTED)
set_target_properties(lib_avfilter PROPERTIES IMPORTED_LOCATION
${distribution_DIR}/libavfilter/lib/${ANDROID_ABI}/libavfilter.a)
add_library(lib_avformat STATIC IMPORTED)
set_target_properties(lib_avformat PROPERTIES IMPORTED_LOCATION
${distribution_DIR}/libavformat/lib/${ANDROID_ABI}/libavformat.a)
add_library(lib_avutil STATIC IMPORTED)
set_target_properties(lib_avutil PROPERTIES IMPORTED_LOCATION
${distribution_DIR}/libavutil/lib/${ANDROID_ABI}/libavutil.a)
add_library(lib_swresample STATIC IMPORTED)
set_target_properties(lib_swresample PROPERTIES IMPORTED_LOCATION
${distribution_DIR}/libswresample/lib/${ANDROID_ABI}/libswresample.a)
include_directories(
${distribution_DIR}
)
find_library( # Sets the name of the path variable.
z-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
z )
target_link_libraries(
native-lib
${z-lib}
lib_crypto
lib_ssl
lib_avfilter
lib_avformat
lib_avcodec
lib_swresample
lib_avutil
)I also restricted the build to only x86, in my app build.gradle :
ndk {
// Specifies the ABI configurations of your native
// libraries Gradle should build and package with your APK.
abiFilters 'x86'
}The project gradle sync worked successfully.
I wrote the following code in my cpp file :#include
extern "C"{
#include "libavformat/avformat.h"
}
JNIEXPORT void JNICALL
Java_com_example_david_testffmpegcpp_MainActivity_stringFromJNI(
JNIEnv *env,
jobject /* this */) {
av_register_all ();
avformat_network_init ();
}Just to check if the library works, but i cant seem to link against the libraries correctly. It complains about undefined symbols.
What did i do wrong ?EDIT :
I changed the order of the linked libraries, and was able to remove all error for ffmpeg’s library functions not found, and i added zlib,that removed some more.
The only error left are those how are related to openssl, its logical since i compiled my ffmpeg libraries with openssl.
I tried linking my openssl static libraries that i used for compiling ffmpeg like this :
set(ssl_dir ${CMAKE_SOURCE_DIR}/../../../FFmpegBuild/Openssl/output_19/android)
add_library(lib_ssl STATIC IMPORTED)
set_target_properties(lib_ssl PROPERTIES IMPORTED_LOCATION
${ssl_dir}/openssl-${ANDROID_ABI}/lib/libssl.a)
add_library(lib_crypto STATIC IMPORTED)
set_target_properties(lib_crypto PROPERTIES IMPORTED_LOCATION
${ssl_dir}/openssl-${ANDROID_ABI}/lib/libcrypto.a)
include_directories( ${ssl_dir}/openssl-${ANDROID_ABI}/include
${distribution_DIR}
)And linked against them :
target_link_libraries( # Specifies the target library.
native-lib
${z-lib}
lib_ssl
lib_crypto
lib_avfilter
lib_avformat
lib_avcodec
lib_swresample
lib_avutil
)But i’m still getting the error that i state below.
My question is why ? Also if i already built ffmpeg in static mode, how come i need to relink openssl again ?Error :
Error while executing process D:\AndroidSDK\cmake\3.6.3155560\bin\cmake.exe with arguments {--build D:\AndroidApps\TestFFmpegCpp\app\.externalNativeBuild\cmake\debug\x86 --target native-lib}
[1/1] Linking CXX shared library ..\..\..\..\build\intermediates\cmake\debug\obj\x86\libnative-lib.so
FAILED: cmd.exe /C "cd . && D:\AndroidSDK\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=i686-none-linux-android --gcc-toolchain=D:/AndroidSDK/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64 --sysroot=D:/AndroidSDK/ndk-bundle/platforms/android-19/arch-x86 -fPIC -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,--noexecstack -Wformat -Werror=format-security -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,--noexecstack -Wformat -Werror=format-security -O0 -fno-limit-debug-info -O0 -fno-limit-debug-info -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libnative-lib.so -o ..\..\..\..\build\intermediates\cmake\debug\obj\x86\libnative-lib.so CMakeFiles/native-lib.dir/src/main/cpp/native-lib.cpp.o -lz ../../../../../../../FFmpegBuild/Openssl/output_19/android/openssl-x86/lib/libcrypto.a ../../../../../../../FFmpegBuild/Openssl/output_19/android/openssl-x86/lib/libssl.a ../../../../../distribution/libavfilter/lib/x86/libavfilter.a ../../../../../distribution/libavformat/lib/x86/libavformat.a ../../../../../distribution/libavcodec/lib/x86/libavcodec.a ../../../../../distribution/libswresample/lib/x86/libswresample.a ../../../../../distribution/libavutil/lib/x86/libavutil.a -lm "D:/AndroidSDK/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/libgnustl_static.a" && cd ."
src/libavformat/tls_openssl.c:125: error: undefined reference to 'BIO_clear_flags'
src/libavformat/tls_openssl.c:102: error: undefined reference to 'BIO_clear_flags'
src/libavformat/tls_openssl.c:116: error: undefined reference to 'BIO_clear_flags'
src/libavformat/tls_openssl.c:116: error: undefined reference to 'BIO_clear_flags'
src/libavformat/tls_openssl.c:309: error: undefined reference to 'SSL_read'
src/libavformat/tls_openssl.c:200: error: undefined reference to 'ERR_get_error'
src/libavformat/tls_openssl.c:200: error: undefined reference to 'ERR_error_string'
src/libavformat/tls_openssl.c:320: error: undefined reference to 'SSL_write'
src/libavformat/tls_openssl.c:200: error: undefined reference to 'ERR_get_error'
src/libavformat/tls_openssl.c:200: error: undefined reference to 'ERR_error_string'
src/libavformat/tls_openssl.c:154: error: undefined reference to 'SSL_library_init'
src/libavformat/tls_openssl.c:155: error: undefined reference to 'SSL_load_error_strings'
src/libavformat/tls_openssl.c:157: error: undefined reference to 'CRYPTO_get_locking_callback'
src/libavformat/tls_openssl.c:159: error: undefined reference to 'CRYPTO_num_locks'
src/libavformat/tls_openssl.c:165: error: undefined reference to 'CRYPTO_num_locks'
src/libavformat/tls_openssl.c:167: error: undefined reference to 'CRYPTO_set_locking_callback'
src/libavformat/tls_openssl.c:186: error: undefined reference to 'CRYPTO_get_locking_callback'
src/libavformat/tls_openssl.c:188: error: undefined reference to 'CRYPTO_set_locking_callback'
src/libavformat/tls_openssl.c:189: error: undefined reference to 'CRYPTO_num_locks'
src/libavformat/tls_openssl.c:208: error: undefined reference to 'SSL_shutdown'
src/libavformat/tls_openssl.c:209: error: undefined reference to 'SSL_free'
src/libavformat/tls_openssl.c:212: error: undefined reference to 'SSL_CTX_free'
src/libavformat/tls_openssl.c:240: error: undefined reference to 'SSLv23_client_method'
src/libavformat/tls_openssl.c:240: error: undefined reference to 'SSL_CTX_new'
src/libavformat/tls_openssl.c:246: error: undefined reference to 'SSL_CTX_ctrl'
src/libavformat/tls_openssl.c:248: error: undefined reference to 'SSL_CTX_load_verify_locations'
src/libavformat/tls_openssl.c:251: error: undefined reference to 'SSL_CTX_use_certificate_chain_file'
src/libavformat/tls_openssl.c:257: error: undefined reference to 'SSL_CTX_use_PrivateKey_file'
src/libavformat/tls_openssl.c:267: error: undefined reference to 'SSL_new'
src/libavformat/tls_openssl.c:284: error: undefined reference to 'BIO_new'
src/libavformat/tls_openssl.c:287: error: undefined reference to 'SSL_set_bio'
src/libavformat/tls_openssl.c:290: error: undefined reference to 'SSL_accept'
src/libavformat/tls_openssl.c:240: error: undefined reference to 'SSLv23_server_method'
src/libavformat/tls_openssl.c:258: error: undefined reference to 'ERR_get_error'
src/libavformat/tls_openssl.c:258: error: undefined reference to 'ERR_error_string'
src/libavformat/tls_openssl.c:208: error: undefined reference to 'SSL_shutdown'
src/libavformat/tls_openssl.c:209: error: undefined reference to 'SSL_free'
src/libavformat/tls_openssl.c:212: error: undefined reference to 'SSL_CTX_free'
src/libavformat/tls_openssl.c:290: error: undefined reference to 'SSL_connect'
src/libavformat/tls_openssl.c:200: error: undefined reference to 'ERR_get_error'
src/libavformat/tls_openssl.c:200: error: undefined reference to 'ERR_error_string'
src/libavformat/tls_openssl.c:266: error: undefined reference to 'SSL_CTX_set_verify'
src/libavformat/tls_openssl.c:289: error: undefined reference to 'SSL_ctrl'
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed. -
ffmpeg : init filtergraphs only after we have a frame on each input
27 mai 2016, par Anton Khirnovffmpeg : init filtergraphs only after we have a frame on each input
This makes sure the actual stream parameters are used, which is
important mainly for hardware decoding+filtering cases, which would
previously require various weird workarounds to handle the fact that a
fake software graph has to be constructed, but never used.
This should also improve behaviour in rare cases where
avformat_find_stream_info() does not provide accurate information.This merges Libav commit a3a0230. It was previously skipped.
The code in flush_encoders() which sets up a "fake" format wasn’t in
Libav. I’m not sure if it’s a good idea, but it tends to give
behavior closer to the old one in certain corner cases.The vp8-size-change gives different result, because now the size of
the first frame is used. libavformat reported the size of the largest
frame for some reason.The exr tests now use the sample aspect ratio of the first frame. For
some reason libavformat determines 0/1 as aspect ratio, while the
decoder returns the correct one.The ffm and mxf tests change the field_order values. I’m assuming
another libavformat/decoding mismatch.Signed-off-by : wm4 <nfxjfg@googlemail.com>
- [DH] ffmpeg.c
- [DH] ffmpeg.h
- [DH] ffmpeg_cuvid.c
- [DH] ffmpeg_filter.c
- [DH] ffmpeg_opt.c
- [DH] ffmpeg_qsv.c
- [DH] tests/ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9
- [DH] tests/ref/fate/exr-rgba-scanline-float-half-b44-12x8-l1
- [DH] tests/ref/fate/exr-rgba-scanline-float-half-b44-12x8-l2
- [DH] tests/ref/fate/exr-rgba-scanline-float-half-b44-13x9-l1
- [DH] tests/ref/fate/exr-rgba-scanline-float-half-b44-13x9-l2
- [DH] tests/ref/fate/exr-rgba-scanline-float-half-b44a-12x8-l1
- [DH] tests/ref/fate/exr-rgba-scanline-float-half-b44a-12x8-l2
- [DH] tests/ref/fate/exr-rgba-scanline-float-half-b44a-13x9-l1
- [DH] tests/ref/fate/exr-rgba-scanline-float-half-b44a-13x9-l2
- [DH] tests/ref/fate/vp8-size-change
- [DH] tests/ref/lavf/ffm
- [DH] tests/ref/lavf/mxf