Recherche avancée

Médias (3)

Mot : - Tags -/collection

Autres articles (55)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-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

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

Sur d’autres sites (9150)

  • Real-Time Buffer Too Full (FFMPEG)

    25 janvier 2018, par Nimble

    So I’ve been having this issue with ffmpeg, it has been a journey getting the hardware and command to actually do what I want, but I still have one problem.

    Sometimes when I’m recording I just start dropping frames like crazy, this can be after an hour of recording or even ten hours in... Everything will be working fine and then suddenly I’ll start dropping frames due to "real-time buffer too full or near too full". This happens regardless of how low I put the bitrate, and the buffer size is high as it will allow, eventually I’ll just start dropping frames. Almost seems like it could be like a power saving feature kicking in but it’s too inconsistent it seems. Like I said sometimes I can go 10 hours without having this issue.

    Any ideas ?

    Here is my block of code :

    ffmpeg -guess_layout_max 0 -y -f dshow -video_size 3440x1440 -rtbufsize 2147.48M -pixel_format nv12 -framerate 200 ^
    -i video="Video (00 Pro Capture HDMI 4K+)":audio="SPDIF/ADAT (1+2) (RME Fireface UC)" -map 0:0,0:1 -map 0:1 ^
    -preset: llhp -codec:v h264_nvenc -pix_fmt nv12 -b:v 250M -maxrate:v 250M -minrate:v 250M -bufsize:v 250M -b:a 320k ^
    -ac 2 -r 100 -async 1 -vsync 1 -segment_time 600 -segment_wrap 9 -f segment C:\Users\djcim\Videos\PC\PC%02d.mp4 ^
    -guess_layout_max 0 -f dshow -rtbufsize 2000M -i audio="Analog (3+4) (RME Fireface UC)" -map 1:0 -b:a 320k -ac 2 ^
    -af "adelay=200|200" -segment_time 600 -segment_wrap 9 -f segment C:\Users\djcim\Videos\PC\Voices\Theirs\TPC%02d.wav ^
    -guess_layout_max 0 -f dshow -rtbufsize 2000M -i audio="Analog (5+6) (RME Fireface UC)" -map 2:0 -b:a 320k -ac 2 ^
    -af "adelay=825|825" -segment_time 600 -segment_wrap 9 -f segment C:\Users\djcim\Videos\PC\Voices\Mine\MPC%02d.wav

    Here is the error, it repeated around 300 times before locking up ffmpeg forcing my to quit before starting the recording again :

    [dshow @ 0000019a596bdcc0] real-time buffer [Video (00 Pro Capture HDMI 4K+)] [video input] too full or near too full (62% of size: 2147480000 [rtbufsize parameter])! frame dropped!
  • libavformat/rtpdec : Fix RTP timestamp wraparound in Producer Reference Time

    7 juin, par Clément Péron
    libavformat/rtpdec : Fix RTP timestamp wraparound in Producer Reference Time
    

    The rtp_set_prft() function incorrectly calculates the timestamp delta
    when RTP timestamps wrap around the 32-bit boundary. The current code :

    delta_timestamp = (int64_t)timestamp - (int64_t)s->last_rtcp_timestamp ;

    treats both timestamps as large positive values, causing wraparound to
    produce a large negative delta instead of the correct small positive delta.

    For example, with a 90kHz video clock :
    - last_rtcp_timestamp = 0xFFFFFF00 (near wraparound)
    - timestamp = 0x00000100 (after wraparound)
    - Current result : delta ≈ -4.3 billion ticks ≈ -47,721 seconds
    - Expected result : delta ≈ +512 ticks ≈ +0.006 seconds

    This causes prft->wallclock to jump backward by approximately :
    - 90kHz video : 47,721 seconds ( 13.25 hours)
    - 48kHz audio : 89,478 seconds ( 24.9 hours)
    - 8kHz audio : 536,871 seconds ( 6.2 days)

    Fix by casting the subtraction result to int32_t, which correctly
    handles wraparound through modular arithmetic :

    delta_timestamp = (int32_t)(timestamp - s->last_rtcp_timestamp) ;

    This ensures the delta is always in the range [-2^31, 2^31-1], making
    wraparound produce the correct small positive values.

    Fixes timing jumps in applications that rely on Producer Reference Time
    for media synchronization.

    Signed-off-by : Clément Péron <peron.clem@gmail.com>
    Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>

    • [DH] libavformat/rtpdec.c
  • 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 ?