Recherche avancée

Médias (0)

Mot : - Tags -/metadatas

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

Autres articles (63)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • 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

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (5835)

  • FFmpeg encoding live audio to aac issue

    12 juillet 2015, par Ruurd Adema

    I’m trying to encode live raw audio coming from a Blackmagic Decklink input card to a mov file with AAC encoding.

    The issue is that the audio sounds distorted and plays to fast.

    I created the software based on a couple of examples/tutorials including the Dranger tutorial and examples on Github (and of course the examples in the FFmpeg codebase).

    Honestly, at this moment I don’t exactly know what the cause of the problem is. I’m thinking about PTS/DTS values or a timebase mismatch (because of the too fast playout), I tried a lot of things, including working with an av_audio_fifo.

    • When outputting to the mov file with the AV_CODEC_ID_PCM_S16LE codec, everything works well
    • When outputting to the mov file with the AV_CODEC_ID_AAC codec, the problems occur
    • When writing RAW audio VLC media info shows :
      Type : Audio, Codec : PCM S16 LE (sowt), Language : English, Channels : Stereo, Sample rate : 48000 Hz, Bits per sample.
    • When writing with AAC codec VLC media info shows :
      Type : Audio, Codec : MPEG AAC Audio (mp4a), Language : English, Channels : Stereo, Sample rate : 48000 Hz.

    Any idea(s) of what’s causing the problems ?

    Code

    // Create output context

    output_filename = "/root/movies/encoder_debug.mov";
    output_format_name = "mov";
    if (avformat_alloc_output_context2(&output_fmt_ctx, NULL, output_format_name, output_filename) < 0)
    {
       printf("[ERROR] Unable to allocate output format context for output: %s\n", output_filename);
    }

    // Create audio output stream

    static AVStream *encoder_add_audio_stream(AVFormatContext *oc, enum AVCodecID codec_id)
    {
       AVCodecContext  *c;
       AVCodec         *codec;
       AVStream        *st;

       st = avformat_new_stream(oc, NULL);
       if (!st)
       {
           printf("[ERROR] Could not allocate new audio stream!\n");
           exit(-1);
       }

       c                 = st->codec;
       c->codec_id       = codec_id;
       c->codec_type     = AVMEDIA_TYPE_AUDIO;
       c->sample_fmt     = AV_SAMPLE_FMT_S16;
       c->sample_rate    = decklink_config()->audio_samplerate;
       c->channels       = decklink_config()->audio_channel_count;
       c->channel_layout = av_get_default_channel_layout(decklink_config()->audio_channel_count);
       c->time_base.den  = decklink_config()->audio_samplerate;
       c->time_base.num  = 1;

       if (codec_id == AV_CODEC_ID_AAC)
       {
           c->bit_rate       = 96000;  
           //c->profile = FF_PROFILE_AAC_MAIN; //FIXME Generates error: "Unable to set the AOT 1: Invalid config"
           // Allow the use of the experimental AAC encoder
           c->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
       }

       // Some formats want stream headers to be seperate (global?)
       if (oc->oformat->flags & AVFMT_GLOBALHEADER)
       {
           c->flags |= CODEC_FLAG_GLOBAL_HEADER;
       }

       codec = avcodec_find_encoder(c->codec_id);
       if (!codec)
       {
           printf("[ERROR] Audio codec not found\n");
           exit(-1);
       }

       if (avcodec_open2(c, codec, NULL) < 0)
       {
           printf("[ERROR] Could not open audio codec\n");
           exit(-1);
       }

       return st;
    }

    // En then, at every incoming frame this function gets called:

    void encoder_handle_incoming_frame(IDeckLinkVideoInputFrame *videoframe, IDeckLinkAudioInputPacket *audiopacket)
    {
       void *pixels = NULL;
       int   pitch = 0;
       int got_packet = 0;

       void *audiopacket_data          = NULL;
       long  audiopacket_sample_count  = 0;
       long  audiopacket_size          = 0;
       long  audiopacket_channel_count = 2;

       if (audiopacket)
       {  
           AVPacket pkt = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
           AVFrame *frame;
           BMDTimeValue audio_pts;
           int requested_size;
           static int last_pts1, last_pts2 = 0;

           audiopacket_sample_count  = audiopacket->GetSampleFrameCount();
           audiopacket_channel_count = decklink_config()->audio_channel_count;
           audiopacket_size          = audiopacket_sample_count * (decklink_config()->audio_sampletype/8) * audiopacket_channel_count;

           audiopacket->GetBytes(&audiopacket_data);

           av_init_packet(&pkt);    

           printf("\n=== Audiopacket: %d ===\n", audio_stream->codec->frame_number);

           if (AUDIO_TYPE == AV_CODEC_ID_PCM_S16LE)
           {
               audiopacket->GetPacketTime(&audio_pts, audio_stream->time_base.den);

               pkt.pts          = audio_pts;
               pkt.dts          = pkt.pts;
               pkt.flags       |= AV_PKT_FLAG_KEY;                 // TODO: Make sure if this still applies
               pkt.stream_index = audio_stream->index;
               pkt.data         = (uint8_t *)audiopacket_data;
               pkt.size         = audiopacket_size;

               printf("[PACKET] size:              %d\n", pkt.size);
               printf("[PACKET] pts:               %li\n", pkt.pts);
               printf("[PACKET] pts delta:         %li\n", pkt.pts - last_pts2);
               printf("[PACKET] duration:          %d\n", pkt.duration);
               last_pts2 = pkt.pts;

               av_interleaved_write_frame(output_fmt_ctx, &pkt);
           }
           else if (AUDIO_TYPE == AV_CODEC_ID_AAC)
           {
               frame = av_frame_alloc();
               frame->format = audio_stream->codec->sample_fmt;
               frame->channel_layout = audio_stream->codec->channel_layout;
               frame->sample_rate = audio_stream->codec->sample_rate;
               frame->nb_samples = audiopacket_sample_count;

               requested_size = av_samples_get_buffer_size(NULL, audio_stream->codec->channels, audio_stream->codec->frame_size, audio_stream->codec->sample_fmt, 1);

               audiopacket->GetPacketTime(&audio_pts, audio_stream->time_base.den);

               printf("[DEBUG] Sample format:      %d\n", frame->format);
               printf("[DEBUG] Channel layout:     %li\n", frame->channel_layout);
               printf("[DEBUG] Sample rate:        %d\n", frame->sample_rate);
               printf("[DEBUG] NB Samples:         %d\n", frame->nb_samples);
               printf("[DEBUG] Datasize:           %li\n", audiopacket_size);
               printf("[DEBUG] Requested datasize: %d\n", requested_size);
               printf("[DEBUG] Too less/much:      %li\n", audiopacket_size - requested_size);
               printf("[DEBUG] Framesize:          %d\n", audio_stream->codec->frame_size);
               printf("[DEBUG] Audio pts:          %li\n", audio_pts);
               printf("[DEBUG] Audio pts delta:    %li\n", audio_pts - last_pts1);
               last_pts1 = audio_pts;

               frame->pts = audio_pts;

               if (avcodec_fill_audio_frame(frame, audiopacket_channel_count, audio_stream->codec->sample_fmt, (const uint8_t *)audiopacket_data, audiopacket_size, 0) < 0)
               {
                   printf("[ERROR] Filling audioframe failed!\n");
                   exit(-1);
               }

               got_packet = 0;
               if (avcodec_encode_audio2(audio_stream->codec, &pkt, frame, &got_packet) != 0)
               {
                   printf("[ERROR] Encoding audio failed\n");
               }

               if (got_packet)
               {
                   pkt.stream_index = audio_stream->index;
                   pkt.flags       |= AV_PKT_FLAG_KEY;

                   //printf("[PACKET] size:              %d\n", pkt.size);
                   //printf("[PACKET] pts:               %li\n", pkt.pts);
                   //printf("[PACKET] pts delta:         %li\n", pkt.pts - last_pts2);
                   //printf("[PACKET] duration:          %d\n", pkt.duration);
                   //printf("[PACKET] timebase codec:    %d/%d\n", audio_stream->codec->time_base.num, audio_stream->codec->time_base.den);
                   //printf("[PACKET] timebase stream:   %d/%d\n", audio_stream->time_base.num, audio_stream->time_base.den);
                   last_pts2 = pkt.pts;

                   av_interleaved_write_frame(output_fmt_ctx, &pkt);
               }
               av_frame_free(&frame);
           }

           av_free_packet(&pkt);
       }
       else
       {
           printf("[WARNING] No audiopacket received!\n");
       }

       static int count = 0;
       count++;
    }
  • FFmpeg - downmixing FLAC 6.1 to AAC 5.1

    7 juillet 2014, par Martijn

    I can’t seem to figure out how to do this. I’ve been staring at these commands :
    https://trac.ffmpeg.org/wiki/AudioChannelManipulation

    But to no avail. It’s a tad above my level, sadly. Here’s the ffmpeg -i output for the video in question :

    ffmpeg version N-64012-g61df081 Copyright (c) 2000-2014 the FFmpeg developers
     built on Jun 16 2014 22:01:59 with gcc 4.8.3 (GCC)
     configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex--enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
     libavutil      52. 89.100 / 52. 89.100
     libavcodec     55. 67.100 / 55. 67.100
     libavformat    55. 43.100 / 55. 43.100
     libavdevice    55. 13.101 / 55. 13.101
     libavfilter     4.  8.100 /  4.  8.100
     libswscale      2.  6.100 /  2.  6.100
     libswresample   0. 19.100 /  0. 19.100
     libpostproc    52.  3.100 / 52.  3.100
    Input #0, matroska,webm, from '[Coalgirls]_Spirited_Away_(1920x1038_Blu-ray_FLAC)_[92372194].mkv':
     Metadata:
       title           : Spirited Away
       encoder         : libebml v1.3.0 + libmatroska v1.4.0
       creation_time   : 2014-07-03 01:32:13
     Duration: 02:04:32.29, start: 0.000000, bitrate: 15972 kb/s
       Chapter #0.0: start 0.000000, end 99.099000
       Metadata:
         title           : 00:00:00.000
       Chapter #0.1: start 99.099000, end 196.238000
       Metadata:
         title           : 00:01:39.099
       Chapter #0.2: start 196.238000, end 443.526000
       Metadata:
         title           : 00:03:16.238
       Chapter #0.3: start 443.526000, end 645.395000
       Metadata:
         title           : 00:07:23.526
       Chapter #0.4: start 645.395000, end 1023.022000
       Metadata:
         title           : 00:10:45.395
       Chapter #0.5: start 1023.022000, end 1368.534000
       Metadata:
         title           : 00:17:03.022
       Chapter #0.6: start 1368.534000, end 1716.048000
       Metadata:
         title           : 00:22:48.534
       Chapter #0.7: start 1716.048000, end 2008.173000
       Metadata:
         title           : 00:28:36.048
       Chapter #0.8: start 2008.173000, end 2301.674000
       Metadata:
         title           : 00:33:28.173
       Chapter #0.9: start 2301.674000, end 2651.816000
       Metadata:
         title           : 00:38:21.674
       Chapter #0.10: start 2651.816000, end 2906.821000
       Metadata:
         title           : 00:44:11.816
       Chapter #0.11: start 2906.821000, end 3271.351000
       Metadata:
         title           : 00:48:26.821
       Chapter #0.12: start 3271.351000, end 3729.017000
       Metadata:
         title           : 00:54:31.351
       Chapter #0.13: start 3729.017000, end 4091.587000
       Metadata:
         title           : 01:02:09.017
       Chapter #0.14: start 4091.587000, end 4476.847000
       Metadata:
         title           : 01:08:11.587
       Chapter #0.15: start 4476.847000, end 4750.579000
       Metadata:
         title           : 01:14:36.847
       Chapter #0.16: start 4750.579000, end 5139.760000
       Metadata:
         title           : 01:19:10.579
       Chapter #0.17: start 5139.760000, end 5478.890000
       Metadata:
         title           : 01:25:39.760
       Chapter #0.18: start 5478.890000, end 5853.806000
       Metadata:
         title           : 01:31:18.890
       Chapter #0.19: start 5853.806000, end 6318.937000
       Metadata:
         title           : 01:37:33.806
       Chapter #0.20: start 6318.937000, end 6625.118000
       Metadata:
         title           : 01:45:18.937
       Chapter #0.21: start 6625.118000, end 6771.098000
       Metadata:
         title           : 01:50:25.118
       Chapter #0.22: start 6771.098000, end 6914.199000
       Metadata:
         title           : 01:52:51.098
       Chapter #0.23: start 6914.199000, end 7253.580000
       Metadata:
         title           : 01:55:14.199
       Chapter #0.24: start 7253.580000, end 7472.288000
       Metadata:
         title           : 02:00:53.580
       Stream #0:0: Video: h264 (High 10), yuv420p10le(tv, bt709), 1920x1038, SAR 1:1 DAR 320:173, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
       Metadata:
         title           : Spirited Away
       Stream #0:1(jpn): Audio: flac, 48000 Hz, 6.1, s32 (default)
       Metadata:
         title           : 6.1 FLAC
       Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
       Metadata:
         title           : 5.1 AC3
       Stream #0:3(fre): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
       Metadata:
         title           : 5.1 AC3
       Stream #0:4(ger): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
       Metadata:
         title           : 5.1 AC3
       Stream #0:5(fin): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
       Metadata:
         title           : 2.0 AC3
       Stream #0:6(kor): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
       Metadata:
         title           : 5.1 AC3
       Stream #0:7(chi): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
       Metadata:
         title           : 5.1 AC3
       Stream #0:8(chi): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
       Metadata:
         title           : 5.1 AC3
       Stream #0:9(eng): Subtitle: ssa (default)
       Metadata:
         title           : English
       Stream #0:10(fre): Subtitle: ssa
       Metadata:
         title           : French
       Stream #0:11(ger): Subtitle: ssa
       Metadata:
         title           : German
       Stream #0:12(eng): Subtitle: ssa
       Metadata:
         title           : Songs + Signs
       Stream #0:13: Attachment: ttf
       Metadata:
         filename        : MyriadPro-Regular.otf
         mimetype        : application/x-truetype-font
       Stream #0:14: Attachment: ttf
       Metadata:
         filename        : MyriadPro-SemiboldIt.otf
         mimetype        : application/x-truetype-font
       Stream #0:15: Attachment: ttf
       Metadata:
         filename        : Vesta-Bold.otf
         mimetype        : application/x-truetype-font
       Stream #0:16: Attachment: ttf
       Metadata:
         filename        : Vesta-Bold_2.otf
         mimetype        : application/x-truetype-font
       Stream #0:17: Attachment: ttf
       Metadata:
         filename        : AR CENA_0.TTF
         mimetype        : application/x-truetype-font
       Stream #0:18: Attachment: ttf
       Metadata:
         filename        : tahomabd.ttf
         mimetype        : application/x-truetype-font
       Stream #0:19: Attachment: ttf
       Metadata:
         filename        : palai.ttf
         mimetype        : application/x-truetype-font
       Stream #0:20: Attachment: ttf
       Metadata:
         filename        : pala.ttf
         mimetype        : application/x-truetype-font

    As you can see, one of the streams is a FLAC 6.1 stream. I wanted to convert that to AAC, and I know how to do that, basically like this :

    ffmpeg -i "input.mkv" -codec:v copy -codec:a aac -strict -2 -b:a 320k -f matroska "output.mkv"

    But apparently AAC doesn’t support 6.1 audio :

    ...
    [aac @ 03b26860] Unsupported number of channels: 7
    Output #0, matroska, to 'd:\Movies\[Coalgirls]_Spirited_Away_(1920x1038_Blu-ray_FLAC)_[92372194].aac.mkv':
       Stream #0:0(jpn): Video: h264, yuv420p10le, 1920x1038 [SAR 1:1 DAR 320:173], q=2-31, 23.98 fps, 90k tbn, 1k tbc (default)
       Stream #0:1(jpn): Audio: aac, 0 channels, 128 kb/s (default)
       Metadata:
         encoder         : Lavc55.67.100 aac
       Stream #0:2(eng): Subtitle: ssa, 128 kb/s (default)
       Metadata:
         encoder         : Lavc55.67.100 ssa
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (flac (native) -> aac (aac))
     Stream #0:9 -> #0:2 (ssa (native) -> ssa (native))
    Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height

    That’s fine, so I wanted to downmix it to 5.1 and encode as AAC. But I can’t seem to work out how to. Any advice ?

  • FFMPEG creates incorrect Source duration

    4 août 2016, par Byron Whitlock

    When transcoding movies from an AVI to mp4 sometimes FFMPEG sets the "Source Duration" incorrectly.

    This messes up playback on IOS devices. Specifically, it causes the video to cut out at "Source duration" while the audio still plays.

    enter image description here

    FFMPEG output transcode doesn’t’ show anything odd at all. Looks normal, no errors or warnings.

    • Can I force FFMPEG to never add the "Source Duration" metadata ?
    • How do I edit the track metadata shown by mediainfo ? I tried Mp4box, and a few others, but I can’t seem to figure out how to edit track level metadata.

    Thanks.

    Log is below.

    ffmpeg version N-77455-g4707497 Copyright (c) 2000-2015 the FFmpeg developers   built with gcc 5.2.0 (GCC)   configuration: --enable-gpl
       --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib   libavutil      55. 11.100 / 55. 11.100   libavcodec     57. 20.100 / 57. 20.100   libavformat    57. 20.100 / 57. 20.100   libavdevice    57.  0.100 / 57.  0.100   libavfilter     6. 21.101 /
       6. 21.101   libswscale      4.  0.100 /  4.  0.100   libswresample   2.  0.101 /  2.  0.101   libpostproc    54.  0.100 / 54.  0.100 Input #0, avi, from 'E:\MEDIA\Central.Intelligence.2016.HC.HDRip.XviD.AC3-EVO\Central.Intelligence.2016.HC.HDRip.XviD.AC3-EVO.avi': Metadata:
           encoder         : VirtualDubMod 1.5.10.2 (build 2542/release)   Duration: 01:51:43.27, start: 0.000000, bitrate: 1765 kb/s
           Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 720x304 [SAR 1:1 DAR 45:19], 1563 kb/s, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
           Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s [libx264 @ 000000f3c80a0a80] using SAR=405/304 [libx264 @ 000000f3c80a0a80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2 [libx264 @ 000000f3c80a0a80] profile High, level 3.1 [libx264 @ 000000f3c80a0a80] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=1280 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'F:\STREAMS\Central.Intelligence.2016.HC.HDRip.XviD.AC3-EVO.avi.1280x720_1000kbps.TEMP.mp4': Metadata:
           encoder         : Lavf57.20.100
           Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 405:304 DAR 45:19], q=-1--1, 1280 kb/s, 23.98 fps, 10000k tbn, 23.98 tbc
           Metadata:
             encoder         : Lavc57.20.100 libx264
           Side data:
             unknown side data type 10 (24 bytes)
           Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 160 kb/s
           Metadata:
             encoder         : Lavc57.20.100 aac Stream mapping:   Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))   Stream #0:1 -> #0:1 (ac3 (native) -> aac (native)) Press [q] to stop, [?] for help [mpeg4 @ 000000f3c80ae220] Video uses a non-standard and wasteful way to store B-frames ('packed B-frames'). Consider using the mpeg4_unpack_bframes bitstream filter without encoding but stream copy to fix it.
    frame=   15 fps=0.0 q=0.0 size=       0kB time=00:00:01.18 bitrate=   0.3kbits/s dup=1 drop=0 speed=2.36x  
    --SNIP---
    frame=160704 fps= 16 q=30.0 size= 1180376kB time=01:51:43.08 bitrate=1442.6kbits/s dup=1 drop=0 speed=0.671x    
    [libx264 @ 0000001f60c5d900] frame I:1167  Avg QP:19.08  size: 44465
    [libx264 @ 0000001f60c5d900] frame P:63049 Avg QP:22.26  size: 12774
    [libx264 @ 0000001f60c5d900] frame B:110691 Avg QP:24.81  size:  2739
    [libx264 @ 0000001f60c5d900] consecutive B-frames:  6.0% 22.8% 18.3% 53.0%
    [libx264 @ 0000001f60c5d900] mb I  I16..4: 14.0% 76.1%  9.9%
    [libx264 @ 0000001f60c5d900] mb P  I16..4:  2.5%  6.6%  0.4%  P16..4: 44.5% 10.8%  5.2%  0.0%  0.0%    skip:30.0%
    [libx264 @ 0000001f60c5d900] mb B  I16..4:  0.1%  0.3%  0.0%  B16..8: 32.1%  1.6%  0.2%  direct: 0.9%  skip:64.9%  L0:37.9% L1:58.7% BI: 3.5%
    [libx264 @ 0000001f60c5d900] final ratefactor: 23.25
    [libx264 @ 0000001f60c5d900] 8x8 transform intra:70.8% inter:85.8%
    [libx264 @ 0000001f60c5d900] coded y,uvDC,uvAC intra: 47.1% 56.6% 19.5% inter: 10.7% 14.2% 0.4%
    [libx264 @ 0000001f60c5d900] i16 v,h,dc,p: 46% 20%  8% 26%
    [libx264 @ 0000001f60c5d900] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 17% 25%  5%  7%  7%  7%  6%  6%
    [libx264 @ 0000001f60c5d900] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 20% 12%  5% 10%  9%  8%  5%  4%
    [libx264 @ 0000001f60c5d900] i8c dc,h,v,p: 58% 18% 18%  6%
    [libx264 @ 0000001f60c5d900] Weighted P-Frames: Y:1.4% UV:0.8%
    [libx264 @ 0000001f60c5d900] ref P L0: 62.6% 12.9% 18.9%  5.6%  0.1%
    [libx264 @ 0000001f60c5d900] ref B L0: 87.6% 11.0%  1.4%
    [libx264 @ 0000001f60c5d900] ref B L1: 94.6%  5.4%
    [libx264 @ 0000001f60c5d900] kb/s:1272.59
    [aac @ 0000001f60b52180] Qavg: 954.859

    Edit

    This has something to do with data, when I run this command (cut at 10 minutes)

    ffmpeg.exe -i CI.mp4 -ss 00:00:00 -t 00:08:00 -vcodec copy  -map_metadata 0 -acodec copy CI2.mp4

    Mediainfo shows

    Duration                    : 9mn 49s
    Source duration             : 2mn 40s

    When I run this one (18 minutes)

    ffmpeg.exe -i CI.mp4 -ss 00:00:00 -t 00:18:00 -vcodec copy  -map_metadata 0 -acodec copy CI2.mp4

    Mediainfo shows

    Duration                    : 17mn 49s
    Source duration             : 3mn 30s

    How can I edit the metadata directly