diff options
author | Shiwang.Xie <shiwang.xie666@outlook.com> | 2021-05-15 08:53:56 +0000 |
---|---|---|
committer | Gyan Doshi <ffmpeg@gyani.pro> | 2021-07-18 09:59:02 +0530 |
commit | 694545b6d5fff5a8242b5fab8c1746e74a06f9ba (patch) | |
tree | e233ad1bf6767ebbb013e069a03dd9659634f25d /libavdevice/v4l2-common.h | |
parent | ea5bdc8893e4c1d5c3b417afad78ccedaa831789 (diff) | |
download | ffmpeg-694545b6d5fff5a8242b5fab8c1746e74a06f9ba.tar.gz |
fftools/ffmpeg: fix -t inaccurate recording time
if input start time is not 0 -t is inaccurate doing stream copy,
will record extra duration according to input start time.
it should base on following cases:
input video start time from 60s, duration is 300s,
1. stream copy:
ffmpeg -ss 40 -t 60 -i in.mp4 -c copy -y out.mp4
open_input_file() will seek to 100 and set ts_offset to -100,
process_input() will offset pkt->pts with ts_offset to make it 0,
so when do_streamcopy() with -t, exits when ist->pts >= recording_time.
2. stream copy with -copyts:
ffmpeg -ss 40 -t 60 -copyts -i in.mp4 -c copy -y out.mp4
open_input_file() will seek to 100 and set ts_offset to 0,
process_input() will keep raw pkt->pts as ts_offset is 0,
so when do_streamcopy() with -t, exits when
ist->pts >= (recording_time+f->start_time+f->ctx->start_time).
3. stream copy with -copyts -start_at_zero:
ffmpeg -ss 40 -t 60 -copyts -start_at_zero -i in.mp4 -c copy -y out.mp4
open_input_file() will seek to 120 and set ts_offset to -60 as start_to_zero option,
process_input() will offset pkt->pts with input file start time,
so when do_streamcopy() with -t, exits when ist->pts >= (recording_time+f->start_time).
0 60 40 60 360
|_______|_____|_______|_______________________|
start -ss -t
This fixes ticket #9141.
Signed-off-by: Shiwang.Xie <shiwang.xie666@outlook.com>
Diffstat (limited to 'libavdevice/v4l2-common.h')
0 files changed, 0 insertions, 0 deletions