Recherche avancée

Médias (0)

Mot : - Tags -/médias

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

Autres articles (8)

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

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

Sur d’autres sites (4599)

  • how to cut video with specific time using c code ffmpeg ?

    17 avril 2017, par Fidona

    I’m using ffmpeg c code to skip some scene on video. so i have a script like this.

    #include <libavutil></libavutil>timestamp.h>
    #include <libavformat></libavformat>avformat.h>
    #include <libavutil></libavutil>time.h>     // av_gettime()
    #include

    int64_t total = 0;

    static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt, const char *tag, int hours, int mins, int secs, int us, int *time )
    {
       AVRational *time_base = &amp;fmt_ctx->streams[pkt->stream_index]->time_base;

       total = total + pkt->duration;



       *time = av_q2d(*time_base) * pkt->pts ; //ts
    }

    int iexclude[50];
    int nexclude=0;

    static int inexclude( int v ) {
     for( int i=0; i &lt; nexclude;  ) {
       if(  iexclude[i] &lt;= v &amp;&amp; v &lt;= iexclude[i+1] )
         return 1;
       i = i + 2;
     }
     return 0;
    }

    int main(int argc, char **argv)
    {
       AVOutputFormat *ofmt = NULL;
       AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;
       AVPacket pkt;
       const char *in_filename, *out_filename;
       char *ex_time, *token;
       int ret, i;
       int stream_index = 0;
       int *stream_mapping = NULL;
       int stream_mapping_size = 0;
       int hours, mins, secs, us, time, insec;
       int tex[ ] = { 1760, 3060, 4500, 4850, 6235 };


       if (argc &lt; 4 ) {
           printf("usage: %s input output  time_exclude\n"
                  "API example program to remux a media file with libavformat and libavcodec.\n"
                  "The output format is guessed according to the file extension.\n"
                  "  time_exclude ex : 29:17-29:26,50:53-51:20 (without space, comma separated) \n", argv[0]);
           return 1;
       }

       in_filename  = argv[1];
       out_filename = argv[2];
       ex_time      = argv[3];

       token = strtok( ex_time, ",-" );

      /* walk through other tokens */
       while( token != NULL )
       {
         sscanf( token, "%2d:%2d:%2d", &amp;hours, &amp;mins, &amp;secs ) ;
         insec = hours*3600 + mins*60 + secs;
         iexclude[ nexclude++ ] = insec;

         printf( "%s  -  %2d:%2d:%2d - %6d\n", token, hours, mins, secs,  insec );
         token = strtok(NULL, ",-" );
       }

       for( int i=0; i&lt;5; i++ )
         printf( "%d\n", inexclude( tex[i] ));  



       av_register_all();

       if ((ret = avformat_open_input(&amp;ifmt_ctx, in_filename, 0, 0)) &lt; 0) {
           fprintf(stderr, "Could not open input file '%s'", in_filename);
           goto end;
       }

       if ((ret = avformat_find_stream_info(ifmt_ctx, 0)) &lt; 0) {
           fprintf(stderr, "Failed to retrieve input stream information");
           goto end;
       }

       av_dump_format(ifmt_ctx, 0, in_filename, 0);

       avformat_alloc_output_context2(&amp;ofmt_ctx, NULL, NULL, out_filename);
       if (!ofmt_ctx) {
           fprintf(stderr, "Could not create output context\n");
           ret = AVERROR_UNKNOWN;
           goto end;
       }

       stream_mapping_size = ifmt_ctx->nb_streams;
       stream_mapping = av_mallocz_array(stream_mapping_size, sizeof(*stream_mapping));
       if (!stream_mapping) {
           ret = AVERROR(ENOMEM);
           goto end;
       }

       ofmt = ofmt_ctx->oformat;

       for (i = 0; i &lt; ifmt_ctx->nb_streams; i++) {
           AVStream *out_stream;
           AVStream *in_stream = ifmt_ctx->streams[i];
           AVCodecParameters *in_codecpar = in_stream->codecpar;

           if (in_codecpar->codec_type != AVMEDIA_TYPE_AUDIO &amp;&amp;
               in_codecpar->codec_type != AVMEDIA_TYPE_VIDEO &amp;&amp;
               in_codecpar->codec_type != AVMEDIA_TYPE_SUBTITLE) {
               stream_mapping[i] = -1;
               continue;
           }

           stream_mapping[i] = stream_index++;

           out_stream = avformat_new_stream(ofmt_ctx, NULL);
           if (!out_stream) {
               fprintf(stderr, "Failed allocating output stream\n");
               ret = AVERROR_UNKNOWN;
               goto end;
           }

           ret = avcodec_parameters_copy(out_stream->codecpar, in_codecpar);
           if (ret &lt; 0) {
               fprintf(stderr, "Failed to copy codec parameters\n");
               goto end;
           }
           out_stream->codecpar->codec_tag = 0;
       }
       av_dump_format(ofmt_ctx, 0, out_filename, 1);

       if (!(ofmt->flags &amp; AVFMT_NOFILE)) {
           ret = avio_open(&amp;ofmt_ctx->pb, out_filename, AVIO_FLAG_WRITE);
           if (ret &lt; 0) {
               fprintf(stderr, "Could not open output file '%s'", out_filename);
               goto end;
           }
       }

       ret = avformat_write_header(ofmt_ctx, NULL);
       if (ret &lt; 0) {
           fprintf(stderr, "Error occurred when opening output file\n");
           goto end;
       }

       int64_t pts = INT64_MIN + 1;
       int64_t now;

       AVRational ar;
       int loop = 0;

       while (1) {
           loop++;
           AVStream *in_stream, *out_stream;

           ret = av_read_frame(ifmt_ctx, &amp;pkt);
           if (ret &lt; 0)
               break;

           in_stream  = ifmt_ctx->streams[pkt.stream_index];
           if (pkt.stream_index >= stream_mapping_size ||
               stream_mapping[pkt.stream_index] &lt; 0) {
               av_packet_unref(&amp;pkt);
               continue;
           }

           pkt.stream_index = stream_mapping[pkt.stream_index];
           out_stream = ofmt_ctx->streams[pkt.stream_index];

           //log_packet(ifmt_ctx, &amp;pkt, "in");

           /* copy packet */
           pkt.pts = av_rescale_q_rnd(pkt.pts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
           pkt.dts = av_rescale_q_rnd(pkt.dts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
           pkt.duration = av_rescale_q(pkt.duration, in_stream->time_base, out_stream->time_base);
           pkt.pos = -1;

           log_packet(ofmt_ctx, &amp;pkt, "out", hours, mins, secs, us, &amp;time );
           //if ( time &lt;= 30 || time >= 150 )
           if( ! inexclude( time ) )
             ret = av_interleaved_write_frame(ofmt_ctx, &amp;pkt);

           if (ret &lt; 0) {
               fprintf(stderr, "Error muxing packet\n");
               break;
           }
           av_packet_unref(&amp;pkt);
       }

       printf("Loop %d\n", loop );
       av_write_trailer(ofmt_ctx);
    end:

       avformat_close_input(&amp;ifmt_ctx);

       /* close output */
       if (ofmt_ctx &amp;&amp; !(ofmt->flags &amp; AVFMT_NOFILE))
           avio_closep(&amp;ofmt_ctx->pb);
       avformat_free_context(ofmt_ctx);

       av_freep(&amp;stream_mapping);

       if (ret &lt; 0 &amp;&amp; ret != AVERROR_EOF) {
           fprintf(stderr, "Error occurred: %s\n", av_err2str(ret));
           return 1;
       }

    and the resul

       printf( "Total = %u AV_TIME_BASE=%d\n", total , AV_TIME_BASE );
       return 0;
    }

    the code is save with the extension .c
    when i compile this code to skip some scene in specific time, the video was skipped, but it stay freeze until the specified time that i input is finished. what should i add on the code to make the freeze scene get cut ?

  • Revision 1ff94fea56 : Inline vp9_quantize() in xform_quant(). Cycle times : 4x4 : 151 to 131 cycles

    11 juillet 2013, par Ronald S. Bultje

    Changed Paths :
     Modify /vp9/encoder/vp9_encodemb.c


     Modify /vp9/encoder/vp9_quantize.c


     Modify /vp9/encoder/vp9_quantize.h



    Inline vp9_quantize() in xform_quant().

    Cycle times :
    4x4 : 151 to 131 cycles (15% faster)
    8x8 : 334 to 306 cycles (9% faster)
    16x16 : 1401 to 1368 cycles (2.5% faster)
    32x32 : 7403 to 7367 cycles (0.5% faster)

    Total encode time of first 50 frames of bus @ 1500kbps (speed 0)
    goes from 1min39.2 to 1min38.6, i.e. a 0.67% overall speedup.

    Change-Id : I799a49460e5e3fcab01725564dd49c629bfe935f

  • FFMPEG get a video duration and create a thumbnail

    14 mars 2018, par M.Izzat

    Currently this is what I use to convert a video into image from python :

    def video_conversion(raw_file):
       duration = "ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 input.mp4"
       thumbnail_cmd = "ffmpeg -ss 10 -i input.mp4 -vframes 1 output.jpg"
       subprocess.call(duration)
       return output

    but this will create and Image for every 30 sec of the video duration, what I want is get the video total duration and create athumbnail exactly in the middle of the duration

    e.g : if the video duration is 60 second, create a thumbnail on the 30th second