
Recherche avancée
Autres articles (65)
-
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 ;
-
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 (13447)
-
Slightly different number of total frames between my program (using libav) and ffprobe
16 juin 2022, par AlveinFor learning purposes, I made a routine that decodes each frame for each stream inside a given container.


I noticed that for some videos, the amount of frames returned by my code differs the one calculated by the tool ffprobe (which comes with ffmpeg).


I'm using ffprobe like this :


ffprobe <media file="file"> -v error -select_streams v:0 -count_frames -show_entries stream=nb_read_frames
</media>


Replacing "v:0" with "a:0" for audio, etc.


And this is my source code :


void showFrames(char *szFilename) {
 int iError;
 char szError[AV_ERROR_MAX_STRING_SIZE];
 AVFormatContext *fcFormatCtx;
 AVCodec *cdCodec;
 AVCodecParameters *cdpCodecParams;
 AVCodecContext *ccCodecCtx;
 AVPacket *pkPacket;
 AVFrame *frFrame;
 fcFormatCtx=avformat_alloc_context();
 iError=avformat_open_input(&fcFormatCtx,szFilename,NULL,NULL);
 if(0>iError) {
 av_strerror(iError,szError,sizeof(szError));
 fprintf(stderr,"avformat_open_input() failed: %s\n",szError);
 return;
 }
 iError=avformat_find_stream_info(fcFormatCtx,NULL);
 if(0>iError) {
 av_strerror(iError,szError,sizeof(szError));
 fprintf(stderr,"avformat_find_stream_info() failed: %s\n",szError);
 avformat_close_input(&fcFormatCtx);
 return;
 }
 for(uint uiSt=0;uiStnb_streams;uiSt++) {
 cdpCodecParams=fcFormatCtx->streams[uiSt]->codecpar;
 cdCodec=avcodec_find_decoder(cdpCodecParams->codec_id);
 if(NULL==cdCodec) {
 fprintf(stderr,"no codec found for stream %u\n",uiSt);
 continue;
 }
 fprintf(stderr,"stream %u\n",uiSt);
 if(AVMEDIA_TYPE_VIDEO==cdpCodecParams->codec_type)
 fprintf(stderr,"video codec id=%d name='%s'\n",
 cdCodec->id,cdCodec->long_name);
 else if(AVMEDIA_TYPE_AUDIO==cdpCodecParams->codec_type)
 fprintf(stderr,"audio codec id=%d name='%s'\n",
 cdCodec->id,cdCodec->long_name);
 else {
 fprintf(stderr,"unsupported codec id=%d name='%s'\n",
 cdCodec->id,cdCodec->long_name);
 continue;
 }
 ccCodecCtx=avcodec_alloc_context3(cdCodec);
 avcodec_parameters_to_context(ccCodecCtx,cdpCodecParams);
 iError=avcodec_open2(ccCodecCtx,cdCodec,NULL);
 if(0>iError) {
 av_strerror(iError,szError,sizeof(szError));
 fprintf(stderr,"avcodec_open2() failed: %s\n",szError);
 avcodec_free_context(&ccCodecCtx);
 continue;
 }
 pkPacket=av_packet_alloc();
 frFrame=av_frame_alloc();
 av_seek_frame(fcFormatCtx,uiSt,0,AVSEEK_FLAG_FRAME);
 while(0==av_read_frame(fcFormatCtx,pkPacket)) {
 if(uiSt==pkPacket->stream_index) {
 iError=avcodec_send_packet(ccCodecCtx,pkPacket);
 if(0>iError) {
 av_strerror(iError,szError,sizeof(szError));
 fprintf(stderr,"avcodec_send_packet() failed: %s\n",szError);
 break;
 }
 while(true) {
 iError=avcodec_receive_frame(ccCodecCtx,frFrame);
 if(0>iError)
 break;
 fprintf(stderr,"stream %u, frame %d\n",
 uiSt,ccCodecCtx->frame_number);
 av_frame_unref(frFrame);
 }
 if(AVERROR(EAGAIN)!=iError&&AVERROR_EOF!=iError) {
 av_strerror(iError,szError,sizeof(szError));
 fprintf(stderr,"avcodec_receive_frame() failed: %s\n",szError);
 break;
 }
 }
 av_packet_unref(pkPacket);
 }
 av_packet_free(&pkPacket);
 av_frame_free(&frFrame);
 avcodec_free_context(&ccCodecCtx);
 }
 avformat_close_input(&fcFormatCtx);
}



