[FFmpeg-devel] Question about frame->pts, outlink->time_base, and outlink->frame_rate

Andrey Utkin andrey.krieger.utkin at gmail.com
Wed Jan 29 01:34:05 CET 2014


2014-01-29 Nicholas Robbins <nickrobbins at yahoo.com>:
> If I could just multiply the time_base by 1/8 I would have no rounding in the filter.
>
>> Which media container type do
>> you use, and are you able to use another if it fits better?
>
> I plan on using libx264 in matroska, but in terms of testing and understanding I could use something different.
>
> I've written the patch already and its behavior is about 99% of what I want, so if getting that last 1% is not worth it, I'm fine with that, but I want to make sure what I think is happening is in fact happening.

Is that right that you run your filter using ffmpeg command line utility?

There is an AVCodecContext AVOption "time_base", but currently it is
not managable through command line, although it can be enabled for
that with a patch

diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index c82c104..89c30fc 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -92,7 +92,7 @@ static const AVOption avcodec_options[] = {
 {"umh", "umh motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_UMH
}, INT_MIN, INT_MAX, V|E, "me_method" },
 {"iter", "iter motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 =
ME_ITER }, INT_MIN, INT_MAX, V|E, "me_method" },
 {"extradata_size", NULL, OFFSET(extradata_size), AV_OPT_TYPE_INT,
{.i64 = DEFAULT }, INT_MIN, INT_MAX},
-{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl =
0}, INT_MIN, INT_MAX},
+{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl =
0}, INT_MIN, INT_MAX, V|E},

I am not sure whether it is a bug or design.

I've done so, and output file of a command

ffmpeg -re -f lavfi -i testsrc  -vcodec libx264 -time_base 1/10000  /tmp/tmp.mkv

Produces different ffprobe output, exactly

Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuv444p, 320x240
[SAR 1:1 DAR 4:3], 10k fps, 25 tbr, 1k tbn, 20k tbc (default)

For playback, it seems ok and real framerate is likely the same as by
default, despite ffprobe pretends the framerate is huge.

Maybe you could try this way and tell us whether it helps you.

-- 
Andrey Utkin


More information about the ffmpeg-devel mailing list