1

Should I just use plain command like this:

ffmpeg -i C:\video_input.ts -c:v copy -c:a copy -bsf:a aac_adtstoasc C:\video_output.mp4

but I have seen many using -copyts to it, why is this needed I do not completely understand it's documentation?

ffmpeg -i C:\video_input.ts -c:v copy -c:a copy -bsf:a aac_adtstoasc -copyts C:\video_output.mp4

and also every time I use -copyts there is an added delay before the first frame starts, so to fix this is it safe to use -start_at_zero or it breaks the point of copyts to some degree (if that makes any sense)?

ffmpeg -i C:\video_input.ts -c:v copy -c:a copy -bsf:a aac_adtstoasc -copyts -start_at_zero C:\video_output.mp4

Thanks!

2

Unless you know you have a specific need to preserve timestamps, there's no need to use -copyts. MPEG-TS, being a format, used for remote viewing, will have some start time offset, by default, to allow for buffering at the player's side. MP4 for local playback, doesn't need that, copyts will preserve it.

| improve this answer | |
  • but what is the difference between no -copyts and -copyts + -start_at_zero? Is there any need of it, why does it exists? – A. Newb Oct 7 '17 at 12:55
  • start_at_zero is relevant if you're seeking into the input i.e. -ss 10 Ordinarily, the first sought frame has its TS reset to zero. With s_a_0, its TS will now be 10. If used with copyts, that TS will be conveyed to the output. – Gyan Oct 7 '17 at 13:33
  • I thought you meant if I -ss 10 a .ts file, it will actually ss @ 11.4 (1.4 delay from ts), but if I do use -ss 10 with s_a_0, it will actually start at 10? When I checked, this doesn't make sense as it is not what is happening. The original .ts file had start: 1.4, when going under -ss 10, that same one had a start of 0.0480, same if I added start_at_zero to it, or both copyts and start_at_zero. – A. Newb Oct 7 '17 at 16:53
  • Let's say your MPEG-TS has start time of 15 and duration of 10s., and your codec is intra-coded, so we don't have to worry about GOP. With -ss 3 -i in.ts -c copy out.mp4, first sought frame has PTS of 0 after the demuxer stage, and out.mp4 has start time of 0. With -ss 3 -copyts -i in.ts -c copy out.mp4, the first sought frame has PTS of 18 after demuxer, which gets carried over during mux in out.mp4. With -ss 3 -start_at_zero -copyts -i in.ts -c copy out.mp4, first sought frame has PTS of 3 after demuxer, which gets carried over during mux in out.mp4. – Gyan Oct 7 '17 at 17:39
  • thank you for the further clarification. Now to wrap it up, following your original answer - In what exact case where I just want to remux a file, from .ts to a .mp4 container without losing any quality, there will be a need of including -copyts? And if I do need it in certain situations, isn't it always better to include s_a_0 if I do not want to have that "buffering" to my new .mp4 output? – A. Newb Oct 7 '17 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.