[FFmpeg-devel] [PATCH] mov.c: reasonable bitrate for fragmented mp4

2014-10-21 Thread Mika Raento
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.
---
 libavformat/mov.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 80549ec..1444bce 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];
-- 
1.9.3 (Apple Git-50)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] mov.c: reasonable bitrate for fragmented mp4

2014-10-21 Thread Michael Niedermayer
On Tue, Oct 21, 2014 at 03:04:10PM +0300, Mika Raento wrote:
 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.
 ---
  libavformat/mov.c | 11 +++
  1 file changed, 11 insertions(+)

applied

btw this mayb could be factored with the previous loop

thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel