[FFmpeg-user] help time shifting frame time stamps for generated mpegts files

Mark Essel messel at gmail.com
Fri Mar 15 12:21:57 CET 2013

update, it appears the time stamps of mpegts are not being read properly

all ouptuts, and command lines

the following works as intended:
ffmpeg -loglevel debug -i s2.ts -filter:v 'setpts=900000+PTS-STARTPTS'
-qscale 0 s2_shift.avi

ffmpeg -loglevel debug -i s2.ts -filter:v 'setpts=900000+PTS-STARTPTS'
-qscale 0 s2_shift.ts generates odd time stamps, 1.4 through 21.4

also Duration: 00:00:19.96, start: 1.400000, bitrate: 11990 kb/s is
incorrect for the source which has timestamps from 0-9.958333 (I'll
attach those on the end)

original mpegts source probed time stamps are 0-9.958333

yet early on in the command I see
  Duration: 00:00:19.96, start: 1.400000, bitrate: 11990 kb/s

[mpegts @ 0x7ffccc020c00] max_analyze_duration 5000000 reached at 5000000
Input #0, mpegts, from 's2_shift.ts':
  Duration: 00:00:19.96, start: 1.400000, bitrate: 11990 kb/s
  Program 1
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] /
0x0002), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 90k
tbn, 48 tbc

On Thu, Mar 14, 2013 at 3:43 PM, Mark Essel <messel at gmail.com> wrote:
> I've tried to edit the time stamps directly with ffmpeg setpts filter
>   ffmpeg -i s100k_seg2_orig.ts -filter:v 'setpts=120+PTS' -f mpegts output.ts
> but the output file times are always 1.4s to segment file duration+1.4s
> if I convert the file to avi format, then apply the filter it works as
> expected. I can then convert this avi file back into mpegts format but
> it has it's times reset to 1.4s to segment file duration + time shift
> the goal is to generate mpegts files on various servers and then load
> them into a VOD m3u8 container. With only relative time stamps stream
> playback has many issues (more over 3g). If instead all the files are
> merged together into one large video and then segmented into mpegts
> the time stamps are all contiguous and playback is smooth
> ---
> As an alternate route I'm attempting to edit an old segment.c example
> program I came across online. I've got it to compile by updating the
> api calls, but it's seg faulting at the point where it tries to write
> the new output format context header. My hopes with the c code is to
> manually specify pts and dts times
> pkt_pts_time=ShiftTime
> pkt_dts_time=ShiftTime
> pkt_duration_time=1 / fps
> pkt_pts_time=ShiftTime + dT
> pkt_dts_time=ShiftTime + dT
> pkt_duration_time=1 / fps
> ...
> Any help is appreciated.
> ref:
> http://stackoverflow.com/questions/9598973/ffmpeg-transcoding-reset-the-start-time-of-file

More information about the ffmpeg-user mailing list