
Recherche avancée
Autres articles (103)
-
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 (...) -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...) -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs
Sur d’autres sites (10926)
-
Stream to youtube from xvfb using ffmpeg and x11grab
13 décembre 2017, par Ivan SergeevI want to make stream from virtual display to youtube via ffmpeg.
I’m using this code :#! /bin/bash
BITRATE="2500k"
FPS="30"
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2"
YOUTUBE_KEY="..."
SOURCE="./test.mp4"
export DISPLAY=44
sudo xvfb-run -a -n 44 -l -s "-screen 0, 1280x720x24" google-chrome -start-maximized https://upload.wikimedia.org/wikipedia/commons/2/2c/Rotating_earth_%28large%29.gif --no-sandbox >/dev/null &
ffmpeg -threads 0 -y -v verbose -re \
-f x11grab -video_size 1280x720 -i :44 \
-vcodec libx264 -pix_fmt yuv420p -preset ultrafast -r $FPS -g $(($FPS * 2)) -b:v $BITRATE -bufsize 512k \
-acodec libmp3lame -ar 44100 -threads 0 -crf 25 -b:a 712000 -bufsize 512k \
-f flv "$YOUTUBE_URL/$YOUTUBE_KEY"And I don’t receive any errors, but youtube cannot start stream(
In my log :
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 4 fps=0.0 q=17.0 size= 72kB time=00:00:00.50 bitrate=1186.9kbits/s
frame= 6 fps=5.9 q=17.0 size= 106kB time=00:00:00.93 bitrate= 931.2kbits
frame= 8 fps=5.3 q=17.0 size= 141kB time=00:00:01.36 bitrate= 846.4kbits/s
frame= 11 fps=5.4 q=16.0 size= 188kB time=00:00:02.00 bitrate= 771.9kbits/s
frame= 13 fps=5.2 q=15.0 size= 217kB time=00:00:02.43 bitrate= 730.5kbits/s
frame= 15 fps=5.0 q=14.0 size= 241kB time=00:00:02.86 bitrate= 687.2kbits/s
frame= 18 fps=5.1 q=14.0 size= 270kB time=00:00:03.53 bitrate= 625.2kbits/s
frame= 20 fps=4.9 q=15.0 size= 294kB time=00:00:03.96 bitrate= 608.3kbits/setc.
However, if I do stream from file, but not x11grab stream is starting normal.
What I’m doing wrong ?
Any ideas, guys, please) -
simple way te to compute rgb buffer from I420 frame ffmpeg
9 mars 2023, par haceneshI'm trying to compute directly rgb buffer from avframe. Something is going wrong since the obtained image is wrong. Extracting grey image from AVFrame->data[0] is working fine. However I'm not able to extract colored image


inline void YCrCb_to_RGB8(int Y, int Cr, int Cb, int& R, int& G, int& B){

 R = (int)(Y + 1.402 *(Cr - 128));
 G = (int)(Y - 0.344136*(Cb-128) -0.71414*(Cr-128));
 B = (int)(Y + 1.772 *(Cb-128));

 if (R < 0) R = 0; else if (R > 255) R = 255;
 if (G < 0) G = 0; else if (G > 255) G = 255;
 if (B < 0) B = 0; else if (B > 255) B = 255;
}

int getRGB8buffer(AVFrame* pFrame, byte* buffer){

 const int width = pFrame->width, height = pFrame->height;
 int Y, Cr, Cb;
 int R, G, B;

 int pixel = 0;
 for (int y = 0; y < height; y++)
 {
 for (int x = 0; x < width; x++)
 {

 Y = pFrame->data[0][x + y * width];
 Cr = pFrame->data[1][x / 2 + ((int)(y / 2)) * pFrame->linesize[1]];
 Cb = pFrame->data[2][x / 2 + ((int)(y / 2)) * pFrame->linesize[2]];

 YCrCb_to_RGB8(Y, Cr, Cb, R, G, B);
 buffer[pixel * 3 + 0] = R;
 buffer[pixel * 3 + 1] = G;
 buffer[pixel * 3 + 2] = B;
 pixel++;
 }
 }
 return 0;
}



When I save the obtained image as ppm using


int save_RGB_frame(unsigned char* buf, int wrap, int xsize,int ysize, const char* filename){

 FILE* f;
 int i;
 f = fopen(filename, "w");
 // portable ppm format -> https://en.wikipedia.org/wiki/Netpbm#PPM_example
 fprintf(f, "P6\n%d %d\n%d\n", xsize, ysize, 255);

 // writing line by line
 for (i = 0; i < ysize; i++)
 fwrite(buf + i * wrap, 1, xsize*3, f);
 fclose(f);

 return 0;
 }



The resulting image is wrong
link the the resulting image https://github.com/hacenesh/ffmpeg_question/blob/main/img_2028144.ppm


-
Get Total number of frames and FPS faster than with OpenCV library in C++
20 juillet 2018, par daniels_paI need to check which video can be analyzed and which cannot given the total number of frames in a video and the fps of the video. I created a c++ program to do the checking. Analyzing each video is not an option since analyzing is time consuming.
I used the OpenCV library for starters :
cv::VideoCapture vid_to_analyze;
vid_to_analyze.open( me_vid.vid_path.string() );
me_vid.total_frames= static_cast<int>(vid_to_analyze.get(CV_CAP_PROP_FRAME_COUNT));
me_vid.fps=vid_to_analyze.get(CV_CAP_PROP_FPS);
if (!vid_to_analyze.isOpened())
{
std::cout << "Skipping vid: "<< me_vid.vid_path.string()<<", couldn't open it" << std::endl;
}
if (me_vid.fps != me_vid.fps || me_vid.fps <= 0)
{
std::cout << "For video " << me_vid.vid_path.string() << std::endl;
std::cout << "FPS of the video file cannot be determined, assuming 30"<< std::endl;
me_vid.fps = 30;
}
vid_to_analyze.release();
</int>However when debugging it becomes painfully slow (the program is faster running without the debugger attached but still very slow given the number of videos it needs to cover). I think that has something to do with 4 threads being created and deleted each time a video is opened (released).
How to get total number of frames and fps in a faster manner ( without actually creating 4 threads !!) if i am not interested in actually grabbing frames from the video just the number of frames and fps.
Is there a way to use ffmpeg library from c++, would that be faster and where to start ?
EDIT : Valgrind seems to agree since (Ir=)91.66% of time spend in the
vid_to_analyze.open
phase