[FFmpeg-user] Manually specifying output codec timebase (to match existing output)

Rob Hallam robert at roberthallam.com
Thu Jun 25 13:41:15 CEST 2015


Greetings,

I am looking for a way to specify output codec timebase (tbc, or
codec_time_base as reported by ffprobe -show_streams). Searching for a
solution and asking in #ffmpeg have not been entirely fruitful. The
documentation suggests that -time_base should be an option:

| The list of supported options follow:
| [...]
| time_base rational number
| Set codec time base.
| It is the fundamental unit of time (in seconds) in terms of which
frame timestamps are represented. For fixed-fps content, timebase
should be 1 / frame_rate and timestamp increments should be
identically 1.

As per https://www.ffmpeg.org/ffmpeg-codecs.html#Codec-Options

However, recent-ish repo (2.6.3) and compiled (N-73111-ge22edbf)
version of ffmpeg complain:

| Unrecognized option 'time_base'.

Is there a way of achieving this in current versions?

Thanks in advance,
Rob

--

Extra info:

The lack of references suggests that setting output timebase is not a
usual or recommended thing to do in most cases. However, I am trying
to produce video with the exact same parameters so that they can be
joined together using the concat demuxer. ("If you have media files
with exactly the same codec and codec parameters you can concatenate
them...")

There is more detail available in a question I asked on SuperUser
(http://superuser.com/questions/931969/creating-videos-for-ffmpegs-concat-demuxer-to-avoid-a-large-re-encode
- I suspect that it is too niche to attract an answer there however);
but I will summarise briefly to save clicking through.

I have a long file that I wish to extract useful parts from, which can
be done by cutting and rejoining with no problems. However, for
aesthetics I would like to include short transitions between these
parts. This would normally incur a long re-encode of the entire set of
clips which I would like to avoid to save time and transcoding
something already in a lossy format. The parts are split further at
the ends, and these small subclips used to generate the transitions-
no problems there either. I am trying to glue all this back together
and getting artifacts, because of what I presume are mismatches in
codec parameters.

It's not an entirely typical use case, and may be a wild goose chase
but I figured it was worth a shot to make things a bit more efficient.

--

Console output for unrecognised option, time_base using example
generated output:

$ ./ffmpeg -y -f lavfi -i color=red -frames:v 200 -r 62.5 -time_base
60.0 test.mp4
ffmpeg version N-73111-ge22edbf Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --pkg-config-flags=--static --enable-gpl
--enable-libass --enable-libfreetype --enable-libmp3lame
--enable-libtheora --enable-libvorbis --enable-libx264
--enable-nonfree
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 44.100 / 56. 44.100
  libavformat    56. 38.100 / 56. 38.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 17.100 /  5. 17.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Unrecognized option 'time_base'.
Error splitting the argument list: Option not found


More information about the ffmpeg-user mailing list