Re: [FFmpeg-devel] [PATCH v5 1/4] lavc/libdavs2: fix sequence incomplete output error

2018-11-14 Thread hwren
Any comments on these patches?








At 2018-11-02 21:30:08, "hwren"  wrote:
>Signed-off-by: hwren 
>---
> libavcodec/libdavs2.c | 12 +++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
>diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
>index cadf995..e36bfed 100644
>--- a/libavcodec/libdavs2.c
>+++ b/libavcodec/libdavs2.c
>@@ -129,7 +129,17 @@ static int davs2_decode_frame(AVCodecContext *avctx, void 
>*data,
> int   ret  = DAVS2_DEFAULT;
> 
> if (!buf_size) {
>-return 0;
>+ret = davs2_decoder_flush(cad->decoder, >headerset, 
>>out_frame);
>+if (ret == DAVS2_END) {
>+return 0;
>+} else if (ret == DAVS2_GOT_FRAME) {
>+*got_frame = davs2_dump_frames(avctx, >out_frame, 
>>headerset, ret, frame);
>+davs2_decoder_frame_unref(cad->decoder, >out_frame);
>+return ret;
>+} else {
>+av_log(avctx, AV_LOG_ERROR, "Decoder error: dump frames 
>failed\n");
>+return AVERROR_EXTERNAL;
>+}
> }
> 
> cad->packet.data = buf_ptr;
>-- 
>2.7.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/cbs_av1: don't abort when splitting Temporal Units containing OBUs with no obu_size field

2018-11-14 Thread James Almer
The ISOBMFF and Matroska specs allow the last OBU in a Sample/Block to have
obu_has_size_field equal to 0.

Signed-off-by: James Almer 
---
See https://0x0.st/sUsU.mp4

It apparently can't be decoded with either aom or dav1d atm, but the latter
should be able to soon.
You can try remuxing it using the av1_metadata bsf after this patch while at it,
since the code to write obu_size fields unconditionally is still in place, and
that should make it decodable with either library.

For some reason cbs_av1_read_unit() is already able to handle OBUs with no
obu_size field. It was only cbs_av1_split_fragment() bailing out with them.

 libavcodec/cbs_av1.c | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index ed5211be19..e02bc7027a 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -788,13 +788,6 @@ static int cbs_av1_split_fragment(CodedBitstreamContext 
*ctx,
 if (err < 0)
 goto fail;
 
-if (!header.obu_has_size_field) {
-av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU for raw "
-   "stream: size field must be present.\n");
-err = AVERROR_INVALIDDATA;
-goto fail;
-}
-
 if (get_bits_left() < 8) {
 av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU: fragment "
"too short (%zu bytes).\n", size);
@@ -802,9 +795,12 @@ static int cbs_av1_split_fragment(CodedBitstreamContext 
*ctx,
 goto fail;
 }
 
-err = cbs_av1_read_leb128(ctx, , "obu_size", _size);
-if (err < 0)
-goto fail;
+if (header.obu_has_size_field) {
+err = cbs_av1_read_leb128(ctx, , "obu_size", _size);
+if (err < 0)
+goto fail;
+} else
+obu_size = size - 1 - header.obu_extension_flag;
 
 pos = get_bits_count();
 av_assert0(pos % 8 == 0 && pos / 8 <= size);
-- 
2.19.1

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


Re: [FFmpeg-devel] [PATCH 0/2] Update vf_bwdif to use yadif_common v2

2018-11-14 Thread Philip Langdale
On Tue, 13 Nov 2018 02:11:15 +0100
Thomas Mundt  wrote:

> Am So., 11. Nov. 2018 um 20:47 Uhr schrieb Philip Langdale <
> phil...@overt.org>:  
> 
> > vf_bwdif's frame management logic is almost identical to that of
> > yadif. The only difference is that it tracks the first and last
> > fields in a sequence, and that requires slight changes to the
> > common code.
> >
> > Assuming it's reasonable to do that tracking even though yadif
> > doesn't need it, we can then remove all the duplicated logic.
> >
> > v2: Rename enum values as recommened by Thomas Mundt.
> >
> > Philip Langdale (2):
> >   avfilter/yadif_common: Add field type tracking to help bwdif
> >   avfilter/vf_bwdif: Use common yadif frame management logic
> >
> >  libavfilter/bwdif.h |  34 +
> >  libavfilter/vf_bwdif.c  | 235
> > +--- libavfilter/x86/vf_bwdif_init.c
> > |   3 +- libavfilter/yadif.h |  14 ++
> >  libavfilter/yadif_common.c  |  12 +-
> >  5 files changed, 64 insertions(+), 234 deletions(-)
> >  
> 
> Patch lgtm.

Thanks. Pushed.

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


Re: [FFmpeg-devel] [PATCH] web/index: add news entry for release 4.1

2018-11-14 Thread Michael Niedermayer
On Wed, Nov 14, 2018 at 01:40:09PM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  src/index | 50 ++
>  1 file changed, 50 insertions(+)

LGTM
thx

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

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu


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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/cbs_av1: fix parsing signed integer values

2018-11-14 Thread James Almer
On 11/14/2018 8:04 PM, Mark Thompson wrote:
> On 14/11/18 22:39, James Almer wrote:
>> On 11/14/2018 7:24 PM, Mark Thompson wrote:
>>> On 11/11/18 02:24, James Almer wrote:
 Signed-off-by: James Almer 
 ---
 See https://0x0.st/sljR.webm

  libavcodec/cbs_av1.c | 30 +-
  1 file changed, 9 insertions(+), 21 deletions(-)

 diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
 index ff32a6fca5..215f9384e8 100644
 --- a/libavcodec/cbs_av1.c
 +++ b/libavcodec/cbs_av1.c
 @@ -189,30 +189,26 @@ static int cbs_av1_read_su(CodedBitstreamContext 
 *ctx, GetBitContext *gbc,
 int width, const char *name,
 const int *subscripts, int32_t *write_to)
  {
 -uint32_t magnitude;
 -int position, sign;
 +int position;
  int32_t value;
  
  if (ctx->trace_enable)
  position = get_bits_count(gbc);
  
 -if (get_bits_left(gbc) < width + 1) {
 +if (get_bits_left(gbc) < width) {
  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid signed value at "
 "%s: bitstream ended.\n", name);
  return AVERROR_INVALIDDATA;
  }
  
 -magnitude = get_bits(gbc, width);
 -sign  = get_bits1(gbc);
 -value = sign ? -(int32_t)magnitude : magnitude;
 +value = get_sbits(gbc, width);
  
  if (ctx->trace_enable) {
  char bits[33];
  int i;
  for (i = 0; i < width; i++)
 -bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0';
 -bits[i] = sign ? '1' : '0';
 -bits[i + 1] = 0;
 +bits[i] = value >> (width - i - 1) & 1 ? '1' : '0';
>>>
>>> Not sure if we care, but right-shifting a negative value is 
>>> implementation-defined.
>>
>> Is casting value to unsigned enough, or should i use something like
>> zero_extend()?
> 
> I think using left-shift instead is safe:
> 
> value & 1 << (...) ? '1' : '0'

Changed and both patches applied and backported. Thanks!
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] [HLS] Add LANGUAGE attribute to #EXT-X-MEDIA tag for audio-only variant streams.

2018-11-14 Thread Philippe Symons
Hello everyone,

Here is the new version of the patch in which the comments on the curly
braces have been resolved as well.

I hope it's okay now.

Best regards,

Philippe Symons

Op do 15 nov. 2018 om 00:13 schreef Philippe Symons <
philippe.sym...@gmail.com>:

> Hold on, I just noticed the feedback on the curly braces. I'll create a
> new version of the patch to resolve this as well.
>
> Op wo 14 nov. 2018 om 23:49 schreef Philippe Symons <
> philippe.sym...@gmail.com>:
>
>> Hello,
>>
>> I've created a new version of the patch in which the second empty line
>> was removed. I couldn't find any other feedback inline in your response, so
>> that's all I changed.
>>
>> Best regards,
>>
>> Philippe Symons
>>
>>
>> Op di 13 nov. 2018 om 03:29 schreef Liu Steven :
>>
>>>
>>>
>>> > 在 2018年11月13日,上午6:36,Philippe Symons  写道:
>>> >
>>> > Hello everyone,
>>> >
>>> > This is my first patch to FFMpeg or any open-source project for that
>>> > matter. In this patch, I've added the LANGUAGE attribute to the
>>> > #EXT-X-MEDIA tag for for audio only variant streams for HLS streams.
>>> >
>>> > This attribute will be added to the output in
>>> > avformats' ff_hls_write_audio_rendition() function, if the language
>>> code
>>> > can be found in the metadata of the variant stream.
>>> >
>>> > The reason why I implemented this, was because I was working with a
>>> player
>>> > which needs this attribute to determine the language of the audio
>>> stream.
>>> > After asking the question on StackOverflow (
>>> >
>>> https://stackoverflow.com/questions/53205283/ffmpeg-hls-multiple-audio-languages-with-var-stream-map-ext-x-mediatype-doesn/53206492#53206492
>>> ),
>>> > I noticed that it wasn't implemented.
>>> >
>>> > I've tested these changes with the following command:
>>> >
>>> > ffmpeg -re -i /home/philippe/Videos/example.ts -map 0:v -c:v copy -map
>>> 0:a
>>> > -c:a copy -f hls -hls_time 6 -hls_list_size 10 -hls_flags
>>> > delete_segments+program_date_time -hls_segment_filename
>>> > "/var/www/html/live/stream_%v_%d.ts" -var_stream_map "v:0,agroup:lang
>>> > a:0,agroup:lang a:1,agroup:lang a:2,agroup:lang a:
>>> > 3,agroup:lang" -master_pl_name master.m3u8
>>> /var/www/html/live/stream-%v.m3u8
>>> >
>>> > Looking forward to your feedback. I hope it's okay.
>>> >
>>>
>>> Signed-off-by: Philippe Symons 
>>> ---
>>>  libavformat/dashenc.c |  2 +-
>>>  libavformat/hlsenc.c  | 24 ++--
>>>  libavformat/hlsplaylist.c |  6 +-
>>>  libavformat/hlsplaylist.h |  2 +-
>>>  4 files changed, 29 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>>> index f8b3d106d5..ca5ef01e3f 100644
>>> --- a/libavformat/dashenc.c
>>> +++ b/libavformat/dashenc.c
>>> @@ -897,7 +897,7 @@ static int write_manifest(AVFormatContext *s, int
>>> final)
>>>  if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO)
>>>  continue;
>>>  get_hls_playlist_name(playlist_file, sizeof(playlist_file),
>>> NULL, i);
>>> -ff_hls_write_audio_rendition(c->m3u8_out, (char
>>> *)audio_group,
>>> +ff_hls_write_audio_rendition(c->m3u8_out, (char
>>> *)audio_group, NULL,
>>>   playlist_file, i, is_default);
>>>  max_audio_bitrate = FFMAX(st->codecpar->bit_rate +
>>>os->muxer_overhead,
>>> max_audio_bitrate);
>>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>>> index e0048aa9d8..b31daa108e 100644
>>> --- a/libavformat/hlsenc.c
>>> +++ b/libavformat/hlsenc.c
>>> @@ -1205,7 +1205,6 @@ static int create_master_playlist(AVFormatContext
>>> *s,
>>>  }
>>>
>>>  set_http_options(s, , hls);
>>> -
>>>  ret = hlsenc_io_open(s, >m3u8_out, hls->master_m3u8_url,
>>> );
>>>  av_dict_free();
>>>  if (ret < 0) {
>>> @@ -1228,12 +1227,33 @@ static int
>>> create_master_playlist(AVFormatContext *s,
>>>
>>>  /* For audio only variant streams add #EXT-X-MEDIA tag with
>>> attributes*/
>>>  for (i = 0; i < hls->nb_varstreams; i++) {
>>> +AVFormatContext* var_context;
>>> +char* language = NULL;
>>> +
>>>  vs = &(hls->var_streams[i]);
>>> +var_context = vs->avf;
>>>
>>>  if (vs->has_video || vs->has_subtitle || !vs->agroup)
>>>  continue;
>>>
>>>  m3u8_name_size = strlen(vs->m3u8_name) + 1;
>>> +
>>> +/*
>>> + * Try to obtain the language code of the audio stream.
>>> + * -if available- it will be used to write the LANGUAGE
>>> + * attribute in the #EXT-X-MEDIA tag
>>> + */
>>> +if(var_context && var_context->nb_streams > 0)
>>> +{
>>> if (var_context && var_context->nb_streams > 0) {
>>> +AVDictionary* meta_dict = vs->streams[0]->metadata;
>>> +AVDictionaryEntry *langEntry = av_dict_get(meta_dict,
>>> "language", NULL, 0);
>>> +if(langEntry)
>>> +{
>>>  if (langEntry) {
>>> +  

Re: [FFmpeg-devel] [PATCH] configure: Add missing xlib dependency for VAAPI X11 code

2018-11-14 Thread Mark Thompson
On 14/11/18 23:02, James Almer wrote:
> On 11/14/2018 7:59 PM, Mark Thompson wrote:
>> Fixes #7538.
>> ---
>> $ ../configure --disable-vdpau --enable-vaapi
>> ...
>> $ rm libavutil/libavutil.pc ; make libavutil/libavutil.pc ; cat 
>> libavutil/libavutil.pc
>> ...
>>
>> Before:
>> Libs: -L${libdir}  -lavutil -pthread -L/usr/local/lib -lva-drm -lva 
>> -L/usr/local/lib -lva-x11 -lva -lm -L/usr/local/lib -lva
>>
>> After:
>> Libs: -L${libdir}  -lavutil -pthread -L/usr/local/lib -lva-drm -lva 
>> -L/usr/local/lib -lva-x11 -lva -lm -L/usr/local/lib -lva -lXv -lX11 -lXext
>>
>>
>>  configure | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/configure b/configure
>> index b02b4ccb2e..9bc4cf330d 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2815,6 +2815,7 @@ d3d11va_deps="dxva_h ID3D11VideoDecoder 
>> ID3D11VideoContext"
>>  dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
>>  ffnvcodec_deps_any="libdl LoadLibrary"
>>  nvdec_deps="ffnvcodec"
>> +vaapi_x11_deps="xlib"
>>  videotoolbox_hwaccel_deps="videotoolbox pthreads"
>>  videotoolbox_hwaccel_extralibs="-framework QuartzCore"
>>  xvmc_deps="X11_extensions_XvMClib_h"
>>
> 
> LGTM.
> 
> Opening a ticket in libva's repo so they fix their pkg-config files may
> be worth it as well.

I'm not sure there is anything which can usefully be fixed in libva:
* The shared libraries themselves have the right internal linking (DT_NEEDED), 
so they don't need anything extra at link time.
* Static linking libva isn't really supported at all - libva depends on dynamic 
linking, including being able to find its own symbols backwards from a 
dynamically-loaded driver binary.  (It's probably possible by some method 
involving --export-dynamic, though I haven't tried.)

Anyway, applied.  I'll backport to 4.1 as well, since that was where the 
original report came from.

Thanks,

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


Re: [FFmpeg-devel] [PATCH] [HLS] Add LANGUAGE attribute to #EXT-X-MEDIA tag for audio-only variant streams.

2018-11-14 Thread Philippe Symons
Hold on, I just noticed the feedback on the curly braces. I'll create a new
version of the patch to resolve this as well.

Op wo 14 nov. 2018 om 23:49 schreef Philippe Symons <
philippe.sym...@gmail.com>:

> Hello,
>
> I've created a new version of the patch in which the second empty line was
> removed. I couldn't find any other feedback inline in your response, so
> that's all I changed.
>
> Best regards,
>
> Philippe Symons
>
>
> Op di 13 nov. 2018 om 03:29 schreef Liu Steven :
>
>>
>>
>> > 在 2018年11月13日,上午6:36,Philippe Symons  写道:
>> >
>> > Hello everyone,
>> >
>> > This is my first patch to FFMpeg or any open-source project for that
>> > matter. In this patch, I've added the LANGUAGE attribute to the
>> > #EXT-X-MEDIA tag for for audio only variant streams for HLS streams.
>> >
>> > This attribute will be added to the output in
>> > avformats' ff_hls_write_audio_rendition() function, if the language code
>> > can be found in the metadata of the variant stream.
>> >
>> > The reason why I implemented this, was because I was working with a
>> player
>> > which needs this attribute to determine the language of the audio
>> stream.
>> > After asking the question on StackOverflow (
>> >
>> https://stackoverflow.com/questions/53205283/ffmpeg-hls-multiple-audio-languages-with-var-stream-map-ext-x-mediatype-doesn/53206492#53206492
>> ),
>> > I noticed that it wasn't implemented.
>> >
>> > I've tested these changes with the following command:
>> >
>> > ffmpeg -re -i /home/philippe/Videos/example.ts -map 0:v -c:v copy -map
>> 0:a
>> > -c:a copy -f hls -hls_time 6 -hls_list_size 10 -hls_flags
>> > delete_segments+program_date_time -hls_segment_filename
>> > "/var/www/html/live/stream_%v_%d.ts" -var_stream_map "v:0,agroup:lang
>> > a:0,agroup:lang a:1,agroup:lang a:2,agroup:lang a:
>> > 3,agroup:lang" -master_pl_name master.m3u8
>> /var/www/html/live/stream-%v.m3u8
>> >
>> > Looking forward to your feedback. I hope it's okay.
>> >
>>
>> Signed-off-by: Philippe Symons 
>> ---
>>  libavformat/dashenc.c |  2 +-
>>  libavformat/hlsenc.c  | 24 ++--
>>  libavformat/hlsplaylist.c |  6 +-
>>  libavformat/hlsplaylist.h |  2 +-
>>  4 files changed, 29 insertions(+), 5 deletions(-)
>>
>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>> index f8b3d106d5..ca5ef01e3f 100644
>> --- a/libavformat/dashenc.c
>> +++ b/libavformat/dashenc.c
>> @@ -897,7 +897,7 @@ static int write_manifest(AVFormatContext *s, int
>> final)
>>  if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO)
>>  continue;
>>  get_hls_playlist_name(playlist_file, sizeof(playlist_file),
>> NULL, i);
>> -ff_hls_write_audio_rendition(c->m3u8_out, (char
>> *)audio_group,
>> +ff_hls_write_audio_rendition(c->m3u8_out, (char
>> *)audio_group, NULL,
>>   playlist_file, i, is_default);
>>  max_audio_bitrate = FFMAX(st->codecpar->bit_rate +
>>os->muxer_overhead,
>> max_audio_bitrate);
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index e0048aa9d8..b31daa108e 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -1205,7 +1205,6 @@ static int create_master_playlist(AVFormatContext
>> *s,
>>  }
>>
>>  set_http_options(s, , hls);
>> -
>>  ret = hlsenc_io_open(s, >m3u8_out, hls->master_m3u8_url,
>> );
>>  av_dict_free();
>>  if (ret < 0) {
>> @@ -1228,12 +1227,33 @@ static int create_master_playlist(AVFormatContext
>> *s,
>>
>>  /* For audio only variant streams add #EXT-X-MEDIA tag with
>> attributes*/
>>  for (i = 0; i < hls->nb_varstreams; i++) {
>> +AVFormatContext* var_context;
>> +char* language = NULL;
>> +
>>  vs = &(hls->var_streams[i]);
>> +var_context = vs->avf;
>>
>>  if (vs->has_video || vs->has_subtitle || !vs->agroup)
>>  continue;
>>
>>  m3u8_name_size = strlen(vs->m3u8_name) + 1;
>> +
>> +/*
>> + * Try to obtain the language code of the audio stream.
>> + * -if available- it will be used to write the LANGUAGE
>> + * attribute in the #EXT-X-MEDIA tag
>> + */
>> +if(var_context && var_context->nb_streams > 0)
>> +{
>> if (var_context && var_context->nb_streams > 0) {
>> +AVDictionary* meta_dict = vs->streams[0]->metadata;
>> +AVDictionaryEntry *langEntry = av_dict_get(meta_dict,
>> "language", NULL, 0);
>> +if(langEntry)
>> +{
>>  if (langEntry) {
>> +language = langEntry->value;
>> +}
>> +}
>> +
>> +
>>
>> two empty line?
>>  m3u8_rel_name = av_malloc(m3u8_name_size);
>>  if (!m3u8_rel_name) {
>>  ret = AVERROR(ENOMEM);
>> @@ -1247,7 +1267,7 @@ static int create_master_playlist(AVFormatContext
>> *s,
>>  goto fail;
>>  }
>>
>> -

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/cbs_av1: fix parsing signed integer values

2018-11-14 Thread Mark Thompson
On 14/11/18 22:39, James Almer wrote:
> On 11/14/2018 7:24 PM, Mark Thompson wrote:
>> On 11/11/18 02:24, James Almer wrote:
>>> Signed-off-by: James Almer 
>>> ---
>>> See https://0x0.st/sljR.webm
>>>
>>>  libavcodec/cbs_av1.c | 30 +-
>>>  1 file changed, 9 insertions(+), 21 deletions(-)
>>>
>>> diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
>>> index ff32a6fca5..215f9384e8 100644
>>> --- a/libavcodec/cbs_av1.c
>>> +++ b/libavcodec/cbs_av1.c
>>> @@ -189,30 +189,26 @@ static int cbs_av1_read_su(CodedBitstreamContext 
>>> *ctx, GetBitContext *gbc,
>>> int width, const char *name,
>>> const int *subscripts, int32_t *write_to)
>>>  {
>>> -uint32_t magnitude;
>>> -int position, sign;
>>> +int position;
>>>  int32_t value;
>>>  
>>>  if (ctx->trace_enable)
>>>  position = get_bits_count(gbc);
>>>  
>>> -if (get_bits_left(gbc) < width + 1) {
>>> +if (get_bits_left(gbc) < width) {
>>>  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid signed value at "
>>> "%s: bitstream ended.\n", name);
>>>  return AVERROR_INVALIDDATA;
>>>  }
>>>  
>>> -magnitude = get_bits(gbc, width);
>>> -sign  = get_bits1(gbc);
>>> -value = sign ? -(int32_t)magnitude : magnitude;
>>> +value = get_sbits(gbc, width);
>>>  
>>>  if (ctx->trace_enable) {
>>>  char bits[33];
>>>  int i;
>>>  for (i = 0; i < width; i++)
>>> -bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0';
>>> -bits[i] = sign ? '1' : '0';
>>> -bits[i + 1] = 0;
>>> +bits[i] = value >> (width - i - 1) & 1 ? '1' : '0';
>>
>> Not sure if we care, but right-shifting a negative value is 
>> implementation-defined.
> 
> Is casting value to unsigned enough, or should i use something like
> zero_extend()?

I think using left-shift instead is safe:

value & 1 << (...) ? '1' : '0'
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: Add missing xlib dependency for VAAPI X11 code

2018-11-14 Thread James Almer
On 11/14/2018 7:59 PM, Mark Thompson wrote:
> Fixes #7538.
> ---
> $ ../configure --disable-vdpau --enable-vaapi
> ...
> $ rm libavutil/libavutil.pc ; make libavutil/libavutil.pc ; cat 
> libavutil/libavutil.pc
> ...
> 
> Before:
> Libs: -L${libdir}  -lavutil -pthread -L/usr/local/lib -lva-drm -lva 
> -L/usr/local/lib -lva-x11 -lva -lm -L/usr/local/lib -lva
> 
> After:
> Libs: -L${libdir}  -lavutil -pthread -L/usr/local/lib -lva-drm -lva 
> -L/usr/local/lib -lva-x11 -lva -lm -L/usr/local/lib -lva -lXv -lX11 -lXext
> 
> 
>  configure | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/configure b/configure
> index b02b4ccb2e..9bc4cf330d 100755
> --- a/configure
> +++ b/configure
> @@ -2815,6 +2815,7 @@ d3d11va_deps="dxva_h ID3D11VideoDecoder 
> ID3D11VideoContext"
>  dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
>  ffnvcodec_deps_any="libdl LoadLibrary"
>  nvdec_deps="ffnvcodec"
> +vaapi_x11_deps="xlib"
>  videotoolbox_hwaccel_deps="videotoolbox pthreads"
>  videotoolbox_hwaccel_extralibs="-framework QuartzCore"
>  xvmc_deps="X11_extensions_XvMClib_h"
> 

LGTM.

Opening a ticket in libva's repo so they fix their pkg-config files may
be worth it as well.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] configure: Add missing xlib dependency for VAAPI X11 code

2018-11-14 Thread Mark Thompson
Fixes #7538.
---
$ ../configure --disable-vdpau --enable-vaapi
...
$ rm libavutil/libavutil.pc ; make libavutil/libavutil.pc ; cat 
libavutil/libavutil.pc
...

Before:
Libs: -L${libdir}  -lavutil -pthread -L/usr/local/lib -lva-drm -lva 
-L/usr/local/lib -lva-x11 -lva -lm -L/usr/local/lib -lva

After:
Libs: -L${libdir}  -lavutil -pthread -L/usr/local/lib -lva-drm -lva 
-L/usr/local/lib -lva-x11 -lva -lm -L/usr/local/lib -lva -lXv -lX11 -lXext


 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index b02b4ccb2e..9bc4cf330d 100755
--- a/configure
+++ b/configure
@@ -2815,6 +2815,7 @@ d3d11va_deps="dxva_h ID3D11VideoDecoder 
ID3D11VideoContext"
 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
 ffnvcodec_deps_any="libdl LoadLibrary"
 nvdec_deps="ffnvcodec"
+vaapi_x11_deps="xlib"
 videotoolbox_hwaccel_deps="videotoolbox pthreads"
 videotoolbox_hwaccel_extralibs="-framework QuartzCore"
 xvmc_deps="X11_extensions_XvMClib_h"
-- 
2.19.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] [HLS] Add LANGUAGE attribute to #EXT-X-MEDIA tag for audio-only variant streams.

2018-11-14 Thread Philippe Symons
Hello,

I've created a new version of the patch in which the second empty line was
removed. I couldn't find any other feedback inline in your response, so
that's all I changed.

Best regards,

Philippe Symons


Op di 13 nov. 2018 om 03:29 schreef Liu Steven :

>
>
> > 在 2018年11月13日,上午6:36,Philippe Symons  写道:
> >
> > Hello everyone,
> >
> > This is my first patch to FFMpeg or any open-source project for that
> > matter. In this patch, I've added the LANGUAGE attribute to the
> > #EXT-X-MEDIA tag for for audio only variant streams for HLS streams.
> >
> > This attribute will be added to the output in
> > avformats' ff_hls_write_audio_rendition() function, if the language code
> > can be found in the metadata of the variant stream.
> >
> > The reason why I implemented this, was because I was working with a
> player
> > which needs this attribute to determine the language of the audio stream.
> > After asking the question on StackOverflow (
> >
> https://stackoverflow.com/questions/53205283/ffmpeg-hls-multiple-audio-languages-with-var-stream-map-ext-x-mediatype-doesn/53206492#53206492
> ),
> > I noticed that it wasn't implemented.
> >
> > I've tested these changes with the following command:
> >
> > ffmpeg -re -i /home/philippe/Videos/example.ts -map 0:v -c:v copy -map
> 0:a
> > -c:a copy -f hls -hls_time 6 -hls_list_size 10 -hls_flags
> > delete_segments+program_date_time -hls_segment_filename
> > "/var/www/html/live/stream_%v_%d.ts" -var_stream_map "v:0,agroup:lang
> > a:0,agroup:lang a:1,agroup:lang a:2,agroup:lang a:
> > 3,agroup:lang" -master_pl_name master.m3u8
> /var/www/html/live/stream-%v.m3u8
> >
> > Looking forward to your feedback. I hope it's okay.
> >
>
> Signed-off-by: Philippe Symons 
> ---
>  libavformat/dashenc.c |  2 +-
>  libavformat/hlsenc.c  | 24 ++--
>  libavformat/hlsplaylist.c |  6 +-
>  libavformat/hlsplaylist.h |  2 +-
>  4 files changed, 29 insertions(+), 5 deletions(-)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index f8b3d106d5..ca5ef01e3f 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -897,7 +897,7 @@ static int write_manifest(AVFormatContext *s, int
> final)
>  if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO)
>  continue;
>  get_hls_playlist_name(playlist_file, sizeof(playlist_file),
> NULL, i);
> -ff_hls_write_audio_rendition(c->m3u8_out, (char *)audio_group,
> +ff_hls_write_audio_rendition(c->m3u8_out, (char
> *)audio_group, NULL,
>   playlist_file, i, is_default);
>  max_audio_bitrate = FFMAX(st->codecpar->bit_rate +
>os->muxer_overhead,
> max_audio_bitrate);
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index e0048aa9d8..b31daa108e 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1205,7 +1205,6 @@ static int create_master_playlist(AVFormatContext *s,
>  }
>
>  set_http_options(s, , hls);
> -
>  ret = hlsenc_io_open(s, >m3u8_out, hls->master_m3u8_url,
> );
>  av_dict_free();
>  if (ret < 0) {
> @@ -1228,12 +1227,33 @@ static int create_master_playlist(AVFormatContext
> *s,
>
>  /* For audio only variant streams add #EXT-X-MEDIA tag with
> attributes*/
>  for (i = 0; i < hls->nb_varstreams; i++) {
> +AVFormatContext* var_context;
> +char* language = NULL;
> +
>  vs = &(hls->var_streams[i]);
> +var_context = vs->avf;
>
>  if (vs->has_video || vs->has_subtitle || !vs->agroup)
>  continue;
>
>  m3u8_name_size = strlen(vs->m3u8_name) + 1;
> +
> +/*
> + * Try to obtain the language code of the audio stream.
> + * -if available- it will be used to write the LANGUAGE
> + * attribute in the #EXT-X-MEDIA tag
> + */
> +if(var_context && var_context->nb_streams > 0)
> +{
> if (var_context && var_context->nb_streams > 0) {
> +AVDictionary* meta_dict = vs->streams[0]->metadata;
> +AVDictionaryEntry *langEntry = av_dict_get(meta_dict,
> "language", NULL, 0);
> +if(langEntry)
> +{
>  if (langEntry) {
> +language = langEntry->value;
> +}
> +}
> +
> +
>
> two empty line?
>  m3u8_rel_name = av_malloc(m3u8_name_size);
>  if (!m3u8_rel_name) {
>  ret = AVERROR(ENOMEM);
> @@ -1247,7 +1267,7 @@ static int create_master_playlist(AVFormatContext *s,
>  goto fail;
>  }
>
> -ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup,
> m3u8_rel_name, 0, 1);
> +ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, language,
> m3u8_rel_name, 0, 1);
>
>  av_freep(_rel_name);
>  }
> diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c
> index efcbff0009..42c7cf5727 100644
> --- a/libavformat/hlsplaylist.c
> +++ 

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/cbs_av1: fix parsing signed integer values

2018-11-14 Thread James Almer
On 11/14/2018 7:24 PM, Mark Thompson wrote:
> On 11/11/18 02:24, James Almer wrote:
>> Signed-off-by: James Almer 
>> ---
>> See https://0x0.st/sljR.webm
>>
>>  libavcodec/cbs_av1.c | 30 +-
>>  1 file changed, 9 insertions(+), 21 deletions(-)
>>
>> diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
>> index ff32a6fca5..215f9384e8 100644
>> --- a/libavcodec/cbs_av1.c
>> +++ b/libavcodec/cbs_av1.c
>> @@ -189,30 +189,26 @@ static int cbs_av1_read_su(CodedBitstreamContext *ctx, 
>> GetBitContext *gbc,
>> int width, const char *name,
>> const int *subscripts, int32_t *write_to)
>>  {
>> -uint32_t magnitude;
>> -int position, sign;
>> +int position;
>>  int32_t value;
>>  
>>  if (ctx->trace_enable)
>>  position = get_bits_count(gbc);
>>  
>> -if (get_bits_left(gbc) < width + 1) {
>> +if (get_bits_left(gbc) < width) {
>>  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid signed value at "
>> "%s: bitstream ended.\n", name);
>>  return AVERROR_INVALIDDATA;
>>  }
>>  
>> -magnitude = get_bits(gbc, width);
>> -sign  = get_bits1(gbc);
>> -value = sign ? -(int32_t)magnitude : magnitude;
>> +value = get_sbits(gbc, width);
>>  
>>  if (ctx->trace_enable) {
>>  char bits[33];
>>  int i;
>>  for (i = 0; i < width; i++)
>> -bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0';
>> -bits[i] = sign ? '1' : '0';
>> -bits[i + 1] = 0;
>> +bits[i] = value >> (width - i - 1) & 1 ? '1' : '0';
> 
> Not sure if we care, but right-shifting a negative value is 
> implementation-defined.

Is casting value to unsigned enough, or should i use something like
zero_extend()?

> 
>> +bits[i] = 0;
>>  
>>  ff_cbs_trace_syntax_element(ctx, position,
>>  name, subscripts, bits, value);
>> @@ -226,29 +222,21 @@ static int cbs_av1_write_su(CodedBitstreamContext 
>> *ctx, PutBitContext *pbc,
>>  int width, const char *name,
>>  const int *subscripts, int32_t value)
>>  {
>> -uint32_t magnitude;
>> -int sign;
>> -
>> -if (put_bits_left(pbc) < width + 1)
>> +if (put_bits_left(pbc) < width)
>>  return AVERROR(ENOSPC);
>>  
>> -sign  = value < 0;
>> -magnitude = sign ? -value : value;
>> -
>>  if (ctx->trace_enable) {
>>  char bits[33];
>>  int i;
>>  for (i = 0; i < width; i++)
>> -bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0';
>> -bits[i] = sign ? '1' : '0';
>> -bits[i + 1] = 0;
>> +bits[i] = value >> (width - i - 1) & 1 ? '1' : '0';
> 
> And here.
> 
>> +bits[i] = 0;
>>  
>>  ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc),
>>  name, subscripts, bits, value);
>>  }
>>  
>> -put_bits(pbc, width, magnitude);
>> -put_bits(pbc, 1, sign);
>> +put_sbits(pbc, width, value);
>>  
>>  return 0;
>>  }
>>
> 
> Otherwise fine.  No idea where the version with the sign bit at the other end 
> came from; oh well.

From a lack of samples to test and confirm that the code works :p

> 
> Thanks,
> 
> - Mark
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/cbs_av1: fix parsing signed integer values

2018-11-14 Thread Mark Thompson
On 11/11/18 02:24, James Almer wrote:
> Signed-off-by: James Almer 
> ---
> See https://0x0.st/sljR.webm
> 
>  libavcodec/cbs_av1.c | 30 +-
>  1 file changed, 9 insertions(+), 21 deletions(-)
> 
> diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
> index ff32a6fca5..215f9384e8 100644
> --- a/libavcodec/cbs_av1.c
> +++ b/libavcodec/cbs_av1.c
> @@ -189,30 +189,26 @@ static int cbs_av1_read_su(CodedBitstreamContext *ctx, 
> GetBitContext *gbc,
> int width, const char *name,
> const int *subscripts, int32_t *write_to)
>  {
> -uint32_t magnitude;
> -int position, sign;
> +int position;
>  int32_t value;
>  
>  if (ctx->trace_enable)
>  position = get_bits_count(gbc);
>  
> -if (get_bits_left(gbc) < width + 1) {
> +if (get_bits_left(gbc) < width) {
>  av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid signed value at "
> "%s: bitstream ended.\n", name);
>  return AVERROR_INVALIDDATA;
>  }
>  
> -magnitude = get_bits(gbc, width);
> -sign  = get_bits1(gbc);
> -value = sign ? -(int32_t)magnitude : magnitude;
> +value = get_sbits(gbc, width);
>  
>  if (ctx->trace_enable) {
>  char bits[33];
>  int i;
>  for (i = 0; i < width; i++)
> -bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0';
> -bits[i] = sign ? '1' : '0';
> -bits[i + 1] = 0;
> +bits[i] = value >> (width - i - 1) & 1 ? '1' : '0';

Not sure if we care, but right-shifting a negative value is 
implementation-defined.

> +bits[i] = 0;
>  
>  ff_cbs_trace_syntax_element(ctx, position,
>  name, subscripts, bits, value);
> @@ -226,29 +222,21 @@ static int cbs_av1_write_su(CodedBitstreamContext *ctx, 
> PutBitContext *pbc,
>  int width, const char *name,
>  const int *subscripts, int32_t value)
>  {
> -uint32_t magnitude;
> -int sign;
> -
> -if (put_bits_left(pbc) < width + 1)
> +if (put_bits_left(pbc) < width)
>  return AVERROR(ENOSPC);
>  
> -sign  = value < 0;
> -magnitude = sign ? -value : value;
> -
>  if (ctx->trace_enable) {
>  char bits[33];
>  int i;
>  for (i = 0; i < width; i++)
> -bits[i] = magnitude >> (width - i - 1) & 1 ? '1' : '0';
> -bits[i] = sign ? '1' : '0';
> -bits[i + 1] = 0;
> +bits[i] = value >> (width - i - 1) & 1 ? '1' : '0';

And here.

> +bits[i] = 0;
>  
>  ff_cbs_trace_syntax_element(ctx, put_bits_count(pbc),
>  name, subscripts, bits, value);
>  }
>  
> -put_bits(pbc, width, magnitude);
> -put_bits(pbc, 1, sign);
> +put_sbits(pbc, width, value);
>  
>  return 0;
>  }
> 

Otherwise fine.  No idea where the version with the sign bit at the other end 
came from; oh well.

Thanks,

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


Re: [FFmpeg-devel] [PATCH v2] lavf/isom: add Dolby Vision sample entry codes for HEVC and H.264

2018-11-14 Thread Carl Eugen Hoyos
2018-11-14 20:59 GMT+01:00, Jan Ekström :

> So what if I just make a patch without dvh1 that you have
> already implemented, and then we call that a day?

I thought I suggested that but I may misremember.

Sorry, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avcodec/cbs_av1: fix storage size for segmentation_params feature_value fields

2018-11-14 Thread Mark Thompson
On 11/11/18 02:24, James Almer wrote:
> The valid range is -255 to 255.
> 
> Signed-off-by: James Almer 
> ---
>  libavcodec/cbs_av1.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h
> index f662265f75..84622ed189 100644
> --- a/libavcodec/cbs_av1.h
> +++ b/libavcodec/cbs_av1.h
> @@ -210,7 +210,7 @@ typedef struct AV1RawFrameHeader {
>  uint8_t segmentation_temporal_update;
>  uint8_t segmentation_update_data;
>  uint8_t feature_enabled[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
> -uint8_t feature_value[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
> +int16_t feature_value[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX];
>  
>  uint8_t delta_q_present;
>  uint8_t delta_q_res;
> 

Yep, LGTM.

Thanks,

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


[FFmpeg-devel] [PATCH] hevcdec: Fix get_format behaviour when the user declines to pick a format

2018-11-14 Thread Mark Thompson
Maintain the context pixfmt as NONE in this case, indicating that if the
user requests more decoding then get_format() will need to be called again.
Also remove the pixfmt setting from inside set_sps() and make it explicit,
so that the behaviour is clearer.
---
 libavcodec/hevcdec.c | 28 +---
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index a3b5c8cb71..dca478db6c 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -421,8 +421,7 @@ static enum AVPixelFormat get_format(HEVCContext *s, const 
HEVCSPS *sps)
 return ff_thread_get_format(s->avctx, pix_fmts);
 }
 
-static int set_sps(HEVCContext *s, const HEVCSPS *sps,
-   enum AVPixelFormat pix_fmt)
+static int set_sps(HEVCContext *s, const HEVCSPS *sps)
 {
 int ret, i;
 
@@ -439,8 +438,6 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps,
 
 export_stream_params(s->avctx, >ps, sps);
 
-s->avctx->pix_fmt = pix_fmt;
-
 ff_hevc_pred_init(>hpc, sps->bit_depth);
 ff_hevc_dsp_init (>hevcdsp, sps->bit_depth);
 ff_videodsp_init (>vdsp,sps->bit_depth);
@@ -512,7 +509,6 @@ static int hls_slice_header(HEVCContext *s)
 if (s->ps.sps != (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data) {
 const HEVCSPS *sps = (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data;
 const HEVCSPS *last_sps = s->ps.sps;
-enum AVPixelFormat pix_fmt;
 
 if (last_sps && IS_IRAP(s) && s->nal_unit_type != HEVC_NAL_CRA_NUT) {
 if (sps->width != last_sps->width || sps->height != 
last_sps->height ||
@@ -522,17 +518,25 @@ static int hls_slice_header(HEVCContext *s)
 }
 ff_hevc_clear_refs(s);
 
-ret = set_sps(s, sps, sps->pix_fmt);
+ret = set_sps(s, sps);
 if (ret < 0)
 return ret;
 
+s->seq_decode = (s->seq_decode + 1) & 0xff;
+s->max_ra = INT_MAX;
+
+s->avctx->pix_fmt = AV_PIX_FMT_NONE;
+}
+
+if (s->avctx->pix_fmt == AV_PIX_FMT_NONE) {
+const HEVCSPS *sps = (HEVCSPS*)s->ps.sps_list[s->ps.pps->sps_id]->data;
+enum AVPixelFormat pix_fmt;
+
 pix_fmt = get_format(s, sps);
 if (pix_fmt < 0)
-return pix_fmt;
-s->avctx->pix_fmt = pix_fmt;
+return AVERROR(EINVAL);
 
-s->seq_decode = (s->seq_decode + 1) & 0xff;
-s->max_ra = INT_MAX;
+s->avctx->pix_fmt = pix_fmt;
 }
 
 sh->dependent_slice_segment_flag = 0;
@@ -3411,9 +3415,11 @@ static int hevc_update_thread_context(AVCodecContext 
*dst,
 }
 
 if (s->ps.sps != s0->ps.sps)
-if ((ret = set_sps(s, s0->ps.sps, src->pix_fmt)) < 0)
+if ((ret = set_sps(s, s0->ps.sps)) < 0)
 return ret;
 
+dst->pix_fmt = src->pix_fmt;
+
 s->seq_decode = s0->seq_decode;
 s->seq_output = s0->seq_output;
 s->pocTid0= s0->pocTid0;
-- 
2.19.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] ffmpeg: Add option to force a specific decode format

2018-11-14 Thread Mark Thompson
On 14/11/18 01:35, Fu, Linjie wrote:
>> -Original Message-
>> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
>> Of Mark Thompson
>> Sent: Wednesday, November 14, 2018 09:11
>> To: ffmpeg-devel@ffmpeg.org
>> Subject: Re: [FFmpeg-devel] [PATCH v2] ffmpeg: Add option to force a
>> specific decode format
>>
>> On 14/11/18 00:50, Fu, Linjie wrote:
 -Original Message-
 From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On
>> Behalf
 Of Mark Thompson
 Sent: Wednesday, November 14, 2018 07:44
 To: ffmpeg-devel@ffmpeg.org
 Subject: [FFmpeg-devel] [PATCH v2] ffmpeg: Add option to force a
>> specific
 decode format

 Fixes #7519.
 ---
  doc/ffmpeg.texi  | 13 
  fftools/ffmpeg.c | 10 ++
  fftools/ffmpeg.h |  4 
  fftools/ffmpeg_opt.c | 47
 
  4 files changed, 74 insertions(+)

 diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
 index 3717f22d42..d127bc0f0d 100644
 --- a/doc/ffmpeg.texi
 +++ b/doc/ffmpeg.texi
 @@ -920,6 +920,19 @@ would be more efficient.
  When doing stream copy, copy also non-key frames found at the
  beginning.

 +@item -decode_format[:@var{stream_specifier}]
 @var{pixfmt}[,@var{pixfmt}...] (@emph{input,per-stream})
 +Set the possible output formats to be used by the decoder for this
>> stream.
 +If the decoder does not natively support any format in the given list for
 +the input stream then decoding will fail rather than continuing with a
 +different format.
 +
 +In general this should not be set - the decoder will select an output
 +format based on the input stream parameters and available components,
 and
 +that will be automatically converted to whatever the output requires.  It
 +may be useful to force a hardware decoder supporting output in
>> multiple
 +different memory types to pick a desired one, or to ensure that a
>> hardware
 +decoder is used when software fallback is also available.
 +
  @item -init_hw_device
 @var{type}[=@var{name}][:@var{device}[,@var{key=value}...]]
  Initialise a new hardware device of type @var{type} called @var{name},
 using the
  given device parameters.
 diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
 index 38c21e944a..c651c8d3a8 100644
 --- a/fftools/ffmpeg.c
 +++ b/fftools/ffmpeg.c
 @@ -598,6 +598,7 @@ static void ffmpeg_cleanup(int ret)
  avsubtitle_free(>prev_sub.subtitle);
  av_frame_free(>sub2video.frame);
  av_freep(>filters);
 +av_freep(>decode_formats);
  av_freep(>hwaccel_device);
  av_freep(>dts_buffer);

 @@ -2800,6 +2801,15 @@ static enum AVPixelFormat
 get_format(AVCodecContext *s, const enum AVPixelFormat
  const AVCodecHWConfig  *config = NULL;
  int i;

 +if (ist->decode_formats) {
 +for (i = 0; ist->decode_formats[i] != AV_PIX_FMT_NONE; i++) {
 +if (ist->decode_formats[i] == *p)
 +break;
 +}
 +if (ist->decode_formats[i] != *p)
 +continue;
 +}
 +
  if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
  break;

 diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
 index eb1eaf6363..b06fd18b1c 100644
 --- a/fftools/ffmpeg.h
 +++ b/fftools/ffmpeg.h
 @@ -125,6 +125,8 @@ typedef struct OptionsContext {
  intnb_ts_scale;
  SpecifierOpt *dump_attachment;
  intnb_dump_attachment;
 +SpecifierOpt *decode_formats;
 +intnb_decode_formats;
  SpecifierOpt *hwaccels;
  intnb_hwaccels;
  SpecifierOpt *hwaccel_devices;
 @@ -334,6 +336,8 @@ typedef struct InputStream {
  int top_field_first;
  int guess_layout_max;

 +enum AVPixelFormat *decode_formats;
 +
  int autorotate;

  int fix_sub_duration;
 diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
 index d4851a2cd8..63bb05053b 100644
 --- a/fftools/ffmpeg_opt.c
 +++ b/fftools/ffmpeg_opt.c
 @@ -701,6 +701,7 @@ static void add_input_streams(OptionsContext *o,
 AVFormatContext *ic)
  AVStream *st = ic->streams[i];
  AVCodecParameters *par = st->codecpar;
  InputStream *ist = av_mallocz(sizeof(*ist));
 +char *decode_formats = NULL;
  char *framerate = NULL, *hwaccel_device = NULL;
  const char *hwaccel = NULL;
  char *hwaccel_output_format = NULL;
 @@ -797,6 +798,49 @@ static void add_input_streams(OptionsContext
>> *o,
 AVFormatContext *ic)
  ist->top_field_first = -1;
  

[FFmpeg-devel] [PATCH v2] hwcontext_vaapi: Add option to set driver name

2018-11-14 Thread Mark Thompson
For example: -init_hw_device vaapi:/dev/dri/renderD128,driver=foo

This may be more convenient that using the environment variable, and allows
loading different drivers for different devices in the same process.
---
On 14/11/18 12:05, Michael Niedermayer wrote:
> On Wed, Nov 14, 2018 at 12:21:07AM +, Mark Thompson wrote:
>> ...
>> +vas = vaSetDriverName(display, driver->value);
> 
> this breaks build here on ubuntu:
> 
> CClibavutil/hwcontext_vaapi.o
> libavutil/hwcontext_vaapi.c: In function ‘vaapi_device_create’:
> libavutil/hwcontext_vaapi.c:1537:9: error: implicit declaration of function 
> ‘vaSetDriverName’ [-Werror=implicit-function-declaration]
>  vas = vaSetDriverName(display, driver->value);
>  ^
> cc1: some warnings being treated as errors
> make: *** [libavutil/hwcontext_vaapi.o] Error 1
> make: Target `all' not remade because of errors.

Ah, apologies - that API is newer than I thought.

Here's a new version with suitable guards.

Thanks,

- Mark


 libavutil/hwcontext_vaapi.c | 20 
 1 file changed, 20 insertions(+)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 8624369bb9..4a4ecc44d7 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -1469,6 +1469,7 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, 
const char *device,
 {
 VAAPIDevicePriv *priv;
 VADisplay display = NULL;
+const AVDictionaryEntry *driver;
 
 priv = av_mallocz(sizeof(*priv));
 if (!priv)
@@ -1530,6 +1531,25 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, 
const char *device,
 return AVERROR(EINVAL);
 }
 
+driver = av_dict_get(opts, "driver", NULL, 0);
+if (driver) {
+#if VA_CHECK_VERSION(0, 38, 0)
+VAStatus vas;
+vas = vaSetDriverName(display, driver->value);
+if (vas != VA_STATUS_SUCCESS) {
+av_log(ctx, AV_LOG_ERROR, "Failed to set driver name to "
+   "%s: %d (%s).\n", driver->value, vas, vaErrorStr(vas));
+vaTerminate(display);
+return AVERROR_UNKNOWN;
+}
+#else
+av_log(ctx, AV_LOG_WARNING, "Driver name setting is not "
+   "supported with this VAAPI version.\n");
+vaTerminate(display);
+return AVERROR(ENOSYS);
+#endif
+}
+
 return vaapi_device_connect(ctx, display);
 }
 
-- 
2.19.1
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/libvpxenc: add VP8 temporal scalability configuration options

2018-11-14 Thread Ard Oerlemans
This commit adds configuration options to libvpxenc.c that can be used to
enable VP8 temporal scalability. It also adds a way to programmatically set the
per-frame encoding flags which can be used to control usage and updates of
reference frames while encoding with temporal scalability enabled.
---
 doc/encoders.texi  | 28 +++
 libavcodec/libvpxenc.c | 81 ++
 2 files changed, 109 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index c9464ca7b3..39c3830dd5 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1655,6 +1655,34 @@ Set number of frames to look ahead for frametype and 
ratecontrol.
 @item error-resilient
 Enable error resiliency features.
 
+@item VP8-specific options
+@table @option
+@item ts-parameters
+Sets the temporal scalability configuration using a :-separated list of
+key=value pairs. For example, to specify temporal scalability parameters
+with @code{ffmpeg}:
+@example
+ffmpeg -i INPUT -c:v libvpx -ts-parameters ts_number_layers=3:\
+ts_target_bitrate=25,50,100:ts_rate_decimator=4,2,1:\
+ts_periodicity=4:ts_layer_id=0,2,1,2 OUTPUT
+@end example
+Below is a brief explanation of each of the parameters, please
+refer to @code{struct vpx_codec_enc_cfg} in @code{vpx/vpx_encoder.h} for more
+details.
+@table @option
+@item ts_number_layers
+Number of temporal coding layers.
+@item ts_target_bitrate
+Target bitrate for each temporal layer.
+@item ts_rate_decimator
+Frame rate decimation factor for each temporal layer.
+@item ts_periodicity
+Length of the sequence defining frame temporal layer membership.
+@item ts_layer_id
+Template defining the membership of frames to temporal layers.
+@end table
+@end table
+
 @item VP9-specific options
 @table @option
 @item lossless
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index ad440a9c21..774fda457e 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -33,6 +33,7 @@
 #include "libavutil/avassert.h"
 #include "libvpx.h"
 #include "profiles.h"
+#include "libavutil/avstring.h"
 #include "libavutil/base64.h"
 #include "libavutil/common.h"
 #include "libavutil/internal.h"
@@ -98,6 +99,8 @@ typedef struct VPxEncoderContext {
 int rc_undershoot_pct;
 int rc_overshoot_pct;
 
+char *vp8_ts_parameters;
+
 // VP9-only
 int lossless;
 int tile_columns;
@@ -169,6 +172,7 @@ static av_cold void dump_enc_cfg(AVCodecContext *avctx,
 {
 int width = -30;
 int level = AV_LOG_DEBUG;
+int i;
 
 av_log(avctx, level, "vpx_codec_enc_cfg\n");
 av_log(avctx, level, "generic settings\n"
@@ -208,6 +212,25 @@ static av_cold void dump_enc_cfg(AVCodecContext *avctx,
"  %*s%u\n  %*s%u\n",
width, "rc_undershoot_pct:", cfg->rc_undershoot_pct,
width, "rc_overshoot_pct:",  cfg->rc_overshoot_pct);
+av_log(avctx, level, "temporal layering settings\n"
+   "  %*s%u\n", width, "ts_number_layers:", cfg->ts_number_layers);
+av_log(avctx, level,
+   "\n  %*s", width, "ts_target_bitrate:");
+for (i = 0; i < VPX_TS_MAX_LAYERS; i++)
+av_log(avctx, level, "%u ", cfg->ts_target_bitrate[i]);
+av_log(avctx, level, "\n");
+av_log(avctx, level,
+   "\n  %*s", width, "ts_rate_decimator:");
+for (i = 0; i < VPX_TS_MAX_LAYERS; i++)
+av_log(avctx, level, "%u ", cfg->ts_rate_decimator[i]);
+av_log(avctx, level, "\n");
+av_log(avctx, level,
+   "\n  %*s%u\n", width, "ts_periodicity:", cfg->ts_periodicity);
+av_log(avctx, level,
+   "\n  %*s", width, "ts_layer_id:");
+for (i = 0; i < VPX_TS_MAX_PERIODICITY; i++)
+av_log(avctx, level, "%u ", cfg->ts_layer_id[i]);
+av_log(avctx, level, "\n");
 av_log(avctx, level, "decoder buffer model\n"
 "  %*s%u\n  %*s%u\n  %*s%u\n",
 width, "rc_buf_sz:", cfg->rc_buf_sz,
@@ -325,6 +348,40 @@ static av_cold int vpx_free(AVCodecContext *avctx)
 return 0;
 }
 
+static void vp8_ts_parse_int_array(int *dest, char *value, size_t value_len, 
int max_entries)
+{
+int dest_idx = 0;
+char *saveptr = NULL;
+char *token = av_strtok(value, ",", );
+
+while (token && dest_idx < max_entries)
+{
+dest[dest_idx++] = strtoul(token, NULL, 10);
+token = av_strtok(NULL, ",", );
+}
+}
+
+static int vp8_ts_param_parse(struct vpx_codec_enc_cfg *enccfg, char *key, 
char *value)
+{
+size_t value_len = strlen(value);
+
+if (!value_len)
+return -1;
+
+if (!strcmp(key, "ts_number_layers"))
+enccfg->ts_number_layers = strtoul(value, , 10);
+else if (!strcmp(key, "ts_target_bitrate"))
+vp8_ts_parse_int_array(enccfg->ts_target_bitrate, value, value_len, 
VPX_TS_MAX_LAYERS);
+else if (!strcmp(key, "ts_rate_decimator"))
+  vp8_ts_parse_int_array(enccfg->ts_rate_decimator, value, value_len, 
VPX_TS_MAX_LAYERS);
+else if (!strcmp(key, "ts_periodicity"))
+

Re: [FFmpeg-devel] [PATCH] avcodec/vc1: correct aspect ratio calculation

2018-11-14 Thread Michael Niedermayer
Hi

On Wed, Nov 14, 2018 at 10:57:25AM +0100, Jerome Borsboom wrote:
> According to VC-1 spec:
> * Display size defaults to max coded size when not explicitly set in
> sequence header
> * Aspect ratio in the sequence header refers to the Display size elements.
> Therefore, the aspect ratio for the coded samples (SAR) needs to take into
> account the scaling from coded size to display size, and the aspect ratio
> of the display size elements.
> 
> Signed-off-by: Jerome Borsboom 
> ---
> VC-1 spec assumes that the output of the decoder, i.e. the pixel matrix with
> dimensions coded_width x coded_height, is scaled to display size, i.e. a pixel
> matrix of display_horiz_size x display_vert_size. This may introduce part of
> the sample aspect ratio when the sizes of the two pixel matrices are not 
> equal.
> A further part of the sample aspect ratio is optionally specified in the 
> sequence
> header as the aspect ratio of the display size pixels. This patch takes both
> aspect ratios into account and aims to be correct even when the coded image
> includes overscan regions.
> 
>  libavcodec/vc1.c | 38 +-
>  libavcodec/vc1.h |  2 ++
>  2 files changed, 23 insertions(+), 17 deletions(-)
> 
> diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
> index 3581d87b57..efc6edc4b0 100644
> --- a/libavcodec/vc1.c
> +++ b/libavcodec/vc1.c
> @@ -442,30 +442,24 @@ static int decode_sequence_header_adv(VC1Context *v, 
> GetBitContext *gb)
>  }
>  v->s.max_b_frames = v->s.avctx->max_b_frames = 7;
>  if (get_bits1(gb)) { //Display Info - decoding is not affected by it
> -int w, h, ar = 0;
> +int ar = 0;
>  av_log(v->s.avctx, AV_LOG_DEBUG, "Display extended info:\n");
> -w = get_bits(gb, 14) + 1;
> -h = get_bits(gb, 14) + 1;
> -av_log(v->s.avctx, AV_LOG_DEBUG, "Display dimensions: %ix%i\n", w, 
> h);
> +v->disp_horiz_size = get_bits(gb, 14) + 1;
> +v->disp_vert_size = get_bits(gb, 14) + 1;
> +av_log(v->s.avctx, AV_LOG_DEBUG, "Display dimensions: %ix%i\n",
> +   v->disp_horiz_size, v->disp_vert_size);
>  if (get_bits1(gb))
>  ar = get_bits(gb, 4);
>  if (ar && ar < 14) {
> -v->s.avctx->sample_aspect_ratio = ff_vc1_pixel_aspect[ar];
> +v->aspect_ratio = ff_vc1_pixel_aspect[ar];
>  } else if (ar == 15) {

> -w = get_bits(gb, 8) + 1;
> -h = get_bits(gb, 8) + 1;
> -v->s.avctx->sample_aspect_ratio = (AVRational){w, h};

> +v->aspect_ratio = (AVRational){get_bits(gb, 8) + 1, get_bits(gb, 
> 8) + 1};

iam not sure this is valid C and not undefined

but either way this patch breaks fate

TESTvc1-ism
--- ./tests/ref/fate/vc1-ism2018-11-13 19:52:23.489023763 +0100
+++ tests/data/fate/vc1-ism 2018-11-14 21:50:11.522992878 +0100
@@ -2,7 +2,7 @@
 #media_type 0: video
 #codec_id 0: rawvideo
 #dimensions 0: 240x104
-#sar 0: 156/156
+#sar 0: 13/30
 0,  0,  0,1,37440, 0xd1bc5235
 0,  2,  2,1,37440, 0x158e6167
 0,  3,  3,1,37440, 0x0faa4481
Test vc1-ism failed. Look at tests/data/fate/vc1-ism.err for details.
make: *** [fate-vc1-ism] Error 1


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

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


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


[FFmpeg-devel] [PATCH 1/1] avcodec/vaapi_encode: add frame-skip func

2018-11-14 Thread Jing SUN
frame-skip is required to implement network
bandwidth self-adaptive vaapi encoding.
To make a frame skipped, allocate its frame
side data of AV_FRAME_DATA_SKIP_FRAME type
and set its value to 1.

Signed-off-by: Jing SUN 
---
 libavcodec/vaapi_encode.c | 132 --
 libavcodec/vaapi_encode.h |   5 ++
 libavutil/frame.c |   1 +
 libavutil/frame.h |   5 ++
 4 files changed, 139 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 2fe8501..ea06404 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -23,6 +23,7 @@
 #include "libavutil/common.h"
 #include "libavutil/log.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/intreadwrite.h"
 
 #include "vaapi_encode.h"
 #include "avcodec.h"
@@ -103,6 +104,47 @@ static int vaapi_encode_make_param_buffer(AVCodecContext 
*avctx,
 return 0;
 }
 
+static int vaapi_encode_check_if_skip(AVCodecContext *avctx,
+  VAAPIEncodePicture *pic)
+{
+AVFrameSideData *fside = NULL;
+VAAPIEncodeContext *ctx = avctx->priv_data;
+VAAPIEncodePicture *cur = NULL;
+int i = 0;
+
+if (!pic || !pic->input_image)
+return AVERROR(EINVAL);
+
+fside = av_frame_get_side_data(pic->input_image, AV_FRAME_DATA_SKIP_FRAME);
+if (fside)
+pic->skipped_flag = AV_RL8(fside->data);
+else
+pic->skipped_flag = 0;
+
+if (0 == pic->skipped_flag)
+return 0;
+
+if ((pic->type == PICTURE_TYPE_IDR) || (pic->type == PICTURE_TYPE_I)) {
+av_log(avctx, AV_LOG_INFO, "Can't skip IDR/I pic 
%"PRId64"/%"PRId64".\n",
+   pic->display_order, pic->encode_order);
+pic->skipped_flag = 0;
+return 0;
+}
+
+for (cur = ctx->pic_start; cur; cur = cur->next) {
+for (i=0; i < cur->nb_refs; ++i) {
+if (cur->refs[i] == pic) {
+av_log(avctx, AV_LOG_INFO, "Can't skip ref pic 
%"PRId64"/%"PRId64".\n",
+   pic->display_order, pic->encode_order);
+pic->skipped_flag = 0;
+return 0;
+}
+}
+}
+
+return 0;
+}
+
 static int vaapi_encode_wait(AVCodecContext *avctx,
  VAAPIEncodePicture *pic)
 {
@@ -418,6 +460,59 @@ static int vaapi_encode_issue(AVCodecContext *avctx,
 }
 }
 
+err = vaapi_encode_check_if_skip(avctx, pic);
+if (err != 0)
+av_log(avctx, AV_LOG_ERROR, "Fail to check if skip.\n");
+
+if (pic->skipped_flag) {
+av_log(avctx, AV_LOG_INFO, "Skip pic %"PRId64"/%"PRId64" as 
requested.\n",
+   pic->display_order, pic->encode_order);
+
+++ctx->skipped_pic_count;
+pic->encode_issued = 1;
+
+return 0;
+} else if (ctx->skipped_pic_count > 0) {
+VABufferID skip_param_id;
+VAEncMiscParameterBuffer *misc_param;
+VAEncMiscParameterSkipFrame *skip_param;
+
+err = vaapi_encode_make_param_buffer(avctx, pic,
+  VAEncMiscParameterBufferType, NULL,
+  (sizeof(VAEncMiscParameterBuffer) +
+  sizeof(VAEncMiscParameterSkipFrame)));
+if (err < 0)
+goto fail;
+
+skip_param_id = pic->param_buffers[pic->nb_param_buffers-1];
+
+vas = vaMapBuffer(ctx->hwctx->display,
+  skip_param_id,
+  (void **)_param);
+if (vas != VA_STATUS_SUCCESS) {
+av_log(avctx, AV_LOG_ERROR, "Failed to map skip-frame buffer: "
+   "%d (%s).\n", vas, vaErrorStr(vas));
+err = AVERROR(EIO);
+goto fail;
+}
+
+misc_param->type = 
(VAEncMiscParameterType)VAEncMiscParameterTypeSkipFrame;
+skip_param = (VAEncMiscParameterSkipFrame *)misc_param->data;
+skip_param->skip_frame_flag = 1;
+skip_param->num_skip_frames = ctx->skipped_pic_count;
+skip_param->size_skip_frames = 0;
+
+vas = vaUnmapBuffer(ctx->hwctx->display, skip_param_id);
+if (vas != VA_STATUS_SUCCESS) {
+av_log(avctx, AV_LOG_ERROR, "Failed to unmap skip-frame buffer: "
+   "%d (%s).\n", vas, vaErrorStr(vas));
+err = AVERROR(EIO);
+goto fail;
+}
+
+ctx->skipped_pic_count = 0;
+}
+
 vas = vaBeginPicture(ctx->hwctx->display, ctx->va_context,
  pic->input_surface);
 if (vas != VA_STATUS_SUCCESS) {
@@ -500,9 +595,28 @@ static int vaapi_encode_output(AVCodecContext *avctx,
 VAStatus vas;
 int err;
 
-err = vaapi_encode_wait(avctx, pic);
-if (err < 0)
-return err;
+if (!pic->skipped_flag) {
+err = vaapi_encode_wait(avctx, pic);
+if (err < 0)
+return err;
+} else {
+av_frame_free(>input_image);
+pic->encode_complete = 1;
+
+err = av_new_packet(pkt, 0);
+if (err < 0)
+ 

Re: [FFmpeg-devel] [PATCH v2] lavf/isom: add Dolby Vision sample entry codes for HEVC and H.264

2018-11-14 Thread Jan Ekström
On Sat, Nov 10, 2018 at 3:36 PM Carl Eugen Hoyos  wrote:
>
> 2018-11-08 17:34 GMT+01:00, Jan Ekström :
>
> > Then regarding the rest. Do I understand correctly that you do
> > not trust dolby's specification and/or mpeg-4 ra and would only
> > like identifiers be added that have been seen in the wild?
>
> This is not trust-related, I simply believe this patch is good
> example for why patches should be tested with samples.
>
> Carl Eugen

So far:
  - 2/4 identifiers have been proven to match the darn specification
regarding the sample identifier and the fact that the standard decoder
initialization box is in there. I dislike Dolby as much as the other
person, but this is so far a good track record and given the wording
of the specification I would tend to trust it.
  - VLC has added these identifiers
(http://git.videolan.org/?p=vlc.git;a=commit;h=dbb0f6c7353aad4cbbb14d88f9409c8419c26bcd)
  - Chromium has added these identifiers
(https://codereview.chromium.org/2640113004/ - it goes to a separate
codec on their side since they just want to pass it to the specific
decoder interfaces that can handle the profiles fully instead of
actually decoding them themselves).

So what if I just make a patch without dvh1 that you have already
implemented, and then we call that a day?

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


Re: [FFmpeg-devel] [PATCH 1/2] lavu: add locale-independent sscanf implementation

2018-11-14 Thread Paul B Mahol
On 11/12/18, Paul B Mahol  wrote:
> Copied and adopted from musl implementation.
>  * converted all 'long double' to 'double'
>  * removed %m support
>
> Signed-off-by: Paul B Mahol 
> ---
>  libavutil/Makefile   |   1 +
>  libavutil/avsscanf.c | 971 +++
>  libavutil/avstring.c |   1 +
>  libavutil/avstring.h |   6 +
>  4 files changed, 979 insertions(+)
>  create mode 100644 libavutil/avsscanf.c

If there are no strong opinions against this patch set i will apply it
and work on converting more code to av_sscanf().
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/dashenc: set FLAC manifest codec string to "flac"

2018-11-14 Thread Jan Ekström
On Wed, Nov 14, 2018 at 11:55 AM Paul B Mahol  wrote:
>
> On 11/14/18, Jan Ekström  wrote:
> > Internally in ISOBMFF the FLAC-in-ISOBMFF draft uses the "fLaC"
> > as the identifier for FLACSampleEntry, but what the browsers
> > seem to eat for MPEG-DASH manifests is plain "flac".
> >
> > Verified by auri_ on IRC to play with the major browsers.
> > ---
> >  libavformat/dashenc.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
>
> lgtm

Thanks.

Applied with an improved commit message that I think explains the
situation with regards to unavailability of a specification for this
value utilized in the MPEG-DASH manifest.

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


Re: [FFmpeg-devel] [PATCH] avcodec/vc1: correct aspect ratio calculation

2018-11-14 Thread Carl Eugen Hoyos
2018-11-14 17:16 GMT+01:00, Jerome Borsboom :
>>> +av_reduce(>sample_aspect_ratio.num,
>>> +  >sample_aspect_ratio.den,
>>> +  v->disp_horiz_size * v->aspect_ratio.num * h,
>>> +  v->disp_vert_size * v->aspect_ratio.den * w,
>>> +  1 << 30);
>>
>>> +ff_set_sar(avctx, avctx->sample_aspect_ratio);
>>
>> I would have expected these two statements to be redundant -
>> am I wrong?

> av_reduce takes out the greatest common divisor and puts a bound on the
> individual fraction numbers. ff_set_sar checks that the SAR makes sense
> in relation to the image size. Although, the code is reassigning
> avctx->sample_aspect_ratio to itself in ff_set_sar, the different checks
> make both statements necessary.

Thank you!

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


[FFmpeg-devel] [PATCH] web/index: add news entry for release 4.1

2018-11-14 Thread James Almer
Signed-off-by: James Almer 
---
 src/index | 50 ++
 1 file changed, 50 insertions(+)

diff --git a/src/index b/src/index
index bbfca29..0dcf6c1 100644
--- a/src/index
+++ b/src/index
@@ -37,6 +37,56 @@
 News
   
 
+  November 6th, 2018, FFmpeg 4.1 "al-Khwarizmi"
+  
+FFmpeg 4.1 "al-Khwarizmi", a new
+major release, is now available! Some of the highlights:
+  
+  
+deblock filter
+tmix filter
+amplify filter
+fftdnoiz filter
+aderivative and aintegral audio filters
+pal75bars and pal100bars video filter sources
+mbedTLS based TLS support
+adeclick and adeclip filters
+libtensorflow backend for DNN based filters like srcnn
+VC1 decoder is now bit-exact
+ATRAC9 decoder
+lensfun wrapper filter
+colorconstancy filter
+AVS2 video decoder via libdavs2
+IMM4 video decoder
+Brooktree ProSumer video decoder
+MatchWare Screen Capture Codec decoder
+WinCam Motion Video decoder
+1D LUT filter (lut1d)
+RemotelyAnywhere Screen Capture decoder
+cue and acue filters
+Support for AV1 in MP4 and Matroska/WebM
+transpose_npp filter
+AVS2 video encoder via libxavs2
+amultiply filter
+Block-Matching 3d (bm3d) denoising filter
+acrossover filter
+ilbc decoder
+audio denoiser as afftdn filter
+AV1 parser
+sinc audio filter source
+chromahold filter
+setparams filter
+vibrance filter
+S12M timecode decoding in h264
+xstack filter
+(a)graphmonitor filter
+yadif_cuda filter
+  
+  
+We strongly recommend users, distributors, and system integrators to
+upgrade unless they use current git master.
+  
+
   April 20th, 2018, FFmpeg 4.0 "Wu"
   
 FFmpeg 4.0 "Wu", a new
-- 
2.19.1

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


Re: [FFmpeg-devel] [PATCH] avcodec/vc1: correct aspect ratio calculation

2018-11-14 Thread Jerome Borsboom
>> +av_reduce(>sample_aspect_ratio.num,
>> +  >sample_aspect_ratio.den,
>> +  v->disp_horiz_size * v->aspect_ratio.num * h,
>> +  v->disp_vert_size * v->aspect_ratio.den * w,
>> +  1 << 30);
> 
>> +ff_set_sar(avctx, avctx->sample_aspect_ratio);
> 
> I would have expected these two statements to be redundant -
> am I wrong?
> 
> Carl Eugen

I am not fully sure that I understand your comment.

av_reduce takes out the greatest common divisor and puts a bound on the
individual fraction numbers. ff_set_sar checks that the SAR makes sense
in relation to the image size. Although, the code is reassigning
avctx->sample_aspect_ratio to itself in ff_set_sar, the different checks
make both statements necessary. In addition, the large values that
results from 'v->disp_horiz_size * v->aspect_ratio.num * h' and
'v->disp_vert_size * v->aspect_ratio.den * w', can in most cases be
efficiently reduced.

These two statements are moved to the entrypoint parser, because the
coded size is an entrypoint element. At the position where the av_reduce
statement was previously located, the v->s.avctx->height and
v->s.avctx->width could contain values from the previous entrypoint
header or be zero when parsing the first sequence header.


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


Re: [FFmpeg-devel] [PATCH] lavf/dashenc: set FLAC manifest codec string to "flac"

2018-11-14 Thread Jan Ekström
On Wed, Nov 14, 2018, 17:22 Carl Eugen Hoyos  2018-11-14 2:21 GMT+01:00, Jan Ekström :
> > Internally in ISOBMFF the FLAC-in-ISOBMFF draft uses the "fLaC"
> > as the identifier for FLACSampleEntry, but what the browsers
> > seem to eat for MPEG-DASH manifests is plain "flac".
>
> Does this patch also answer the recent discussion about
> specifications vs real-world tests?
>

No.

The ISOBMFF side is followed properly, and nobody cared to test flac until
now with dash manifests. The default code path utilizes the ISOBMFF
identifier for dash manifest entries, which matches things such as
avc/hevc/aac etc.

Not to mention that there doesn't seem to be a spec for the dash manifest
side of things for flac. At all. It just seems to follow the mime type.

So no, this is not the same thing. At all.

Jan

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


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/libdav1d: fix build after a recent API break

2018-11-14 Thread James Almer
On 11/14/2018 12:38 PM, Nicolas George wrote:
> James Almer (2018-11-14):
>> -res = dav1d_decode(dav1d->c, data, );
>> +res = dav1d_send_data(dav1d->c, data);
>> +if (res < 0) {
>> +if (res == -EINVAL)
>> +res = AVERROR_INVALIDDATA;
>> +if (res != -EAGAIN)
>> +return res;
>> +}
>> +
>> +res = dav1d_get_picture(dav1d->c, );
> 
> I just noticed this: the lack of AVERROR() looks very suspicious. It
> seems this library uses directly -errno values, which will coincide with
> AVERROR() on most systems but not all.
> 
> Regards,

I considered that, but I don't think libdav1d is supported on systems
where errno values are already negated, as every single one of their
internal error checks would fail. So it's probably safe to do this.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/libdav1d: fix build after a recent API break

2018-11-14 Thread Nicolas George
James Almer (2018-11-14):
> -res = dav1d_decode(dav1d->c, data, );
> +res = dav1d_send_data(dav1d->c, data);
> +if (res < 0) {
> +if (res == -EINVAL)
> +res = AVERROR_INVALIDDATA;
> +if (res != -EAGAIN)
> +return res;
> +}
> +
> +res = dav1d_get_picture(dav1d->c, );

I just noticed this: the lack of AVERROR() looks very suspicious. It
seems this library uses directly -errno values, which will coincide with
AVERROR() on most systems but not all.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/libdav1d: fix build after a recent API break

2018-11-14 Thread Carl Eugen Hoyos
2018-11-14 16:19 GMT+01:00, James Almer :
> On 11/14/2018 12:03 PM, Carl Eugen Hoyos wrote:
>> 2018-11-14 14:06 GMT+01:00, James Almer :
>>> ffmpeg | branch: master | James Almer  | Wed Nov 14
>>> 10:05:25 2018 -0300| [752659327d4ac73640781376d214a26765f971f4] |
>>> committer:
>>> James Almer
>>>
>>> avcodec/libdav1d: fix build after a recent API break
>>>
>>> Signed-off-by: James Almer 
>>>
 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=752659327d4ac73640781376d214a26765f971f4
>>> ---
>>>
>>>  libavcodec/libdav1d.c | 12 +---
>>>  1 file changed, 9 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
>>> index 873adfda40..b19aee4e9e 100644
>>> --- a/libavcodec/libdav1d.c
>>> +++ b/libavcodec/libdav1d.c
>>> @@ -140,12 +140,18 @@ static int libdav1d_receive_frame(AVCodecContext
>>> *c,
>>> AVFrame *frame)
>>>  }
>>>
>>>  av_fifo_generic_write(dav1d->cache, , sizeof(pkt),
>>> libdav1d_fifo_write);
>>> -} else {
>>> -data = NULL;
>>>  }
>>>  }
>>>
>>> -res = dav1d_decode(dav1d->c, data, );
>>> +res = dav1d_send_data(dav1d->c, data);
>>> +if (res < 0) {
>>> +if (res == -EINVAL)
>>> +res = AVERROR_INVALIDDATA;
>>
>>> +if (res != -EAGAIN)
>>
>> How does this line make sense?
>
> We're meant to keep going and fetch decoded frames even if the library
> refuses new data. Eventually it will consume it once its internal data
> buffer is depleted.
>
> We're only mean to abort on other errno values, like -EINVAL (Which for
> ffmpeg is AVERROR_INVALIDDATA).

Thank you!

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


Re: [FFmpeg-devel] [PATCH] lavf/dashenc: set FLAC manifest codec string to "flac"

2018-11-14 Thread Carl Eugen Hoyos
2018-11-14 2:21 GMT+01:00, Jan Ekström :
> Internally in ISOBMFF the FLAC-in-ISOBMFF draft uses the "fLaC"
> as the identifier for FLACSampleEntry, but what the browsers
> seem to eat for MPEG-DASH manifests is plain "flac".

Does this patch also answer the recent discussion about
specifications vs real-world tests?

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


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/libdav1d: fix build after a recent API break

2018-11-14 Thread James Almer
On 11/14/2018 12:03 PM, Carl Eugen Hoyos wrote:
> 2018-11-14 14:06 GMT+01:00, James Almer :
>> ffmpeg | branch: master | James Almer  | Wed Nov 14
>> 10:05:25 2018 -0300| [752659327d4ac73640781376d214a26765f971f4] | committer:
>> James Almer
>>
>> avcodec/libdav1d: fix build after a recent API break
>>
>> Signed-off-by: James Almer 
>>
>>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=752659327d4ac73640781376d214a26765f971f4
>> ---
>>
>>  libavcodec/libdav1d.c | 12 +---
>>  1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
>> index 873adfda40..b19aee4e9e 100644
>> --- a/libavcodec/libdav1d.c
>> +++ b/libavcodec/libdav1d.c
>> @@ -140,12 +140,18 @@ static int libdav1d_receive_frame(AVCodecContext *c,
>> AVFrame *frame)
>>  }
>>
>>  av_fifo_generic_write(dav1d->cache, , sizeof(pkt),
>> libdav1d_fifo_write);
>> -} else {
>> -data = NULL;
>>  }
>>  }
>>
>> -res = dav1d_decode(dav1d->c, data, );
>> +res = dav1d_send_data(dav1d->c, data);
>> +if (res < 0) {
>> +if (res == -EINVAL)
>> +res = AVERROR_INVALIDDATA;
> 
>> +if (res != -EAGAIN)
> 
> How does this line make sense?

We're meant to keep going and fetch decoded frames even if the library
refuses new data. Eventually it will consume it once its internal data
buffer is depleted.

We're only mean to abort on other errno values, like -EINVAL (Which for
ffmpeg is AVERROR_INVALIDDATA).

> 
>> +return res;
> 
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

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


Re: [FFmpeg-devel] [PATCH] avcodec/vc1: correct aspect ratio calculation

2018-11-14 Thread Carl Eugen Hoyos
2018-11-14 10:57 GMT+01:00, Jerome Borsboom :

> +av_reduce(>sample_aspect_ratio.num,
> +  >sample_aspect_ratio.den,
> +  v->disp_horiz_size * v->aspect_ratio.num * h,
> +  v->disp_vert_size * v->aspect_ratio.den * w,
> +  1 << 30);

> +ff_set_sar(avctx, avctx->sample_aspect_ratio);

I would have expected these two statements to be redundant -
am I wrong?

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


Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/libdav1d: fix build after a recent API break

2018-11-14 Thread Carl Eugen Hoyos
2018-11-14 14:06 GMT+01:00, James Almer :
> ffmpeg | branch: master | James Almer  | Wed Nov 14
> 10:05:25 2018 -0300| [752659327d4ac73640781376d214a26765f971f4] | committer:
> James Almer
>
> avcodec/libdav1d: fix build after a recent API break
>
> Signed-off-by: James Almer 
>
>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=752659327d4ac73640781376d214a26765f971f4
> ---
>
>  libavcodec/libdav1d.c | 12 +---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
> index 873adfda40..b19aee4e9e 100644
> --- a/libavcodec/libdav1d.c
> +++ b/libavcodec/libdav1d.c
> @@ -140,12 +140,18 @@ static int libdav1d_receive_frame(AVCodecContext *c,
> AVFrame *frame)
>  }
>
>  av_fifo_generic_write(dav1d->cache, , sizeof(pkt),
> libdav1d_fifo_write);
> -} else {
> -data = NULL;
>  }
>  }
>
> -res = dav1d_decode(dav1d->c, data, );
> +res = dav1d_send_data(dav1d->c, data);
> +if (res < 0) {
> +if (res == -EINVAL)
> +res = AVERROR_INVALIDDATA;

> +if (res != -EAGAIN)

How does this line make sense?

> +return res;

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


Re: [FFmpeg-devel] [PATCH] lavf/dashenc: Add support for per-stream container type selection.

2018-11-14 Thread Andrey Semashev

On 11/14/18 4:52 PM, Jeyapal, Karthick wrote:


On 11/14/18 1:41 PM, Andrey Semashev wrote:

On 11/12/18 3:55 PM, Andrey Semashev wrote:


Suppose you want to create a DASH stream consisting of VP8, H264, Vorbis
and Opus substreams to cover the best compatibility with clients (which
are mostly web browsers, but not necessarilly all of them). AFAIK, you
cannot put all these codecs neither in mp4 nor webm. An "auto" option
would put Opus in webm container, leaving clients not supporting webm
not able to play audio. With explicit container selection one could put
Opus content in mp4 or both webm and mp4 (in which case the substream
would be duplicated).

An example of a client that is picky about container format is Safari on
OS X High Sierra. I don't have one to test, but reportedly it supports
Opus only in caf format, and I've read someone hacked it to play Opus in
mp4 if disguised as AAC. I know lavf/dashenc doesn't support caf (yet)
but it may support it in the future, so the container format selection
would become even more relevant then.


So, what do we decide about this patch?

I understand your point. But all your examples are still theoretical(say caf is 
not supported in dashenc. And opus example doesn't mention any sample clients 
for that use-case).
My view is that, if we can find one practical example where this advanced patch 
will be of immediate use(which cannot be done by auto option), then let us 
review and push this patch.
If we can't find any immediate practical use-case, which could be tested and 
verified in popular clients then let's go for auto option.


Ok, thanks for your comments.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/dashenc: Add support for per-stream container type selection.

2018-11-14 Thread Jeyapal, Karthick

On 11/14/18 1:41 PM, Andrey Semashev wrote:
> On 11/12/18 3:55 PM, Andrey Semashev wrote:
> > On 11/12/18 3:12 PM, Jeyapal, Karthick wrote:
> >>
> >> On 11/12/18 5:20 PM, Andrey Semashev wrote:
> >>> On 11/12/18 8:20 AM, Jeyapal, Karthick wrote:
> 
>  On 11/8/18 10:27 PM, Andrey Semashev wrote:
> > This commit restores the ability to create DASH streams with codecs
> > that require different containers that was lost after commit
> > 2efdbf7367989cf9d296c25fa3d2aff8d6e25fdd. It extends the 
> > dash_segment_type
> > option syntax to allow to specify segment container types for 
> > individual
> > streams, in addition to the default container type that is applied to
> > all streams. The extended syntax is backward compatible with the 
> > previous
> > syntax.
>  Thanks for sending the patch. I understand your requirement completely.
>  But I feel that this option for mapping streams with container 
>  format is little confusing. Also, the relevant code is relatively 
>  big, and thus difficult to maintain in future.
>  I have a middle ground suggestion. If your goal is to achieve the 
>  earlier behavior broken commits, then I propose the following.
>  Option "dash_segment_type" could take one more option "auto" 
>  (instead of mp4 or webm).
>  When "auto" is chosen, the muxer could choose webm format for VP8, 
>  VP9, vorbis, opus streams and mp4 format for all other streams.
>  In this method the previous behavior of dashenc muxer could be 
>  restored with little addition to the overall code. Also it's usage 
>  will be simpler and easier to understand.
> >>>
> >>> This solution might be ok for just restoring the previous capability, 
> >>> but I think the ability for selecting the container format by the 
> >>> user is still more useful. For example, Opus can be muxed in both mp4 
> >>> (although, with experimental flag) and webm, and it may make sense to 
> >>> some users to select mp4. (In my case, though, I wanted webm, hence 
> >>> the patch.)
> >> In that case they could select "dash_segment_type" as "mp4", in which 
> >> case all streams including opus will be muxed in mp4 format. I don't 
> >> see a use-case where somebody wants opus in mp4 and would want other 
> >> streams in webm format.
> > 
> > Suppose you want to create a DASH stream consisting of VP8, H264, Vorbis 
> > and Opus substreams to cover the best compatibility with clients (which 
> > are mostly web browsers, but not necessarilly all of them). AFAIK, you 
> > cannot put all these codecs neither in mp4 nor webm. An "auto" option 
> > would put Opus in webm container, leaving clients not supporting webm 
> > not able to play audio. With explicit container selection one could put 
> > Opus content in mp4 or both webm and mp4 (in which case the substream 
> > would be duplicated).
> > 
> > An example of a client that is picky about container format is Safari on 
> > OS X High Sierra. I don't have one to test, but reportedly it supports 
> > Opus only in caf format, and I've read someone hacked it to play Opus in 
> > mp4 if disguised as AAC. I know lavf/dashenc doesn't support caf (yet) 
> > but it may support it in the future, so the container format selection 
> > would become even more relevant then.
>
> So, what do we decide about this patch?
I understand your point. But all your examples are still theoretical(say caf is 
not supported in dashenc. And opus example doesn't mention any sample clients 
for that use-case).
My view is that, if we can find one practical example where this advanced patch 
will be of immediate use(which cannot be done by auto option), then let us 
review and push this patch. 
If we can't find any immediate practical use-case, which could be tested and 
verified in popular clients then let's go for auto option.
>
> >>> Besides the parser, it doesn't add much code, and if I can improve 
> >>> the patch, please let me know how. If you absolutely don't want this 
> >>> functionality, that's ok, I'll keep this patch for my local builds 
> >>> and submit an "auto" option patch instead.
> >> I am not absolutely against this patch. But I am just trying to find 
> >> if there is a use-case for such an advanced option. If there is a 
> >> practical requirement for such a use-case, then I agree that we should 
> >> review and push this patch for sure.
> >> But if the requirement is just theoretical at this point, then I would 
> >> prefer the "auto" option patch. Maybe we could revisit this advanced 
> >> options patch when a real requirement comes up.
> >>>
> > ---
> >doc/muxers.texi   |   8 ++-
> >libavformat/dashenc.c | 161 
> > +++---
> >2 files changed, 140 insertions(+), 29 deletions(-)
> >
> > diff --git a/doc/muxers.texi b/doc/muxers.texi
> > index 62f4091e31..4418b38c76 100644
> > --- a/doc/muxers.texi
> > +++ 

Re: [FFmpeg-devel] [PATCH] avfilter: add astretch filter

2018-11-14 Thread Nicolas George
Paul B Mahol (2018-11-14):
> >  libavfilter/Makefile  |   1 +
> >  libavfilter/af_astretch.c | 330 ++
> >  libavfilter/allfilters.c  |   1 +
> >  3 files changed, 332 insertions(+)
> >  create mode 100644 libavfilter/af_astretch.c
> Will apply.

You forgot the docs.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] hwcontext_vaapi: Add option to set driver name

2018-11-14 Thread Michael Niedermayer
On Wed, Nov 14, 2018 at 12:21:07AM +, Mark Thompson wrote:
> For example: -init_hw_device vaapi:/dev/dri/renderD128,driver=foo
> 
> This may be more convenient that using the environment variable, and allows
> loading different drivers for different devices in the same process.
> ---
>  libavutil/hwcontext_vaapi.c | 13 +
>  1 file changed, 13 insertions(+)
> 
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> index 8624369bb9..eb3a78d181 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -1469,6 +1469,8 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, 
> const char *device,
>  {
>  VAAPIDevicePriv *priv;
>  VADisplay display = NULL;
> +const AVDictionaryEntry *driver;
> +VAStatus vas;
>  
>  priv = av_mallocz(sizeof(*priv));
>  if (!priv)
> @@ -1530,6 +1532,17 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, 
> const char *device,
>  return AVERROR(EINVAL);
>  }
>  
> +driver = av_dict_get(opts, "driver", NULL, 0);
> +if (driver) {
> +vas = vaSetDriverName(display, driver->value);

this breaks build here on ubuntu:

CC  libavutil/hwcontext_vaapi.o
libavutil/hwcontext_vaapi.c: In function ‘vaapi_device_create’:
libavutil/hwcontext_vaapi.c:1537:9: error: implicit declaration of function 
‘vaSetDriverName’ [-Werror=implicit-function-declaration]
 vas = vaSetDriverName(display, driver->value);
 ^
cc1: some warnings being treated as errors
make: *** [libavutil/hwcontext_vaapi.o] Error 1
make: Target `all' not remade because of errors.


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.


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


Re: [FFmpeg-devel] HEVC decoder for Raspberry Pi

2018-11-14 Thread John Cox
Hi

>Hi
>
>On Tue, Nov 13, 2018 at 03:52:18PM +, John Cox wrote:
>> Hi
>> 
>> I have been developing a hevc decoder for Raspberry Pi for some time
>> now. As active development has now pretty much ceased and the code is
>> believed stable it seems a good time to try presenting it to the group.
>> 
>> You can find the current code on branch test/4.1.0/rpi_main in repo
>> https://github.com/jc-kynesim/rpi-ffmpeg.git. It is based off tag n4.1
>> so if you diff it against n4.1 you should get a patch.
>> 
>> This code has been in use by the Raspberry Pi version of Kodi for over
>> two years now.
>> 
>> If you think it would be a good idea to add this to the main ffmpeg
>> distribution then I am willing to put reasonable effort into beating it
>> into an appropriate shape.
>> 
>> If not then it contains a reasonable number of ARM asm functions and
>> other code that you might like to take/adapt for the current decoder.
>> 
>> You will find the config scripts I have been using and a few notes in
>> the pi-util directory if you wish to try building it for yourself.
>> 
>> Just in case it isn't obvious: this will only run on a Pi.  Slightly
>> less obviously you need a Pi2 or better as the Pi0 & Pi1 don't have neon
>> and are just too slow anyway.
>
>others may have other oppinions, but i think optimized code in FFmpeg
>for Pi would be a good idea.
>How to integrate this best though i do not know. And i cant know as
>i have just quickly scrolled over the changes not really looked in detail

Well if you want help with understanding what I've done feel free to
email me and I'll do my best to explain.

>But its certainly better to have hw optimizations in main git and
>not have a seperate repository that needs to be maintained seperatly
>for each platform ... and that the user has to find also ... and then
>3rd party apps could have even more issues here  if they wanted to use
>optimized libs ...

As I said I'm happy to put in reasonable amounts of work to make this
happen. If we do want to go ahead then may I suggest that the most
efficient way of proceeding would be that I take advice from one
experienced person who understands the current hevc code (Michael?) by
email until the work is mostly done and then return to the list for
final polish?

Regards

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


Re: [FFmpeg-devel] [PATCH v3 1/1] avcodec: implemented Media Foundation encoder wrapper

2018-11-14 Thread Paweł Wegner
On Tue, Nov 13, 2018 at 6:52 PM Michael Niedermayer 
wrote:

> On Tue, Nov 13, 2018 at 12:23:42PM +0100, Paweł Wegner wrote:
> > On Tue, Nov 13, 2018 at 11:40 AM Michael Niedermayer
> 
> > wrote:
> >
> > > On Tue, Nov 13, 2018 at 09:50:17AM +0100, Paweł Wegner wrote:
> > > > On Tue, Nov 13, 2018 at 12:39 AM Michael Niedermayer
> > > 
> > > > wrote:
> > > >
> > > > > On Mon, Nov 12, 2018 at 02:42:36PM +0100, Paweł Wegner wrote:
> > > > > > Implemented the following encoders:
> > > > > > * ff_h264_mf_encoder
> > > > > > * ff_hevc_mf_encoder
> > > > > > * ff_aac_mf_encoder
> > > > > > * ff_ac3_mf_encoder
> > > > > > * ff_mp3_mf_encoder
> > > > > >
> > > > > > The code is based on the PLEX's FFmpeg fork which can be found
> here:
> > > > > > https://files.plexapp.com/elan/ffmpeg/plex-ffmpeg-2017-12-17.txz
> > > > > >
> > > > > > Signed-off-by: Paweł Wegner 
> > > > > > ---
> > > > > >  configure  |   11 +
> > > > > >  libavcodec/Makefile|1 +
> > > > > >  libavcodec/allcodecs.c |5 +
> > > > > >  libavcodec/mf_utils.c  |  734 
> > > > > >  libavcodec/mf_utils.h  |  207 +++
> > > > > >  libavcodec/mfenc.c | 1242
> > > 
> > > > > >  6 files changed, 2200 insertions(+)
> > > > > >  create mode 100644 libavcodec/mf_utils.c
> > > > > >  create mode 100644 libavcodec/mf_utils.h
> > > > > >  create mode 100644 libavcodec/mfenc.c
> > > > >
> > > > > breaks build for mingw64
> > > >
> > > >
> > > > > CC  libavcodec/mf_utils.o
> > > > > In file included from
> /usr/share/mingw-w64/include/wmcodecdsp.h:613:0,
> > > > >  from src/libavcodec/mf_utils.h:26,
> > > > >  from src/libavcodec/mf_utils.c:24:
> > > > > /usr/share/mingw-w64/include/strmif.h:15380:2: warning: #warning
> COM
> > > > > interfaces layout in this header has not been verified. [-Wcpp]
> > > > >  #warning COM interfaces layout in this header has not been
> verified.
> > > > >   ^
> > > > > /usr/share/mingw-w64/include/strmif.h:15381:2: warning: #warning
> COM
> > > > > interfaces with incorrect layout may not work at all. [-Wcpp]
> > > > >  #warning COM interfaces with incorrect layout may not work at all.
> > > > >   ^
> > > > > /usr/share/mingw-w64/include/strmif.h:15410:2: warning: #warning
> COM
> > > > > interfaces layout in this header has not been verified. [-Wcpp]
> > > > >  #warning COM interfaces layout in this header has not been
> verified.
> > > > >   ^
> > > > > /usr/share/mingw-w64/include/strmif.h:15411:2: warning: #warning
> COM
> > > > > interfaces with incorrect layout may not work at all. [-Wcpp]
> > > > >  #warning COM interfaces with incorrect layout may not work at all.
> > > > >   ^
> > > > >
> > > > I can silence these warnings by doing #undef __GNU_C__ before the MF
> > > > inclusion; but would that really be better?
> > > > This is where this comes from:
> > > >
> > >
> https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-headers/include/mfplay.h#L59
> > > >
> > > >
> > > > > In file included from
> /usr/share/mingw-w64/include/wmcodecdsp.h:613:0,
> > > > >  from src/libavcodec/mf_utils.h:26,
> > > > >  from src/libavcodec/mf_utils.c:24:
> > > > > /usr/share/mingw-w64/include/strmif.h:15382:9: note: #pragma
> message:
> > > > > Interface IAMAsyncReaderTimestampScaling has unverified layout.
> > > > >  __MINGW_BROKEN_INTERFACE(INTERFACE)
> > > > > ...
> > > > >
> > > > This one comes from mingw as well; and can be worked around the same
> way.
> > >
> > > sorry i have cut the compiler output incorrectly
> > > heres the full output, there are multiple real errors, not just
> warnings:
> > >
> > >
> > >
> > > In file included from /usr/share/mingw-w64/include/wmcodecdsp.h:613:0,
> > >  from src/libavcodec/mf_utils.h:26,
> > >  from src/libavcodec/mf_utils.c:24:
> > > /usr/share/mingw-w64/include/strmif.h:15380:2: warning: #warning COM
> > > interfaces layout in this header has not been verified. [-Wcpp]
> > >  #warning COM interfaces layout in this header has not been verified.
> > >   ^
> > > /usr/share/mingw-w64/include/strmif.h:15381:2: warning: #warning COM
> > > interfaces with incorrect layout may not work at all. [-Wcpp]
> > >  #warning COM interfaces with incorrect layout may not work at all.
> > >   ^
> > > /usr/share/mingw-w64/include/strmif.h:15410:2: warning: #warning COM
> > > interfaces layout in this header has not been verified. [-Wcpp]
> > >  #warning COM interfaces layout in this header has not been verified.
> > >   ^
> > > /usr/share/mingw-w64/include/strmif.h:15411:2: warning: #warning COM
> > > interfaces with incorrect layout may not work at all. [-Wcpp]
> > >  #warning COM interfaces with incorrect layout may not work at all.
> > >   ^
> > > In file included from /usr/share/mingw-w64/include/wmcodecdsp.h:613:0,
> > >  from src/libavcodec/mf_utils.h:26,
> > >  from 

[FFmpeg-devel] [PATCH] avcodec/vc1: correct aspect ratio calculation

2018-11-14 Thread Jerome Borsboom
According to VC-1 spec:
* Display size defaults to max coded size when not explicitly set in
sequence header
* Aspect ratio in the sequence header refers to the Display size elements.
Therefore, the aspect ratio for the coded samples (SAR) needs to take into
account the scaling from coded size to display size, and the aspect ratio
of the display size elements.

Signed-off-by: Jerome Borsboom 
---
VC-1 spec assumes that the output of the decoder, i.e. the pixel matrix with
dimensions coded_width x coded_height, is scaled to display size, i.e. a pixel
matrix of display_horiz_size x display_vert_size. This may introduce part of
the sample aspect ratio when the sizes of the two pixel matrices are not equal.
A further part of the sample aspect ratio is optionally specified in the 
sequence
header as the aspect ratio of the display size pixels. This patch takes both
aspect ratios into account and aims to be correct even when the coded image
includes overscan regions.

 libavcodec/vc1.c | 38 +-
 libavcodec/vc1.h |  2 ++
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index 3581d87b57..efc6edc4b0 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -442,30 +442,24 @@ static int decode_sequence_header_adv(VC1Context *v, 
GetBitContext *gb)
 }
 v->s.max_b_frames = v->s.avctx->max_b_frames = 7;
 if (get_bits1(gb)) { //Display Info - decoding is not affected by it
-int w, h, ar = 0;
+int ar = 0;
 av_log(v->s.avctx, AV_LOG_DEBUG, "Display extended info:\n");
-w = get_bits(gb, 14) + 1;
-h = get_bits(gb, 14) + 1;
-av_log(v->s.avctx, AV_LOG_DEBUG, "Display dimensions: %ix%i\n", w, h);
+v->disp_horiz_size = get_bits(gb, 14) + 1;
+v->disp_vert_size = get_bits(gb, 14) + 1;
+av_log(v->s.avctx, AV_LOG_DEBUG, "Display dimensions: %ix%i\n",
+   v->disp_horiz_size, v->disp_vert_size);
 if (get_bits1(gb))
 ar = get_bits(gb, 4);
 if (ar && ar < 14) {
-v->s.avctx->sample_aspect_ratio = ff_vc1_pixel_aspect[ar];
+v->aspect_ratio = ff_vc1_pixel_aspect[ar];
 } else if (ar == 15) {
-w = get_bits(gb, 8) + 1;
-h = get_bits(gb, 8) + 1;
-v->s.avctx->sample_aspect_ratio = (AVRational){w, h};
+v->aspect_ratio = (AVRational){get_bits(gb, 8) + 1, get_bits(gb, 
8) + 1};
 } else {
-av_reduce(>s.avctx->sample_aspect_ratio.num,
-  >s.avctx->sample_aspect_ratio.den,
-  v->s.avctx->height * w,
-  v->s.avctx->width * h,
-  1 << 30);
+v->aspect_ratio = (AVRational){1, 1};
 }
-ff_set_sar(v->s.avctx, v->s.avctx->sample_aspect_ratio);
-av_log(v->s.avctx, AV_LOG_DEBUG, "Aspect: %i:%i\n",
-   v->s.avctx->sample_aspect_ratio.num,
-   v->s.avctx->sample_aspect_ratio.den);
+av_log(v->s.avctx, AV_LOG_DEBUG, "Aspect ratio: %i:%i\n",
+   v->aspect_ratio.num,
+   v->aspect_ratio.den);
 
 if (get_bits1(gb)) { //framerate stuff
 if (get_bits1(gb)) {
@@ -490,6 +484,10 @@ static int decode_sequence_header_adv(VC1Context *v, 
GetBitContext *gb)
 v->transfer_char = get_bits(gb, 8);
 v->matrix_coef   = get_bits(gb, 8);
 }
+} else {
+v->disp_horiz_size = v->max_coded_width;
+v->disp_vert_size = v->max_coded_height;
+v->aspect_ratio = (AVRational){1, 1};
 }
 
 v->hrd_param_flag = get_bits1(gb);
@@ -544,6 +542,12 @@ int ff_vc1_decode_entry_point(AVCodecContext *avctx, 
VC1Context *v, GetBitContex
 av_log(avctx, AV_LOG_ERROR, "Failed to set dimensions %d %d\n", w, h);
 return ret;
 }
+av_reduce(>sample_aspect_ratio.num,
+  >sample_aspect_ratio.den,
+  v->disp_horiz_size * v->aspect_ratio.num * h,
+  v->disp_vert_size * v->aspect_ratio.den * w,
+  1 << 30);
+ff_set_sar(avctx, avctx->sample_aspect_ratio);
 
 if (v->extended_mv)
 v->extended_dmv = get_bits1(gb);
diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h
index 69f6ca9e4d..7674b0f9a1 100644
--- a/libavcodec/vc1.h
+++ b/libavcodec/vc1.h
@@ -209,6 +209,8 @@ typedef struct VC1Context{
 int hrd_param_flag;   ///< Presence of Hypothetical Reference
   ///< Decoder parameters
 int psf;  ///< Progressive Segmented Frame
+int disp_horiz_size, disp_vert_size;
+AVRational aspect_ratio;
 //@}
 
 /** Sequence header data for all Profiles
-- 
2.13.6


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


Re: [FFmpeg-devel] [PATCH] lavf/dashenc: set FLAC manifest codec string to "flac"

2018-11-14 Thread Paul B Mahol
On 11/14/18, Jan Ekström  wrote:
> Internally in ISOBMFF the FLAC-in-ISOBMFF draft uses the "fLaC"
> as the identifier for FLACSampleEntry, but what the browsers
> seem to eat for MPEG-DASH manifests is plain "flac".
>
> Verified by auri_ on IRC to play with the major browsers.
> ---
>  libavformat/dashenc.c | 1 +
>  1 file changed, 1 insertion(+)
>

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


[FFmpeg-devel] [PATCH] avcodec/diracdec: Check component quant

2018-11-14 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
10708/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5730140957442048

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/diracdec.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index af561d1426..fd23139062 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -676,6 +676,11 @@ static int decode_component(DiracContext *s, int comp)
 b->length = get_interleaved_ue_golomb(>gb);
 if (b->length) {
 b->quant = get_interleaved_ue_golomb(>gb);
+if (b->quant > (DIRAC_MAX_QUANT_INDEX - 1)) {
+av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", 
b->quant);
+b->quant = 0;
+return AVERROR_INVALIDDATA;
+}
 align_get_bits(>gb);
 b->coeff_data = s->gb.buffer + get_bits_count(>gb)/8;
 b->length = FFMIN(b->length, FFMAX(get_bits_left(>gb)/8, 
0));
-- 
2.19.1

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


Re: [FFmpeg-devel] [PATCH] avfilter: add astretch filter

2018-11-14 Thread Paul B Mahol
On 11/10/18, Paul B Mahol  wrote:
> Signed-off-by: Paul B Mahol 
> ---
>  libavfilter/Makefile  |   1 +
>  libavfilter/af_astretch.c | 330 ++
>  libavfilter/allfilters.c  |   1 +
>  3 files changed, 332 insertions(+)
>  create mode 100644 libavfilter/af_astretch.c

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


Re: [FFmpeg-devel] [PATCH] lavf/dashenc: Add support for per-stream container type selection.

2018-11-14 Thread Andrey Semashev

On 11/12/18 3:55 PM, Andrey Semashev wrote:

On 11/12/18 3:12 PM, Jeyapal, Karthick wrote:


On 11/12/18 5:20 PM, Andrey Semashev wrote:

On 11/12/18 8:20 AM, Jeyapal, Karthick wrote:


On 11/8/18 10:27 PM, Andrey Semashev wrote:

This commit restores the ability to create DASH streams with codecs
that require different containers that was lost after commit
2efdbf7367989cf9d296c25fa3d2aff8d6e25fdd. It extends the 
dash_segment_type
option syntax to allow to specify segment container types for 
individual

streams, in addition to the default container type that is applied to
all streams. The extended syntax is backward compatible with the 
previous

syntax.

Thanks for sending the patch. I understand your requirement completely.
But I feel that this option for mapping streams with container 
format is little confusing. Also, the relevant code is relatively 
big, and thus difficult to maintain in future.
I have a middle ground suggestion. If your goal is to achieve the 
earlier behavior broken commits, then I propose the following.
Option "dash_segment_type" could take one more option "auto" 
(instead of mp4 or webm).
When "auto" is chosen, the muxer could choose webm format for VP8, 
VP9, vorbis, opus streams and mp4 format for all other streams.
In this method the previous behavior of dashenc muxer could be 
restored with little addition to the overall code. Also it's usage 
will be simpler and easier to understand.


This solution might be ok for just restoring the previous capability, 
but I think the ability for selecting the container format by the 
user is still more useful. For example, Opus can be muxed in both mp4 
(although, with experimental flag) and webm, and it may make sense to 
some users to select mp4. (In my case, though, I wanted webm, hence 
the patch.)
In that case they could select "dash_segment_type" as "mp4", in which 
case all streams including opus will be muxed in mp4 format. I don't 
see a use-case where somebody wants opus in mp4 and would want other 
streams in webm format.


Suppose you want to create a DASH stream consisting of VP8, H264, Vorbis 
and Opus substreams to cover the best compatibility with clients (which 
are mostly web browsers, but not necessarilly all of them). AFAIK, you 
cannot put all these codecs neither in mp4 nor webm. An "auto" option 
would put Opus in webm container, leaving clients not supporting webm 
not able to play audio. With explicit container selection one could put 
Opus content in mp4 or both webm and mp4 (in which case the substream 
would be duplicated).


An example of a client that is picky about container format is Safari on 
OS X High Sierra. I don't have one to test, but reportedly it supports 
Opus only in caf format, and I've read someone hacked it to play Opus in 
mp4 if disguised as AAC. I know lavf/dashenc doesn't support caf (yet) 
but it may support it in the future, so the container format selection 
would become even more relevant then.


So, what do we decide about this patch?

Besides the parser, it doesn't add much code, and if I can improve 
the patch, please let me know how. If you absolutely don't want this 
functionality, that's ok, I'll keep this patch for my local builds 
and submit an "auto" option patch instead.
I am not absolutely against this patch. But I am just trying to find 
if there is a use-case for such an advanced option. If there is a 
practical requirement for such a use-case, then I agree that we should 
review and push this patch for sure.
But if the requirement is just theoretical at this point, then I would 
prefer the "auto" option patch. Maybe we could revisit this advanced 
options patch when a real requirement comes up.



---
   doc/muxers.texi   |   8 ++-
   libavformat/dashenc.c | 161 
+++---

   2 files changed, 140 insertions(+), 29 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 62f4091e31..4418b38c76 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -289,8 +289,12 @@ Set container format (mp4/webm) options using 
a @code{:} separated list of
   key=value parameters. Values containing @code{:} special 
characters must be

   escaped.
   -@item dash_segment_type @var{dash_segment_type}
-Possible values:
+@item -dash_segment_type @var{dash_segment_type}
+Sets the container type for dash segment files. Syntax is " 
:a,b,c :d,e" where  is
+the container type and a, b, c, d and e are the indices of the 
mapped streams. When no indices are specified,

+the container type is set for all streams.
+
+Possible container type values:
   @item mp4
   If this flag is set, the dash segment files will be in in 
ISOBMFF format. This is the default format.

   diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index f8b3d106d5..626dc76413 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -84,6 +84,8 @@ typedef struct OutputStream {
   int64_t first_pts, start_pts, max_pts;
   int64_t last_dts, last_pts;