<p><em>There's lots of Invalid timestamps and Invalid DTS errors, but I'm not sure they're related to the problem.</em></p>

<p>They are, frames in video streams with B-frames are not encoded or stored in presentation order, so the presentation timestamps have to be correctly offset for fluid playback. In this TS sample, you have presentation timestamps earlier than decoding timestamps, which are invalid, and ffmpeg defaults to assigning the DTS as the new PTS.</p>

<p>Instead, use existing PTS as the reference.</p>

<pre><code>ffmpeg -fflags +igndts -i all.ts -c copy all.mp4
</code></pre>

CC BY-SA 4.0
2020-10-24T16:26:11.533Z
Sorry to butt in, but is there a way to ignore/hide the `[mpegts @ [...]] Invalid timestamps [...]` messages as well? That way, while downloading a HLS videostream, I'll only get to see the desired `[https @ [...]] Opening 'https://[...].ts' for reading`.
Reino
CC BY-SA 4.0
2020-10-24T16:58:17.617Z
No, warnings and errors have more priority than informational messages.
Gyan
CC BY-SA 4.0
2020-05-22T04:58:14.160Z
2020-05-22T04:58:14.160Z
Gyan
<p>I'm trying to convert a .ts file to an .mp4. I'm using the following ffmpeg command:</p>

<pre><code>ffmpeg -i all.ts -c copy all.mp4
</code></pre>

<p>This results in a noticeable loss in the fluidity of the video, which looks much more fluid in the original .ts format when viewed in VLC. </p>

<p>Output of <code>ffmpeg</code>:</p>

<pre><code>Input #0, mpegts, from 'all.ts':
  Duration: 00:00:25.00, start: 235.000000, bitrate: 804 kb/s
  Program 16727
    Stream #0:0[0x22]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 124 kb/s
    Stream #0:1[0x21]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 960x540 [SAR 1:1 DAR 16:9], 25 fps, 25 t
br, 90k tbn, 50 tbc
File 'all.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'all.mp4':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 960x540 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr,
 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 124 kb/s
Stream mapping:
  Stream #0:1 -&gt; #0:0 (copy)
  Stream #0:0 -&gt; #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x7fabfe802a00] Invalid timestamps stream=1, pts=21153600, dts=21160800, size=1936
[mpegts @ 0x7fabfe802a00] Invalid timestamps stream=1, pts=21160800, dts=21164400, size=2827
[mp4 @ 0x7fabff005000] Invalid DTS: 10800 PTS: 3600 in output stream 0:0, replacing by guess
[mp4 @ 0x7fabff005000] Invalid DTS: 14400 PTS: 10800 in output stream 0:0, replacing by guess
...
frame=  625 fps=0.0 q=-1.0 Lsize=    2330kB time=00:00:24.98 bitrate= 764.0kbits/s speed= 614x
video:1908kB audio:398kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.070788%
</code></pre>

<p>There's <em>lots</em> of <em>Invalid timestamps</em> and <em>Invalid DTS</em> errors, but I'm not sure they're related to the problem.</p>

<p>I've uploaded a small sample to demonstrate the error: <a href="https://www.dropbox.com/s/meg6kmjng36fsqy/all.ts?dl=0" rel="nofollow noreferrer">here</a> is the original TS file, and <a href="https://www.dropbox.com/s/jg76k0al7aiojr5/all.mp4?dl=0" rel="nofollow noreferrer">here</a> the not-so-fluid MP4 result.</p>

<p>Any idea of how to fix this? I have noticed that the problem does not occur if I re-encode the video track with h264, but I'd really like to just remux as the original TS looks just fine.</p>

<p>Thanks!</p>

<ffmpeg>
Remuxing a TS file to MP4 results in a less fluid video
Giuseppe
# Remuxing a TS file to MP4 results in a less fluid video

(Asked by: username_0 on 2020-05-21)

I'm trying to convert a .ts file to an .mp4. I'm using the following ffmpeg command:
ffmpeg -i all.ts -c copy all.mp4

This results in a noticeable loss in the fluidity of the video, which looks much more fluid in the original .ts format when viewed in VLC. 
Output of ffmpeg:
Input #0, mpegts, from 'all.ts':
  Duration: 00:00:25.00, start: 235.000000, bitrate: 804 kb/s
  Program 16727
    Stream #0:0[0x22]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 124 kb/s
    Stream #0:1[0x21]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 960x540 [SAR 1:1 DAR 16:9], 25 fps, 25 t
br, 90k tbn, 50 tbc
File 'all.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'all.mp4':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 960x540 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr,
 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 124 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x7fabfe802a00] Invalid timestamps stream=1, pts=21153600, dts=21160800, size=1936
[mpegts @ 0x7fabfe802a00] Invalid timestamps stream=1, pts=21160800, dts=21164400, size=2827
[mp4 @ 0x7fabff005000] Invalid DTS: 10800 PTS: 3600 in output stream 0:0, replacing by guess
[mp4 @ 0x7fabff005000] Invalid DTS: 14400 PTS: 10800 in output stream 0:0, replacing by guess
...
frame=  625 fps=0.0 q=-1.0 Lsize=    2330kB time=00:00:24.98 bitrate= 764.0kbits/s speed= 614x
video:1908kB audio:398kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.070788%

There's lots of Invalid timestamps and Invalid DTS errors, but I'm not sure they're related to the problem.
I've uploaded a small sample to demonstrate the error: here is the original TS file, and here the not-so-fluid MP4 result.
Any idea of how to fix this? I have noticed that the problem does not occur if I re-encode the video track with h264, but I'd really like to just remux as the original TS looks just fine.
Thanks!

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2020-05-22. Score: 3 | Accepted answer

There's lots of Invalid timestamps and Invalid DTS errors, but I'm not sure they're related to the problem.
They are, frames in video streams with B-frames are not encoded or stored in presentation order, so the presentation timestamps have to be correctly offset for fluid playback. In this TS sample, you have presentation timestamps earlier than decoding timestamps, which are invalid, and ffmpeg defaults to assigning the DTS as the new PTS.
Instead, use existing PTS as the reference.
ffmpeg -fflags +igndts -i all.ts -c copy all.mp4

> **Comments:**
> **username_2**: Sorry to butt in, but is there a way to ignore/hide the `[mpegts @ [...]] Invalid timestamps [...]` messages as well? That way, while downloading a HLS videostream, I'll only get to see the desired `[https @ [...]] Opening 'https://[...].ts' for reading`.  
> **username_1**: No, warnings and errors have more priority than informational messages.  

---

