Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v3] ffmpeg: add option -isync
Date: Wed, 13 Jul 2022 14:30:14 +0200
Message-ID: <165771541454.25016.2178310108012611242@lain.khirnov.net> (raw)
In-Reply-To: <dcbad360-b1a9-18bd-ed16-382691b9b5c9@gyani.pro>

Quoting Gyan Doshi (2022-07-11 08:46:48)
> 
> 
> On 2022-07-11 12:21 am, Anton Khirnov wrote:
> > Quoting Gyan Doshi (2022-07-10 20:02:38)
> >>
> >> On 2022-07-10 10:46 pm, Anton Khirnov wrote:
> >>> Quoting Gyan Doshi (2022-07-08 05:56:21)
> >>>> On 2022-07-07 03:11 pm, Anton Khirnov wrote:
> >>>>> Quoting Gyan Doshi (2022-07-04 18:29:12)
> >>>>>> This is a per-file input option that adjusts an input's timestamps
> >>>>>> with reference to another input, so that emitted packet timestamps
> >>>>>> account for the difference between the start times of the two inputs.
> >>>>>>
> >>>>>> Typical use case is to sync two or more live inputs such as from capture
> >>>>>> devices. Both the target and reference input source timestamps should be
> >>>>>> based on the same clock source.
> >>>>>>
> >>>>>> If not all inputs have timestamps, the wallclock times at the time of
> >>>>>> reception of inputs shall be used. FFmpeg must have been compiled with
> >>>>>> thread support for this last case.
> >>>>> I'm wondering if simply using the other input's InputFile.ts_offset
> >>>>> wouldn't achieve the same effect with much less complexity.
> >>>> That's what I initially did. But since the code can also use two other
> >>>> sources for start times (start_time_realtime, first_pkt_wallclock),
> >>>> those intervals may not exactly match the difference between
> >>>> fmctx->start_times so I use a generic calculation.
> >>> In what cases is it better to use either of those two other sources?
> >>>
> >>> As per the commit message, the timestamps of both inputs are supposed to
> >>> come from the same clock. Then it seems to me that offsetting each of
> >>> those streams by different amounts would break synchronization rather
> >>> than improve it.
> >> The first preference, when available, stores the epoch time closest to
> >> time of capture. That would eliminate some jitter.
> >> The 2nd preference is the fmctx->start_time. The 3rd is the reception
> >> wallclock. It is a fallback. It will likely lead to the worst sync.
> > You did not answer my question.
> > If both streams use the same clock, then how is offsetting them by
> > different amounts improve sync?
> 
> Because the clocks can be different at different stages of stream 
> conveyance  i.e. capture -> encode -> network relay -> ffmpeg reception.
> As long as both use the same clock at a given stage, they represent the 
> same sync relation but with some jitter in the mix added with each stage.

Why would you send the streams separately and not synchronized before
network transmission?

-- 
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2022-07-13 12:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04 16:29 Gyan Doshi
2022-07-07  9:41 ` Anton Khirnov
2022-07-08  3:56   ` Gyan Doshi
2022-07-09 18:27     ` Gyan Doshi
2022-07-09 19:43       ` Paul B Mahol
2022-07-09 19:56         ` Gyan Doshi
2022-07-09 20:49           ` Hendrik Leppkes
2022-07-10 17:13           ` Anton Khirnov
2022-07-10 17:16     ` Anton Khirnov
2022-07-10 18:02       ` Gyan Doshi
2022-07-10 18:51         ` Anton Khirnov
2022-07-11  6:46           ` Gyan Doshi
2022-07-13 12:30             ` Anton Khirnov [this message]
2022-07-13 12:53               ` Gyan Doshi
2022-07-14  6:46         ` Anton Khirnov
2022-07-14  7:47           ` Gyan Doshi
2022-07-14  8:15             ` Anton Khirnov
2022-07-14  8:18               ` Gyan Doshi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=165771541454.25016.2178310108012611242@lain.khirnov.net \
    --to=anton@khirnov.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git