[FFmpeg-devel] [PATCH 0/1] mov.c: improvement to fMP4 bitrate estimation
Nick Ryan
nick.paul.ryan at gmail.com
Wed Sep 26 15:00:43 EEST 2018
Current code estimates bitrate by taking size of a single fragment and dividing by the total duration.
This patch changes calculation to be based on duration used for framerate estimation.
Example ffprobes BEFORE patch (note video stream 15 kb/s, audio stream 0 kb/s):
ffprobe version N-91996-g94aed2265a Copyright (c) 2007-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.2)
configuration:
libavutil 56. 19.101 / 56. 19.101
libavcodec 58. 30.100 / 58. 30.100
libavformat 58. 18.102 / 58. 18.102
libavdevice 58. 4.103 / 58. 4.103
libavfilter 7. 32.100 / 7. 32.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/nick/media/v-a-hls/video/video.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: iso8mp41dashavc1cmfc
creation_time : 2018-08-30T11:28:56.000000Z
Duration: 00:11:24.00, start: 0.000000, bitrate: 999 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1024x576 [SAR 1:1 DAR 16:9], 15 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
creation_time : 2018-08-30T11:28:56.000000Z
handler_name : VideoHandler
encoder : AVC Coding
ffprobe version N-91996-g94aed2265a Copyright (c) 2007-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.2)
configuration:
libavutil 56. 19.101 / 56. 19.101
libavcodec 58. 30.100 / 58. 30.100
libavformat 58. 18.102 / 58. 18.102
libavdevice 58. 4.103 / 58. 4.103
libavfilter 7. 32.100 / 7. 32.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/nick/media/v-a-hls/audio/audio.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: iso8mp41dashcmfc
creation_time : 2018-08-30T11:28:56.000000Z
Duration: 00:11:24.00, start: -0.023220, bitrate: 59 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 0 kb/s (default)
Metadata:
creation_time : 2018-08-30T11:28:56.000000Z
handler_name : SoundHandler
Example ffprobes AFTER patch (note video stream 1027 kb/s, audio stream 4 kb/s):
ffprobe version N-91996-g94aed2265a Copyright (c) 2007-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.2)
configuration:
libavutil 56. 19.101 / 56. 19.101
libavcodec 58. 30.100 / 58. 30.100
libavformat 58. 18.102 / 58. 18.102
libavdevice 58. 4.103 / 58. 4.103
libavfilter 7. 32.100 / 7. 32.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/nick/media/v-a-hls/video/video.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: iso8mp41dashavc1cmfc
creation_time : 2018-08-30T11:28:56.000000Z
Duration: 00:11:24.00, start: 0.000000, bitrate: 999 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1024x576 [SAR 1:1 DAR 16:9], 1027 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
creation_time : 2018-08-30T11:28:56.000000Z
handler_name : VideoHandler
encoder : AVC Coding
ffprobe version N-91996-g94aed2265a Copyright (c) 2007-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.2)
configuration:
libavutil 56. 19.101 / 56. 19.101
libavcodec 58. 30.100 / 58. 30.100
libavformat 58. 18.102 / 58. 18.102
libavdevice 58. 4.103 / 58. 4.103
libavfilter 7. 32.100 / 7. 32.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/nick/media/v-a-hls/audio/audio.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: iso8mp41dashcmfc
creation_time : 2018-08-30T11:28:56.000000Z
Duration: 00:11:24.00, start: -0.023220, bitrate: 59 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 4 kb/s (default)
Metadata:
creation_time : 2018-08-30T11:28:56.000000Z
handler_name : SoundHandler
Nick Ryan (1):
possible fix to correct (improve) bitrate estimation for streams in
fragmented MP4 when calculation is based on trex_data
libavformat/mov.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
2.17.1 (Apple Git-112)
More information about the ffmpeg-devel
mailing list