[FFmpeg-trac] #6630(undetermined:new): Using stream segmenter produces .ts file with non-zero start time

FFmpeg trac at avcodec.org
Thu Aug 31 20:14:30 EEST 2017


#6630: Using stream segmenter produces .ts file with non-zero start time
-------------------------------------+-------------------------------------
             Reporter:               |                     Type:  defect
  casey.bateman                      |                 Priority:  normal
               Status:  new          |                  Version:
            Component:               |  unspecified
  undetermined                       |               Blocked By:
             Keywords:               |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 I am trying to adjust the timestamps of a collection of mpegts files. The
 timestamps of these files seem to be all offset by some arbitrary number
 1.466667s - 1.485333s.

 The HLS stream that I am generating contains 3 separate qualities. A
 1280x720, and 852x480 version. Each of the segments for these qualities
 come in individually with identical timestamps. I rewrite the timestamps
 by running them through the stream segmenter and specifying
 `-initial_offset`. I do this because the timestamps are not always
 continuous between segments as I receive them.

 pre stream segmenter 1280x720 segment ffprobe output
 {{{
 ffprobe version N-85091-g23ae3cc Copyright (c) 2007-2017 the FFmpeg
 developers
   built with gcc 6.3.0 (GCC)
   configuration: --enable-gpl --enable-version3 --enable-cuda --enable-
 cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc
 --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
 --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
 --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
 --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy
 --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
 --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-
 libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
 libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma
 --enable-zlib
   libavutil      55. 57.100 / 55. 57.100
   libavcodec     57. 88.100 / 57. 88.100
   libavformat    57. 70.100 / 57. 70.100
   libavdevice    57.  5.100 / 57.  5.100
   libavfilter     6. 81.100 /  6. 81.100
   libswscale      4.  5.100 /  4.  5.100
   libswresample   2.  6.100 /  2.  6.100
   libpostproc    54.  4.100 / 54.  4.100
 {
 Input #0, mpegts, from '.\input_1280x720_002.ts':
   Duration: 00:00:04.05, start: 5.413333, bitrate: 3434 kb/s
   Program 1
     Metadata:
       service_name    : Service01
       service_provider: FFmpeg
     Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
 yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k
 tbn, 60 tbc
     Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000
 Hz, stereo, fltp, 128 kb/s
     "streams": [
         {
             "index": 0,
             "codec_name": "h264",
             "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part
 10",
             "profile": "Main",
             "codec_type": "video",
             "codec_time_base": "1/60",
             "codec_tag_string": "[27][0][0][0]",
             "codec_tag": "0x001b",
             "width": 1280,
             "height": 720,
             "coded_width": 1280,
             "coded_height": 720,
             "has_b_frames": 2,
             "sample_aspect_ratio": "1:1",
             "display_aspect_ratio": "16:9",
             "pix_fmt": "yuv420p",
             "level": 31,
             "chroma_location": "left",
             "field_order": "progressive",
             "refs": 1,
             "is_avc": "false",
             "nal_length_size": "0",
             "id": "0x100",
             "r_frame_rate": "30/1",
             "avg_frame_rate": "30/1",
             "time_base": "1/90000",
             "start_pts": 492000,
             "start_time": "5.466667",
             "duration_ts": 360000,
             "duration": "4.000000",
             "bits_per_raw_sample": "8",
             "disposition": {
                 "default": 0,
                 "dub": 0,
                 "original": 0,
                 "comment": 0,
                 "lyrics": 0,
                 "karaoke": 0,
                 "forced": 0,
                 "hearing_impaired": 0,
                 "visual_impaired": 0,
                 "clean_effects": 0,
                 "attached_pic": 0,
                 "timed_thumbnails": 0
             }
         },
         {
             "index": 1,
             "codec_name": "aac",
             "codec_long_name": "AAC (Advanced Audio Coding)",
             "profile": "LC",
             "codec_type": "audio",
             "codec_time_base": "1/48000",
             "codec_tag_string": "[15][0][0][0]",
             "codec_tag": "0x000f",
             "sample_fmt": "fltp",
             "sample_rate": "48000",
             "channels": 2,
             "channel_layout": "stereo",
             "bits_per_sample": 0,
             "id": "0x101",
             "r_frame_rate": "0/0",
             "avg_frame_rate": "0/0",
             "time_base": "1/90000",
             "start_pts": 487200,
             "start_time": "5.413333",
             "duration_ts": 355200,
             "duration": "3.946667",
             "bit_rate": "128250",
             "disposition": {
                 "default": 0,
                 "dub": 0,
                 "original": 0,
                 "comment": 0,
                 "lyrics": 0,
                 "karaoke": 0,
                 "forced": 0,
                 "hearing_impaired": 0,
                 "visual_impaired": 0,
                 "clean_effects": 0,
                 "attached_pic": 0,
                 "timed_thumbnails": 0
             }
         }
     ]
 }}}

 pre stream segmenter 852x480 segment ffprobe output
 {{{
 ffprobe version N-85091-g23ae3cc Copyright (c) 2007-2017 the FFmpeg
 developers
   built with gcc 6.3.0 (GCC)
   configuration: --enable-gpl --enable-version3 --enable-cuda --enable-
 cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc
 --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
 --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
 --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
 --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy
 --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
 --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-
 libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
 libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma
 --enable-zlib
   libavutil      55. 57.100 / 55. 57.100
   libavcodec     57. 88.100 / 57. 88.100
   libavformat    57. 70.100 / 57. 70.100
   libavdevice    57.  5.100 / 57.  5.100
   libavfilter     6. 81.100 /  6. 81.100
   libswscale      4.  5.100 /  4.  5.100
   libswresample   2.  6.100 /  2.  6.100
   libpostproc    54.  4.100 / 54.  4.100
 {
 Input #0, mpegts, from '.\input_852x480_002.ts':
   Duration: 00:00:04.10, start: 5.370667, bitrate: 783 kb/s
   Program 1
     Metadata:
       service_name    : Service01
       service_provider: FFmpeg
     Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0]
 / 0x001B), yuv420p(progressive), 632x356 [SAR 1:1 DAR 158:89], 30 fps, 30
 tbr, 90k tbn, 60 tbc
     Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000
 Hz, stereo, fltp, 64 kb/s
     "streams": [
         {
             "index": 0,
             "codec_name": "h264",
             "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part
 10",
             "profile": "Constrained Baseline",
             "codec_type": "video",
             "codec_time_base": "1/60",
             "codec_tag_string": "[27][0][0][0]",
             "codec_tag": "0x001b",
             "width": 632,
             "height": 356,
             "coded_width": 632,
             "coded_height": 356,
             "has_b_frames": 0,
             "sample_aspect_ratio": "1:1",
             "display_aspect_ratio": "158:89",
             "pix_fmt": "yuv420p",
             "level": 31,
             "chroma_location": "left",
             "field_order": "progressive",
             "refs": 1,
             "is_avc": "false",
             "nal_length_size": "0",
             "id": "0x100",
             "r_frame_rate": "30/1",
             "avg_frame_rate": "30/1",
             "time_base": "1/90000",
             "start_pts": 492000,
             "start_time": "5.466667",
             "duration_ts": 360000,
             "duration": "4.000000",
             "bits_per_raw_sample": "8",
             "disposition": {
                 "default": 0,
                 "dub": 0,
                 "original": 0,
                 "comment": 0,
                 "lyrics": 0,
                 "karaoke": 0,
                 "forced": 0,
                 "hearing_impaired": 0,
                 "visual_impaired": 0,
                 "clean_effects": 0,
                 "attached_pic": 0,
                 "timed_thumbnails": 0
             }
         },
         {
             "index": 1,
             "codec_name": "aac",
             "codec_long_name": "AAC (Advanced Audio Coding)",
             "profile": "LC",
             "codec_type": "audio",
             "codec_time_base": "1/48000",
             "codec_tag_string": "[15][0][0][0]",
             "codec_tag": "0x000f",
             "sample_fmt": "fltp",
             "sample_rate": "48000",
             "channels": 2,
             "channel_layout": "stereo",
             "bits_per_sample": 0,
             "id": "0x101",
             "r_frame_rate": "0/0",
             "avg_frame_rate": "0/0",
             "time_base": "1/90000",
             "start_pts": 483360,
             "start_time": "5.370667",
             "duration_ts": 345600,
             "duration": "3.840000",
             "bit_rate": "64500",
             "disposition": {
                 "default": 0,
                 "dub": 0,
                 "original": 0,
                 "comment": 0,
                 "lyrics": 0,
                 "karaoke": 0,
                 "forced": 0,
                 "hearing_impaired": 0,
                 "visual_impaired": 0,
                 "clean_effects": 0,
                 "attached_pic": 0,
                 "timed_thumbnails": 0
             }
         }
     ]
 }
 }}}


 post stream segmenter 1280x720 segment ffprobe output
 {{{
 ffprobe version N-85091-g23ae3cc Copyright (c) 2007-2017 the FFmpeg
 developers
   built with gcc 6.3.0 (GCC)
   configuration: --enable-gpl --enable-version3 --enable-cuda --enable-
 cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc
 --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
 --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
 --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
 --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy
 --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
 --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-
 libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
 libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma
 --enable-zlib
   libavutil      55. 57.100 / 55. 57.100
   libavcodec     57. 88.100 / 57. 88.100
   libavformat    57. 70.100 / 57. 70.100
   libavdevice    57.  5.100 / 57.  5.100
   libavfilter     6. 81.100 /  6. 81.100
   libswscale      4.  5.100 /  4.  5.100
   libswresample   2.  6.100 /  2.  6.100
   libpostproc    54.  4.100 / 54.  4.100
 {
 Input #0, mpegts, from '.\output_1280x720_002.ts':
   Duration: 00:00:04.10, start: 5.400000, bitrate: 1113 kb/s
   Program 1
     Metadata:
       service_name    : Service01
       service_provider: FFmpeg
     Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
 yuv420p(progressive), 852x480 [SAR 1:1 DAR 71:40], 30 fps, 30 tbr, 90k
 tbn, 60 tbc
     Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000
 Hz, stereo, fltp, 64 kb/s
     "streams": [
         {
             "index": 0,
             "codec_name": "h264",
             "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part
 10",
             "profile": "Main",
             "codec_type": "video",
             "codec_time_base": "1/60",
             "codec_tag_string": "[27][0][0][0]",
             "codec_tag": "0x001b",
             "width": 852,
             "height": 480,
             "coded_width": 852,
             "coded_height": 480,
             "has_b_frames": 2,
             "sample_aspect_ratio": "1:1",
             "display_aspect_ratio": "71:40",
             "pix_fmt": "yuv420p",
             "level": 31,
             "chroma_location": "left",
             "field_order": "progressive",
             "refs": 1,
             "is_avc": "false",
             "nal_length_size": "0",
             "id": "0x100",
             "r_frame_rate": "30/1",
             "avg_frame_rate": "30/1",
             "time_base": "1/90000",
             "start_pts": 494640,
             "start_time": "5.496000",
             "duration_ts": 360000,
             "duration": "4.000000",
             "bits_per_raw_sample": "8",
             "disposition": {
                 "default": 0,
                 "dub": 0,
                 "original": 0,
                 "comment": 0,
                 "lyrics": 0,
                 "karaoke": 0,
                 "forced": 0,
                 "hearing_impaired": 0,
                 "visual_impaired": 0,
                 "clean_effects": 0,
                 "attached_pic": 0,
                 "timed_thumbnails": 0
             }
         },
         {
             "index": 1,
             "codec_name": "aac",
             "codec_long_name": "AAC (Advanced Audio Coding)",
             "profile": "LC",
             "codec_type": "audio",
             "codec_time_base": "1/48000",
             "codec_tag_string": "[15][0][0][0]",
             "codec_tag": "0x000f",
             "sample_fmt": "fltp",
             "sample_rate": "48000",
             "channels": 2,
             "channel_layout": "stereo",
             "bits_per_sample": 0,
             "id": "0x101",
             "r_frame_rate": "0/0",
             "avg_frame_rate": "0/0",
             "time_base": "1/90000",
             "start_pts": 486000,
             "start_time": "5.400000",
             "duration_ts": 362880,
             "duration": "4.032000",
             "bit_rate": "64500",
             "disposition": {
                 "default": 0,
                 "dub": 0,
                 "original": 0,
                 "comment": 0,
                 "lyrics": 0,
                 "karaoke": 0,
                 "forced": 0,
                 "hearing_impaired": 0,
                 "visual_impaired": 0,
                 "clean_effects": 0,
                 "attached_pic": 0,
                 "timed_thumbnails": 0
             }
         }
     ]
 }
 }}}


 post stream segmenter 852x480 segment ffprobe output
 {{{
 ffprobe version N-85091-g23ae3cc Copyright (c) 2007-2017 the FFmpeg
 developers
   built with gcc 6.3.0 (GCC)
   configuration: --enable-gpl --enable-version3 --enable-cuda --enable-
 cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc
 --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
 --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
 --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
 --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy
 --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
 --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-
 libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
 libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma
 --enable-zlib
   libavutil      55. 57.100 / 55. 57.100
   libavcodec     57. 88.100 / 57. 88.100
   libavformat    57. 70.100 / 57. 70.100
   libavdevice    57.  5.100 / 57.  5.100
   libavfilter     6. 81.100 /  6. 81.100
   libswscale      4.  5.100 /  4.  5.100
   libswresample   2.  6.100 /  2.  6.100
   libpostproc    54.  4.100 / 54.  4.100
 {
 Input #0, mpegts, from '.\output_852x480_002.ts':
   Duration: 00:00:04.10, start: 5.400000, bitrate: 1113 kb/s
   Program 1
     Metadata:
       service_name    : Service01
       service_provider: FFmpeg
     Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
 yuv420p(progressive), 852x480 [SAR 1:1 DAR 71:40], 30 fps, 30 tbr, 90k
 tbn, 60 tbc
     Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000
 Hz, stereo, fltp, 64 kb/s
     "streams": [
         {
             "index": 0,
             "codec_name": "h264",
             "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part
 10",
             "profile": "Main",
             "codec_type": "video",
             "codec_time_base": "1/60",
             "codec_tag_string": "[27][0][0][0]",
             "codec_tag": "0x001b",
             "width": 852,
             "height": 480,
             "coded_width": 852,
             "coded_height": 480,
             "has_b_frames": 2,
             "sample_aspect_ratio": "1:1",
             "display_aspect_ratio": "71:40",
             "pix_fmt": "yuv420p",
             "level": 31,
             "chroma_location": "left",
             "field_order": "progressive",
             "refs": 1,
             "is_avc": "false",
             "nal_length_size": "0",
             "id": "0x100",
             "r_frame_rate": "30/1",
             "avg_frame_rate": "30/1",
             "time_base": "1/90000",
             "start_pts": 494640,
             "start_time": "5.496000",
             "duration_ts": 360000,
             "duration": "4.000000",
             "bits_per_raw_sample": "8",
             "disposition": {
                 "default": 0,
                 "dub": 0,
                 "original": 0,
                 "comment": 0,
                 "lyrics": 0,
                 "karaoke": 0,
                 "forced": 0,
                 "hearing_impaired": 0,
                 "visual_impaired": 0,
                 "clean_effects": 0,
                 "attached_pic": 0,
                 "timed_thumbnails": 0
             }
         },
         {
             "index": 1,
             "codec_name": "aac",
             "codec_long_name": "AAC (Advanced Audio Coding)",
             "profile": "LC",
             "codec_type": "audio",
             "codec_time_base": "1/48000",
             "codec_tag_string": "[15][0][0][0]",
             "codec_tag": "0x000f",
             "sample_fmt": "fltp",
             "sample_rate": "48000",
             "channels": 2,
             "channel_layout": "stereo",
             "bits_per_sample": 0,
             "id": "0x101",
             "r_frame_rate": "0/0",
             "avg_frame_rate": "0/0",
             "time_base": "1/90000",
             "start_pts": 486000,
             "start_time": "5.400000",
             "duration_ts": 362880,
             "duration": "4.032000",
             "bit_rate": "64500",
             "disposition": {
                 "default": 0,
                 "dub": 0,
                 "original": 0,
                 "comment": 0,
                 "lyrics": 0,
                 "karaoke": 0,
                 "forced": 0,
                 "hearing_impaired": 0,
                 "visual_impaired": 0,
                 "clean_effects": 0,
                 "attached_pic": 0,
                 "timed_thumbnails": 0
             }
         }
     ]
 }
 }}}


 That difference in start time is enough to cause errors in a multi-quality
 HLS stream.

 Command for 1280x720 segment:
 {{{
 % ffmpeg -i .\input_1280x720_002.ts -f segment -y -c copy -segment_time 5
 -reset_timestamps 1 -initial_offset 4 -segment_start_number 1
 -mpegts_copyts 1 -segment_format mpegts -loglevel verbose
 .\output_1280x720_%03d.ts
 mpegts .\output_1280x720_%04d.ts
 ffmpeg version N-85091-g23ae3cc Copyright (c) 2000-2017 the FFmpeg
 developers
   built with gcc 6.3.0 (GCC)
   configuration: --enable-gpl --enable-version3 --enable-cuda --enable-
 cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc
 --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
 --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
 --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
 --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy
 --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
 --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-
 libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
 libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma
 --enable-zlib
   libavutil      55. 57.100 / 55. 57.100
   libavcodec     57. 88.100 / 57. 88.100
   libavformat    57. 70.100 / 57. 70.100
   libavdevice    57.  5.100 / 57.  5.100
   libavfilter     6. 81.100 /  6. 81.100
   libswscale      4.  5.100 /  4.  5.100
   libswresample   2.  6.100 /  2.  6.100
   libpostproc    54.  4.100 / 54.  4.100
 [h264 @ 00000000025387e0] Reinit context to 1280x720, pix_fmt: yuv420p
 Input #0, mpegts, from '.\source_0af6_3000_000_000_0001.ts':
   Duration: 00:00:04.05, start: 5.413333, bitrate: 3434 kb/s
   Program 1
     Metadata:
       service_name    : Service01
       service_provider: FFmpeg
     Stream #0:0[0x100]: Video: h264 (Main), 1 reference frame
 ([27][0][0][0] / 0x001B), yuv420p(progressive, left), 1280x720 [SAR 1:1
 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
     Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000
 Hz, stereo, fltp, 128 kb/s
 [segment @ 0000000002ce75a0] NOTE: the option initial_offset is
 deprecated,you can use output_ts_offset instead of it
 [segment @ 0000000002ce75a0] Selected stream id:0 type:video
 [mpegts @ 0000000002c30960] muxrate VBR, pcr every 3 pkts, sdt every 200,
 pat/pmt every 40 pkts
 Output #0, segment, to '.\out_3000_%04d.ts':
   Metadata:
     encoder         : Lavf57.70.100
     Stream #0:0: Video: h264 (Main), 1 reference frame ([27][0][0][0] /
 0x001B), yuv420p(progressive, left), 1280x720 (0x0) [SAR 1:1 DAR 16:9],
 q=2-31, 30 fps, 30 tbr, 90k tbn, 30 tbc
     Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz,
 stereo, fltp, 128 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #0:1 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 [NULL @ 00000000025387e0] Ignoring NAL type 9 in extradata
 [segment @ 0000000002ce75a0] segment:'.\out_3000_0001.ts' starts with
 packet stream:0 pts:6000 pts_time:0.0666667 frame:0
 No more output streams to write to, finishing.
 [segment @ 0000000002ce75a0] segment:'.\out_3000_0001.ts' count:0 ended
 frame=  120 fps=0.0 q=-1.0 Lsize=N/A time=00:00:03.96 bitrate=N/A speed=
 331x
 video:1498kB audio:62kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: unknown
 Input file #0 (.\source_0af6_3000_000_000_0001.ts):
   Input stream #0:0 (video): 120 packets read (1534371 bytes);
   Input stream #0:1 (audio): 187 packets read (63905 bytes);
   Total: 307 packets (1598276 bytes) demuxed
 Output file #0 (.\out_3000_%04d.ts):
   Output stream #0:0 (video): 120 packets muxed (1534371 bytes);
   Output stream #0:1 (audio): 187 packets muxed (63905 bytes);
   Total: 307 packets (1598276 bytes) muxed
 }}}

 Command for 852x480 segment:
 {{{
 % ffmpeg -i .\input_852x480_002.ts -f segment -y -c copy -segment_time 5
 -reset_timestamps 1 -initial_offset 4 -segment_start_number 1
 -mpegts_copyts 1 -segment_format mpegts -loglevel verbose
 .\output_852x480_%03d.ts
 ffmpeg version N-85091-g23ae3cc Copyright (c) 2000-2017 the FFmpeg
 developers
   built with gcc 6.3.0 (GCC)
   configuration: --enable-gpl --enable-version3 --enable-cuda --enable-
 cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc
 --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
 --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
 --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
 --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264
 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy
 --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
 --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-
 libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
 libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma
 --enable-zlib
   libavutil      55. 57.100 / 55. 57.100
   libavcodec     57. 88.100 / 57. 88.100
   libavformat    57. 70.100 / 57. 70.100
   libavdevice    57.  5.100 / 57.  5.100
   libavfilter     6. 81.100 /  6. 81.100
   libswscale      4.  5.100 /  4.  5.100
   libswresample   2.  6.100 /  2.  6.100
   libpostproc    54.  4.100 / 54.  4.100
 [h264 @ 00000000026b87e0] Reinit context to 864x480, pix_fmt: yuv420p
 Input #0, mpegts, from '.\source_0af6_1100_000_000_0001.ts':
   Duration: 00:00:04.10, start: 5.370667, bitrate: 1113 kb/s
   Program 1
     Metadata:
       service_name    : Service01
       service_provider: FFmpeg
     Stream #0:0[0x100]: Video: h264 (Main), 1 reference frame
 ([27][0][0][0] / 0x001B), yuv420p(progressive, left), 852x480 (864x480)
 [SAR 1:1 DAR 71:40], 30 fps, 30 tbr, 90k tbn, 60 tbc
     Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000
 Hz, stereo, fltp, 64 kb/s
 [segment @ 00000000027a6a60] NOTE: the option initial_offset is
 deprecated,you can use output_ts_offset instead of it
 [segment @ 00000000027a6a60] Selected stream id:0 type:video
 [mpegts @ 000000000072d960] muxrate VBR, pcr every 3 pkts, sdt every 200,
 pat/pmt every 40 pkts
 Output #0, segment, to '.\out_3000_%04d.ts':
   Metadata:
     encoder         : Lavf57.70.100
     Stream #0:0: Video: h264 (Main), 1 reference frame ([27][0][0][0] /
 0x001B), yuv420p(progressive, left), 852x480 (0x0) [SAR 1:1 DAR 71:40],
 q=2-31, 30 fps, 30 tbr, 90k tbn, 30 tbc
     Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz,
 stereo, fltp, 64 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #0:1 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 [NULL @ 00000000026b87e0] Ignoring NAL type 9 in extradata
 [segment @ 00000000027a6a60] segment:'.\out_3000_0001.ts' starts with
 packet stream:1 pts:0 pts_time:0 frame:0
 [segment @ 00000000027a6a60] segment:'.\out_3000_0001.ts' starts with
 packet stream:1 pts:1920 pts_time:0.0213333 frame:0
 [segment @ 00000000027a6a60] segment:'.\out_3000_0001.ts' starts with
 packet stream:0 pts:8640 pts_time:0.096 frame:0
 No more output streams to write to, finishing.
 [segment @ 00000000027a6a60] segment:'.\out_3000_0001.ts' count:0 ended
 frame=  120 fps=0.0 q=-1.0 Lsize=N/A time=00:00:04.01 bitrate=N/A speed=
 286x
 video:469kB audio:32kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: unknown
 Input file #0 (.\source_0af6_1100_000_000_0001.ts):
   Input stream #0:0 (video): 120 packets read (480463 bytes);
   Input stream #0:1 (audio): 189 packets read (33158 bytes);
   Total: 309 packets (513621 bytes) demuxed
 Output file #0 (.\out_3000_%04d.ts):
   Output stream #0:0 (video): 120 packets muxed (480463 bytes);
   Output stream #0:1 (audio): 189 packets muxed (33158 bytes);
   Total: 309 packets (513621 bytes) muxed
 }}}
 Also, note that ffmpeg reads the start and duration for these files
 differently than ffprobe reports.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6630>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list