<p>I'm trying to concat hundreds of short *.ts pieces into a single mp4 video.</p>

<p>I've tried the following command:</p>

<pre><code>ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4
</code></pre>

<p>And at first glance it looks fine: the output video works fine in MPC, VLC and Google Chrome. But I noticed that all these programs play the video at an increased speed: the seek time increases a little bit faster than the real time.</p>

<p>when I upload the output file to a video-hosting after it's processing the audio became intermittent. I've tried different hostings with same results.</p>

<p>I believe that the problem is in different duration of audio and video streams in all ts files.</p>

<p>video: duration=2.000333</p>

<p>audio: duration=1.880800</p>

<p>How to correctly concat files like these?</p>

<p>The full result of the ffprobe for a single file is down bellow.</p>

<pre><code>PS I:\log&gt; ffprobe.exe -show_streams .\ts\01583--1329536.ts
ffprobe version N-94664-g0821bc4eee Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190807
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.101 / 58. 55.101
  libavformat    58. 31.104 / 58. 31.104
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.101 /  7. 58.101
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mpegts, from '.\ts\01583--1329536.ts':
  Duration: 00:00:02.11, start: 90.650444, bitrate: 5029 kb/s
  Program 1
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080, 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 169 kb/s
[STREAM]
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=1920
height=1080
coded_width=1920
coded_height=1088
has_b_frames=2
sample_aspect_ratio=N/A
display_aspect_ratio=N/A
pix_fmt=yuv420p
level=40
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=progressive
timecode=N/A
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=8168850
start_time=90.765000
duration_ts=180030
duration=2.000333
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=[15][0][0][0]
codec_tag=0x000f
sample_fmt=fltp
sample_rate=44100
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=8158540
start_time=90.650444
duration_ts=169272
duration=1.880800
bit_rate=169509
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]
</code></pre>

CC BY-SA 4.0
2019-09-26T19:04:44.420Z
Is this a segment from an HLS stream? If so, dont use `ffmpeg` to concat, use `cat`
SlimSCSI
CC BY-SA 4.0
2019-09-26T19:27:44.843Z
I'm absolutely noob in this but I think it is HLS. I've used `copy` (windows analog of `cat`) and it workes! I've tried it before with no success so... thanks for motivation to try again :)
cojay
CC BY-SA 4.0
2019-09-26T19:28:49.687Z
`I" think it is HLS"` You should really find out. Where are you getting the files/filenames?
SlimSCSI
<ffmpeg>
How to concat multiple *.ts files which have audio streams shorter than video streams
cojay
# How to concat multiple *.ts files which have audio streams shorter than video streams

(Asked by: username_0 on 2019-09-26)

I'm trying to concat hundreds of short *.ts pieces into a single mp4 video.
I've tried the following command:
ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4

And at first glance it looks fine: the output video works fine in MPC, VLC and Google Chrome. But I noticed that all these programs play the video at an increased speed: the seek time increases a little bit faster than the real time.
when I upload the output file to a video-hosting after it's processing the audio became intermittent. I've tried different hostings with same results.
I believe that the problem is in different duration of audio and video streams in all ts files.
video: duration=2.000333
audio: duration=1.880800
How to correctly concat files like these?
The full result of the ffprobe for a single file is down bellow.
PS I:\log> ffprobe.exe -show_streams .\ts\01583--1329536.ts
ffprobe version N-94664-g0821bc4eee Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190807
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.101 / 58. 55.101
  libavformat    58. 31.104 / 58. 31.104
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.101 /  7. 58.101
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mpegts, from '.\ts\01583--1329536.ts':
  Duration: 00:00:02.11, start: 90.650444, bitrate: 5029 kb/s
  Program 1
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080, 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 169 kb/s
[STREAM]
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=1920
height=1080
coded_width=1920
coded_height=1088
has_b_frames=2
sample_aspect_ratio=N/A
display_aspect_ratio=N/A
pix_fmt=yuv420p
level=40
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=progressive
timecode=N/A
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=8168850
start_time=90.765000
duration_ts=180030
duration=2.000333
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=[15][0][0][0]
codec_tag=0x000f
sample_fmt=fltp
sample_rate=44100
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=8158540
start_time=90.650444
duration_ts=169272
duration=1.880800
bit_rate=169509
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]

**Tags:** ffmpeg

> **Comments:**
> **username_1**: Is this a segment from an HLS stream? If so, dont use `ffmpeg` to concat, use `cat`  
> **username_0**: I'm absolutely noob in this but I think it is HLS. I've used `copy` (windows analog of `cat`) and it workes! I've tried it before with no success so... thanks for motivation to try again :)  
> **username_1**: `I" think it is HLS"` You should really find out. Where are you getting the files/filenames?  

---

## 0 answers

