
Recherche avancée
Autres articles (50)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Other interesting software
13 avril 2011, parWe don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
We don’t know them, we didn’t try them, but you can take a peek.
Videopress
Website : http://videopress.com/
License : GNU/GPL v2
Source code : (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
Sur d’autres sites (5239)
-
Installer flvtool++
22 août 2011Flvtool++ développé par Facebook est beaucoup plus rapide que Flvtool2 auparavant installé car il est écrit en C alors que Flvtool2 est en Ruby.
Pour gagner en performance, il est préférable d’utiliser flvtool++ pour ajouter les métadonnées aux fichiers flv.
Qui plus est, apparemment flvtool++ gère les videos très longue contrairement à flvtool2.
On installera donc flvtool++ en plus de flvtool2 dans un premier temps afin de tester partout son bon fonctionnement.
Tutoriel d’installation : http://technique.arscenic.org/compi...
-
Revision 33863 : gerer des socialtags en les conditionnant au fait que le visiteur provient ...
20 décembre 2009, par fil@… — Loggerer des socialtags en les conditionnant au fait que le visiteur provient du site en question (facebook) ; gerer un badge facebook
la doc arrive sur spip-contrib -
FFmpeg C++ decoding in a separate thread
12 juin 2019, par BrigapesI’m trying to decode a video with FFmpeg and convert it to an openGL texture and display it inside a cocos2dx engine. I’ve managed to do that and it displays the video as i wanted to, now the problem is performance wise. I get a Sprite update every frame(game is fixed 60fps, video is 30fps) so what i did was i decoded and converted frame interchangeably, didn’t work great, now i have it set up to have a separate thread where i decode in an infinite
while
loop withsleep()
just so it doesn’t hog the cpu/program.
What i currently have set up is 2 pbo framebuffers and abool
flag to tell my ffmpeg thread loop to decode another frame since i don’t know how to manually wait when to decode another frame. I’ve searched online for a soultion to this kind of problem but didn’t manage to get any answers.I’ve looked at this : Decoding video directly into a texture in separate thread but it didn’t solve my problem since it was just converting YUV to RGB inside opengl shaders which i haven’t done yet but currently not an issue.
Additional info that might be useful is that i don’t need to end thread until application exit and i’m open to using any video format, including lossless.
Ok so main decoding loop looks like this :
//.. this is inside of a constructor / init
//adding thread to array in order to save the thread
global::global_pending_futures.push_back(std::async(std::launch::async, [=] {
while (true) {
if (isPlaying) {
this->decodeLoop();
}
else {
std::this_thread::sleep_for(std::chrono::milliseconds(3));
}
}
}));Reason why i use bool to check if frame was used is because main decoding function takes about 5ms to finish in debug and then should wait about 11 ms for it to display the frame, so i can’t know when the frame was displayed and i also don’t know how long did decoding take.
Decode function :
void video::decodeLoop() { //this should loop in a separate thread
frameData* buff = nullptr;
if (buf1.needsRefill) {
/// buf1.bufferLock.lock();
buff = &buf1;
buf1.needsRefill = false;
firstBuff = true;
}
else if (buf2.needsRefill) {
///buf2.bufferLock.lock();
buff = &buf2;
buf2.needsRefill = false;
firstBuff = false;
}
if (buff == nullptr) {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
return;//error? //wait?
}
//pack pixel buffer?
if (getNextFrame(buff)) {
getCurrentRBGConvertedFrame(buff);
}
else {
loopedTimes++;
if (loopedTimes >= repeatTimes) {
stop();
}
else {
restartVideoPlay(&buf1);//restart both
restartVideoPlay(&buf2);
if (getNextFrame(buff)) {
getCurrentRBGConvertedFrame(buff);
}
}
}
/// buff->bufferLock.unlock();
return;
}As you can tell i first check if buffer was used using bool needsRefill and then decode another frame.
frameData struct :
struct frameData {
frameData() {};
~frameData() {};
AVFrame* frame;
AVPacket* pkt;
unsigned char* pdata;
bool needsRefill = true;
std::string name = "";
std::mutex bufferLock;
///unsigned int crrFrame
GLuint pboid = 0;
};And this is called every frame :
void video::actualDraw() { //meant for cocos implementation
if (this->isVisible()) {
if (this->getOpacity() > 0) {
if (isPlaying) {
if (loopedTimes >= repeatTimes) { //ignore -1 because comparing unsgined to signed
this->stop();
}
}
if (isPlaying) {
this->setVisible(true);
if (!display) { //skip frame
///this->getNextFrame();
display = true;
}
else if (display) {
display = false;
auto buff = this->getData();
width = this->getWidth();
height = this->getHeight();
if (buff) {
if (buff->pdata) {
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buff->pboid);
glBufferData(GL_PIXEL_UNPACK_BUFFER, 3 * (width*height), buff->pdata, GL_DYNAMIC_DRAW);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, 0);///buff->pdata); glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
}
buff->needsRefill = true;
}
}
}
else { this->setVisible(false); }
}
}
}getData func to tell which frambuffer it uses
video::frameData* video::getData() {
if (firstBuff) {
if (buf1.needsRefill == false) {
///firstBuff = false;
return &buf1;///.pdata;
}
}
else { //if false
if (buf2.needsRefill == false) {
///firstBuff = true;
return &buf2;///.pdata;
}
}
return nullptr;
}I’m not sure what else to include i pasted whole code to pastebin.
video.cpp : https://pastebin.com/cWGT6APn
video.h https://pastebin.com/DswAXwXVTo summarize the problem :
How do i properly implement decoding in a separate thread / how do i optimize current code ?
Currently video is lagging when some other thread or main thread gets heavy and then it does not decode fast enough.