[FFmpeg-trac] #3353(undetermined:new): Transcode to .ts format gives unexpected video start time

FFmpeg trac at avcodec.org
Mon Jan 27 11:52:01 CET 2014

#3353: Transcode to .ts format gives unexpected video start time
             Reporter:               |                    Owner:
  wdelstrother                       |                   Status:  new
                 Type:  defect       |                Component:
             Priority:  normal       |  undetermined
              Version:  unspecified  |               Resolution:
             Keywords:  mpegts       |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |

Comment (by wdelstrother):

 I am not using -f hls, because I don't have a single input file to break
 down into segments.

 The problem that I am seeing is simply that the start time in the .ts file
 is non-zero, when (as far as I can tell) there is no reason why it should

 I think I might need to give some more context to what I'm actually trying
 to do; in my application, I'm receiving a sequence of 5 second files from
 a 3rd party, and I'm using ffmpeg to transcode each one into a .ts file
 (with libx264 / aac) with the appropriate start time.  I also generate an
 m3u8 playlist outside of ffmpeg at run-time so that the 'chunked' video
 can be restreamed in near-real-time.

 The only way I've found to set the start time of a .ts file was to use the
 'initial_offset' option to ssegment (even though I'm only producing a
 single segment).  So my command line for a single transcode actually looks
 something like:

 %ffmpeg -loglevel warning -i input.avi -c:a aac -strict -2 -ac 2 -ar 44100
 -b:a 128k -c:v libx264 -profile:v main -level:v 4.1 -x264opts keyint=60 -r
 30 -b:v 400k -vf scale=426:240 -f ssegment -map 0 -segment_time 100
 -initial_offset 100 output%03d.ts

 %mv output000.ts output.ts

 In that line, I request a start time of 100s, but the start time which is
 actually put into the file is a few seconds off from that.  When I attempt
 to play the video from the playlist, these start time errors result in
 discontinuities, so the video jumps and/or hangs.

 I recognise that the above is rather convoluted, so I've tried to simplify
 the problem for this bug report.  Exactly the same problem (the start time
 of a .ts file being offset) happens when we just do a simple 'ffmpeg -i
 input output.ts', which is why I provided this example.

Ticket URL: <https://trac.ffmpeg.org/ticket/3353#comment:4>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list