[FFmpeg-devel] [PATCH v3] avformat/smoothstreamingenc:add bitrate calculate

Michael Niedermayer michael at niedermayer.cc
Sat Mar 16 01:15:41 EET 2019


On Thu, Mar 14, 2019 at 11:21:58AM -0700, Jun Li wrote:
> Calculate bitrate based on fragment size, only applied when
> bitrate is not set, for example rtsp source.
> 
> Signed-off-by: Jun Li <junli1026 at gmail.com>
> ---
>  libavformat/smoothstreamingenc.c | 32 +++++++++++++++++++++++++++-----
>  1 file changed, 27 insertions(+), 5 deletions(-)
> 
> diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
> index 094712af27..30bb188aa2 100644
> --- a/libavformat/smoothstreamingenc.c
> +++ b/libavformat/smoothstreamingenc.c
> @@ -320,11 +320,13 @@ static int ism_write_header(AVFormatContext *s)
>          AVDictionary *opts = NULL;
>  
>          if (!s->streams[i]->codecpar->bit_rate) {
> -            av_log(s, AV_LOG_ERROR, "No bit rate set for stream %d\n", i);
> -            ret = AVERROR(EINVAL);
> -            goto fail;

> +            av_log(s, AV_LOG_WARNING, "No bit rate set for stream %d\n", i);
> +            // create a tmp name for the directory of fragments
> +            snprintf(os->dirname, sizeof(os->dirname), "%s/QualityLevels(Tmp_%"PRId64")", s->url, i);

"i" cannot be "%d" and %"PRId64" at the same time

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

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190316/1011e811/attachment.sig>


More information about the ffmpeg-devel mailing list