-
-
Save anonymous/8ddcb0fd5f40f8a11029 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ffmpeg.c b/ffmpeg.c | |
index 17fa8b6..f6e3f5e 100644 | |
--- a/ffmpeg.c | |
+++ b/ffmpeg.c | |
@@ -3632,7 +3632,7 @@ static int process_input(int file_index) | |
if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO || | |
ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) && | |
- pkt.dts != AV_NOPTS_VALUE && ist->next_dts == AV_NOPTS_VALUE && !copy_ts | |
+ pkt.dts != AV_NOPTS_VALUE && ist->next_dts == AV_NOPTS_VALUE && copy_ts != 1 | |
&& (is->iformat->flags & AVFMT_TS_DISCONT) && ifile->last_ts != AV_NOPTS_VALUE) { | |
int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q); | |
int64_t delta = pkt_dts - ifile->last_ts; | |
@@ -3651,7 +3651,7 @@ static int process_input(int file_index) | |
if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO || | |
ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) && | |
pkt.dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE && | |
- !copy_ts) { | |
+ copy_ts != 1) { | |
int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q); | |
int64_t delta = pkt_dts - ist->next_dts; | |
if (is->iformat->flags & AVFMT_TS_DISCONT) { | |
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c | |
index 20fc63c..51f2d4d 100644 | |
--- a/ffmpeg_opt.c | |
+++ b/ffmpeg_opt.c | |
@@ -94,7 +94,7 @@ int do_benchmark = 0; | |
int do_benchmark_all = 0; | |
int do_hex_dump = 0; | |
int do_pkt_dump = 0; | |
-int copy_ts = 0; | |
+int copy_ts = -1; | |
int copy_tb = -1; | |
int debug_ts = 0; | |
int exit_on_error = 0; | |
@@ -926,7 +926,7 @@ static int open_input_file(OptionsContext *o, const char *filename) | |
f->start_time = o->start_time; | |
f->recording_time = o->recording_time; | |
f->input_ts_offset = o->input_ts_offset; | |
- f->ts_offset = o->input_ts_offset - (copy_ts ? 0 : timestamp); | |
+ f->ts_offset = o->input_ts_offset - (copy_ts == 1 ? 0 : (copy_ts ? timestamp : ((o->start_time == AV_NOPTS_VALUE) ? 0 : o->start_time))); | |
f->nb_streams = ic->nb_streams; | |
f->rate_emu = o->rate_emu; | |
f->accurate_seek = o->accurate_seek; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment