Recherche avancée

Médias (0)

Mot : - Tags -/alertes

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (111)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains 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 ;

  • L’utiliser, en parler, le critiquer

    10 avril 2011

    La première attitude à adopter est d’en parler, soit directement avec les personnes impliquées dans son développement, soit autour de vous pour convaincre de nouvelles personnes à l’utiliser.
    Plus la communauté sera nombreuse et plus les évolutions seront rapides ...
    Une liste de discussion est disponible pour tout échange entre utilisateurs.

  • Modifier la date de publication

    21 juin 2013, par

    Comment changer la date de publication d’un média ?
    Il faut au préalable rajouter un champ "Date de publication" dans le masque de formulaire adéquat :
    Administrer > Configuration des masques de formulaires > Sélectionner "Un média"
    Dans la rubrique "Champs à ajouter, cocher "Date de publication "
    Cliquer en bas de la page sur Enregistrer

Sur d’autres sites (13919)

  • 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;

  • avformat/demux : allow total size of packets in raw_packet_buffer to reach probesize

    7 novembre 2021, par Marton Balint
    avformat/demux : allow total size of packets in raw_packet_buffer to reach probesize
    

    Previously this was hardcoded to 2500000 bytes, so probing of the stream codecs
    was always limited by this, and not probesize.

    Also keep track of the actual size of packets in raw_packet_buffer and not the
    remaining size for simplicity.

    Fixes ticket #5860.

    Signed-off-by : Marton Balint <cus@passwd.hu>

    • [DH] libavformat/demux.c
    • [DH] libavformat/internal.h
    • [DH] libavformat/options.c
    • [DH] libavformat/utils.c