Recherche avancée

Médias (91)

Autres articles (47)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

  • Déploiements possibles

    31 janvier 2010, par

    Deux types de déploiements sont envisageable dépendant de deux aspects : La méthode d’installation envisagée (en standalone ou en ferme) ; Le nombre d’encodages journaliers et la fréquentation envisagés ;
    L’encodage de vidéos est un processus lourd consommant énormément de ressources système (CPU et RAM), il est nécessaire de prendre tout cela en considération. Ce système n’est donc possible que sur un ou plusieurs serveurs dédiés.
    Version mono serveur
    La version mono serveur consiste à n’utiliser qu’une (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

Sur d’autres sites (4217)

  • Adding frame numbers to a video, along with total frame duration

    21 novembre 2022, par Abraham Thomas

    I need to add frame numbers to videos along with total frame duration of the video. It should show the first frame and the last frame, along with the current frame.

    


    In this forum someone had posted a command, which gives the current frame number ;
I've used this and this below command works for me :

    


    ffmpeg -i inputvid.mp4 -vf "drawtext=fontfile=Arial.ttf : text='%frame_num' : start_number=1001 : x=(w-tw)/2 : y=h-(2*lh) : fontcolor=white : fontsize=55 : box=1 : boxcolor=black : boxborderw=5" -c:a copy D :\Test\outputvid.mp4

    


    But it doesn't show the total frame duration ;
Is there a way to add to this command ; to show the first frame and last frame of the video as well (I'm on windows) ;

    


  • How do I use ffmpeg to extract the total time of a video slice without actually producing the video slice ?

    18 juin 2022, par iChux
    


    I have a video named 'ev.mp4'. Slice the video into segments :

    


    


    # COMMAND 1
ffmpeg -i "ev.mp4" -c copy -map 0 -segment_time 15 -g 9 \
    -sc_threshold 0 -force_key_frames "expr:gte(t,n_forced*9)" \
    -reset_timestamps 1 -f segment ev-%04d.mp4

ev-0000.mp4
ev-0001.mp4
ev-0002.mp4


    


    


    Get each segment time

    


    


    # COMMAND 2
for f in ev-*.mp4;
do
    echo $f == $(ffprobe -v error -show_entries \
    format=duration -of default=noprint_wrappers=1:nokey=1 $f);
done;

ev-0000.mp4 == 17.251000
ev-0001.mp4 == 17.918000
ev-0002.mp4 == 10.444000


    


    


    I am only able to extract the duration of each sliced segment after the videos have existed in a sliced format on the hard drive e.g. ev-0000.mp4

    


    


    My question : is it possible to get the duration of each slice from COMMAND 1 such that instead of producing the sliced files, I will get the duration of each slice ?

    


  • Slightly different number of total frames between my program (using libav) and ffprobe

    16 juin 2022, par Alvein

    For 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&#xA;</media>

    &#xA;

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

    &#xA;

    And this is my source code :

    &#xA;

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

    &#xA;

    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.

    &#xA;

    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.

    &#xA;

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

    &#xA;

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

    &#xA;

    &#xA;

    My program : 301 video frames ; 440 audio frames

    &#xA;

    ffprobe : 303 video frames ; 440 audio frames

    &#xA;

    &#xA;

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

    &#xA;

    &#xA;

    My program : 736 video frames ; no audio frames

    &#xA;

    ffprobe : 738 video frames ; no audio frames

    &#xA;

    &#xA;

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

    &#xA;

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

    &#xA;

    Thank you.

    &#xA;