diff options
author | Mika Raento <mikie@iki.fi> | 2014-10-21 15:04:10 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-10-21 18:06:18 +0200 |
commit | 17702f1fc58464e9ca4fd5a5b2cf24207a65c4fd (patch) | |
tree | 995ad820054c2cc801b563b45a4a35df60fbe5d6 /libavformat/mov.c | |
parent | 059c842818a11cfa714cb2007ed0aab95f2ff765 (diff) | |
download | ffmpeg-17702f1fc58464e9ca4fd5a5b2cf24207a65c4fd.tar.gz |
mov.c: reasonable bitrate for fragmented mp4
If using MFRA for timestamps, the stream may start from a large offset
and/or have gaps. With this change we calculate the bitrate based on
frames we've seen.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 80549eca54..1444bcedf7 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3943,6 +3943,17 @@ static int mov_read_header(AVFormatContext *s) } } + if (mov->use_mfra_for > 0) { + for (i = 0; i < s->nb_streams; i++) { + AVStream *st = s->streams[i]; + MOVStreamContext *sc = st->priv_data; + if (sc->duration_for_fps > 0) { + st->codec->bit_rate = sc->data_size * 8 * sc->time_scale / + sc->duration_for_fps; + } + } + } + for (i = 0; i < mov->bitrates_count && i < s->nb_streams; i++) { if (mov->bitrates[i]) { s->streams[i]->codec->bit_rate = mov->bitrates[i]; |