[FFmpeg-user] Setting start time of .webm file affects duration?

Cosmin Stejerean cosmin at offbytwo.com
Wed Jul 18 03:38:04 EEST 2018


I noticed an odd behavior with .webm files I'm encoding using ffmpeg.

I have a source segment with a duration of 6 seconds and a start time of 12
seconds (it's the 3rd segment from a longer clip):

Input #0, mpegts, from 'segment-2.ts':
  Duration: 00:00:06.00, start: 12.000000, bitrate: 168361 kb/s


When I transcode this to VP9 using libvpx I want the duration and start
time to match the source segment. I tried using -copyts flag but the
resulting .webm file looks like this

Input #0, matroska,webm, from 'out.webm':
  Duration: 00:00:18.00, start: 12.000000, bitrate: 2395 kb/s


Notice that the duration is now 18 seconds. I also tried using the setpts
filter (setpts='PTS+12.0/TB') but the end result was the same. It looks
like changing the start time ends up applying the same offset to the
duration value too. This only happens in .webm files, output to .mp4 or .ts
in either H264 or H265 works as expected.


Am I doing something wrong or is this likely to be a bug with .webm output?
Any other workarounds I should consider for getting a .webm file with the
proper start time and duration?


- Cosmin


More information about the ffmpeg-user mailing list