[FFmpeg-devel] [PATCH 2/4] ffmpeg: use filter time base as codec time base.

Michael Niedermayer michaelni at gmx.at
Thu May 24 01:21:50 CEST 2012

On Thu, May 24, 2012 at 12:46:28AM +0200, Nicolas George wrote:
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  ffmpeg.c |    2 ++
>  1 file changed, 2 insertions(+)
> I have some doubts about that. Here is the problem:
> Currently, the time base of an output encoder, if not set on the command
> line, is copied from the frame rate of the corresponding input decoder.
> Without filters, it makes reasonable sense, although it does not work well
> with variable frame rate inputs.
> With simple filters, the frame rate can change randomly, but it will still
> work in the simple cases.
> With complex filters, there is no "corresponding input".
> The current code, with complex filters, finds the first input that has the
> same media type as the output. That is IMHO completely nonsensical, and
> patch #3 removes it.
> The obvious solution would be to use the time base of the output link as the
> time base for the encoder. Unfortunately, that will not work if the result
> goes into a format that does not support variable frame rate: some filters,
> and even a few input formats, select a time base with a frequency much
> higher than the frame rate.
> For that reason, this patch takes the output link time base only if the time
> base is not set yet. With the current code, it happens with trans-media
> filters; with patch #3, it will happen for all complex filters.

> If someone has a better suggestion... Maybe have the filters compute and
> forward an estimated frame rate during their config_props?

Where this is possible its probably a good idea, also

we could
copy the frame rate estimation code from av_find_stream_info() into
a filter, and insert such filter if the output format needs it and
the passed through timebase / framerate is too high
That filter would then introduce a maybe 1-2 second delay on startup
to estimate the minimal timebase.

the patch LGTM

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120524/ba2678fb/attachment.asc>

More information about the ffmpeg-devel mailing list