[FFmpeg-devel] [PATCH] libavformat/utils: hls live duration form bit rate is not accurate

Michael Niedermayer michael at niedermayer.cc
Mon Oct 10 16:31:27 EEST 2016


On Mon, Oct 10, 2016 at 03:05:41PM +0800, zzj wrote:
> Signed-off-by: zzj <zzjjob at gmail.com>
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 5be1e86..c7d6a41 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2776,7 +2776,7 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset)
>           * the components */
>          fill_all_stream_timings(ic);
>          ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM;
> -    } else {
> +    } else if (strcmp(ic->iformat->name, "hls,applehttp")) {

i would suggest to add a
AVFMT_DURATION_LIVE
and set duration_estimation_method to it in the hls demuxer
and then skip estimation in utils if AVFMT_DURATION_LIVE is set

this can easily be extended to other formats

thats one line of thinking, another one would be to rather see this
as that filesize of the main file is not representative as its just
a "play list" and rather have the demuxers export this information
and then check for that before using the filesize for duration
estimation

either should solve this and in fact both could be done

thx

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

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161010/ce5ae0b4/attachment.sig>


More information about the ffmpeg-devel mailing list