[FFmpeg-user] Set start time offset in ts video segment output from mp4 movie clip input

Stefano Sabatini stefasab at gmail.com
Sun Jul 14 12:58:18 CEST 2013

On date Friday 2013-07-05 19:47:53 -0400, Peter Chen wrote:
> I'm converting an mp4 movie clip into a ts video segment using the
> following command:
>    > ffmpeg -i input-segment-4.mp4 -vcodec copy -acodec copy -qscale 0
> -vbsf h264_mp4toannexb -y -r 24 -vf transpose=1 -f
> mpegts output-segment-4.ts
> This ts video segment will be part of an HLS (HTTP Live Streaming) video
> stream.
> The ffmpeg conversion works great.
> I might not be asking the following question using the proper terminology,
> but here's what I'd like to do. I'd like the output file, called
> output-segment-4.ts in the ffmpeg command above, to have a start time
> offset of, say, 40 seconds. So, in an HLS video stream that contains these
> output ts segments, output-segment-0.ts would have a start time of 0
> seconds, output-segment-1.ts would have a start time of 10 seconds, etc...
> Currently, if I'm reading the output of ffprobe correctly, every ts file
> shows a start time offset of about 1.4 seconds. Below is the output of
> "ffprobe output-segment-4.ts". I'm basically trying to
> manipulate output-segment-4.ts so "start: 1.421678" becomes "start: 40.0"
> in the line "Duration: 00:00:09.95, start: 1.421678, bitrate: 1718
> kb/s".
> In summary, how do I set that start field?

You might want to look at the segment muxer and the options
reset_timestamps and initial_offset, which was added very recently.
FFmpeg = Fabulous and Faithful Mere Puritan Elastic Game

More information about the ffmpeg-user mailing list