[FFmpeg-user] ffmpeg use -ss and copy the pts to mpegts

Rodney Baker rodney.baker at iinet.net.au
Tue Nov 20 12:26:00 CET 2012

On Tue, 20 Nov 2012 21:45:34 you wrote:
> Hi Rodney Baker,
>               I need your help,
>               I want to copy start time use -ss into output file which
> -f mpegts,
>               for example:
>               ffmpeg -y -ss 00:00:10.00  -i input.mkv -strict
> experimental -force_key_frames 10,20  -acodec aac -vcodec libx264 -r
> 15 -s 1280x720 -b:v 2000k  -b:a 88k -ar 44100 -preset ultrafast
> -vprofile baseline -vlevel 1.0  -map 0:0 -map 0:1 -copyts -bsf
> h264_mp4toannexb -vsync 1 -f mpegts -v debug -debug_ts -t 10 output.ts
>               The start time always from 1.4s or 0s.
>               I want to copy the kaka.mkv  timestamp from 10s to 20s
> and transcode the frames to mpegts,
>               I found the copyts cannot used for this opt, but codecs
> copy ,the timestamp can success copy into mpegts.
>               the ticket is:
>               http://ffmpeg.org/trac/ffmpeg/ticket/1839
>               Can you point where can i modify for do this opt?
> Thanks


You really shoudl be asking this on the mailing list - there are people there 
who are far more expert than I. 

I think I have this the right way around; if you use -ss before -i, it will 
seek into the file before beginning to decode, therefore it will start 
decoding at the nearest keyframe AFTER your specified start point, whereas if 
you put -ss AFTER -i, it will begin decoding at the beginning but begin 
ENCODING the output file starting from the time specified at -ss. 

That is to say, -ss before -i is faster, but -ss after -i is more precise.

The result is also perhaps both source-material- and codec-dependent. Others 
with more knowlege of how the internals work (i.e. developers, of which I am 
not one) may be able to provide a better description. 

Rodney Baker VK5ZTV
rodney.baker at iinet.net.au

More information about the ffmpeg-user mailing list