It's pretty much self contained but you may ignore all the initializations and go directly to the while after the call to av_seek_frame(). This is where the actual frames are being read.


BTW, I'm using av_seek_frame() because this program goes stream by stream, separating the frames, so I need to rewind with every stream found.


Anyway, I've tested the previous code with the following files :


#1. sample-10s.mp4 from https://samplelib.com/sample-mp4.html ...




My program : 301 video frames ; 440 audio frames


ffprobe : 303 video frames ; 440 audio frames




#2. production ID_3997798.mp4 from https://www.pexels.com/video/hands-hand-table-colorful-3997798/ ...




My program : 736 video frames ; no audio frames


ffprobe : 738 video frames ; no audio frames




I found more videos with this difference, but it ONLY happens in the video streams.


Is there something I am forgetting ? There seem to be always 2 frames behind what ffprobe shows.


Thank you.


-
Get displaymatrix and change it using ffmpeg C API [closed]
24 février 2023, par VioGLDue to how phones are oriented if a phone takes a picture with portrait mode, the video seems to have an aspect ratio where height is greater than width, but the buffer inside it is rotated.


Here is what I'm trying to mean, originally, when displayed through "Videos" on debian 11 the video looks like this :




But when I normally use it with ffmpeg (I write the data I got from decoder to an opengl texture and display it) and view it on firefox it looks like this (Ignore the background being green it's intentional) :




As you can see even though the aspect ratios are the same (roughly 500x1000), for some reason ffmpeg and firefox displays the video like that.


I've deduced that there is a metadata called display matrix that show's me a rotation value. This rotation value is in fact there because the video is shot from an Iphone which does add a rotation data depending on how you are holding the phone while recording (in this case it's held vertically)


I can see the rotation metadata using this ffprobe command :


ffprobe phone_video.mp4



Along the lines of the output I can see this :


Side data:
 displaymatrix: rotation of -90.00 degrees



Which is exactly what I need. It is indeed rotated 90 degrees. However I can't access this inside my C/C++ code, here is what I've tried so far :


for (int j = 0; j < av_frame->nb_side_data; j++) 
{
 AVFrameSideData *sd = av_frame->side_data[j];

 if(sd->type == AV_FRAME_DATA_DISPLAYMATRIX) 
 {
 float a = av_display_rotation_get((int32_t *)sd->data);
 PRINT_INFO("=> displaymatrix: rotation of {} degrees",a );
 }
}



This results in no output so far.


Also I've noticed that on firefox, the video is displayed as rotated but chrome manages to display the video correctly.


I have two questions :


- 

- How can I get the metadata information of the videos
displaymatrix
rotation with the C API ? - How can I flip the video to be displayed correctly, preferably inside the C API ?






Note that I want to change the data inside the buffer so the aspect ratio remains the same. So I want the bottom video to look like the top one.


- How can I get the metadata information of the videos
-
can't record docker selenium with ffmpeg and ubuntu 18
1er janvier 2019, par Alex028502I have a script that starts a selenium/standalone-chrome container, starts recording with ffmpeg, and runs the selenium tests. However, it is not working with ubuntu 18, possibly because of the ffmpeg version (3.4.4 instead of 2.8.15).
I have broken down the problem into a couple commands which work fine in ubuntu 16 but not ubuntu 18 :
start selenium container in terminal #1
docker run --network=host --shm-size=2g -e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1080 selenium/standalone-chrome:3.141.59-antimony
start recording in terminal #2
rm -f test.mp4
# :99 seems to be the default for the selenium container
ffmpeg -f x11grab -video_size 1920x1080 -i :99 -codec:v libx264 -r 4 test.mp4and I get something that looks like this
frame= 2 fps=0.1 q=-1.0 Lsize= 2kB time=00:00:00.25 bitrate= 75.9kbits/s dup=0 drop=413 speed=0.0165
the time stays at 0, and then goes up to 25msec when I stop it.
On the other hand, if I just start regular screen buffer in terminal #1
Xvfb :99 -screen 0 1920x1080x24
and run the same thing as above in terminal #2, everything works
Also, I am pretty sure that the above
ffmpeg
command worked in ubuntu 16, with ffmpeg-3.So to summarise when the above
ffmpeg
command seems to work :| ubuntu 16 (ffmpeg 3) | ubuntu 18 (ffmpeg 4)
just start Xvfb | works | works
selenium container | works | DOES NOT WORKAny ideas ?