Re: [FFmpeg-devel] [PATCH] avcodec/h264_mp4toannexb_bsf: add No IDR frame situation

2018-08-15 Thread myp...@gmail.com
On Wed, Aug 15, 2018 at 2:38 PM Linjie Fu  wrote:
>
> Fix the live stream encoding problem using qsv when the first frame
> is not an IDR frame.
>
> Add the extradata information when the IDR frame is missing in the
> first GOP.
>
> Fixes the bug reported in  ticket #6418.
>
> Signed-off-by: Linjie Fu 
> ---
>  libavcodec/h264_mp4toannexb_bsf.c | 13 -
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/h264_mp4toannexb_bsf.c 
> b/libavcodec/h264_mp4toannexb_bsf.c
> index 794c82e650..fbbfe3f7dd 100644
> --- a/libavcodec/h264_mp4toannexb_bsf.c
> +++ b/libavcodec/h264_mp4toannexb_bsf.c
> @@ -33,6 +33,7 @@ typedef struct H264BSFContext {
>  int32_t  pps_offset;
>  uint8_t  length_size;
>  uint8_t  new_idr;
> +   uint8_t  new_nal_slice;
>  uint8_t  idr_sps_seen;
>  uint8_t  idr_pps_seen;
>  int  extradata_parsed;
> @@ -243,6 +244,7 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, 
> AVPacket *out)
> buf, nal_size, 1)) < 0)
>  goto fail;
>  s->new_idr = 0;
> +   s->new_nal_slice = 1;
>  /* if only SPS has been seen, also insert PPS */
>  } else if (s->new_idr && unit_type == H264_NAL_IDR_SLICE && 
> s->idr_sps_seen && !s->idr_pps_seen) {
>  if (s->pps_offset == -1) {
> @@ -253,7 +255,16 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, 
> AVPacket *out)
>  ctx->par_out->extradata + 
> s->pps_offset, ctx->par_out->extradata_size - s->pps_offset,
>  buf, nal_size, 1)) < 0)
>  goto fail;
> -} else {
> +}else if (s->new_idr && !s->new_nal_slice && H264_NAL_SLICE == 
> unit_type && !s->idr_sps_seen && !s->idr_pps_seen)
> +   {
> +   av_log(ctx, AV_LOG_WARNING, "first H264_NAL_SLICE 
> when there is no IDR.\n");
> +   if ((ret = alloc_and_copy(out, 
> ctx->par_out->extradata, ctx->par_out->extradata_size, buf, nal_size, 1)) < 0)
> +   goto fail;
> +   s->new_nal_slice = 1;
> +   s->new_idr = 0;
> +   }
> +
> +   else {
>  if ((ret=alloc_and_copy(out, NULL, 0, buf, nal_size, unit_type 
> == H264_NAL_SPS || unit_type == H264_NAL_PPS)) < 0)
>  goto fail;
>  if (!s->new_idr && unit_type == H264_NAL_SLICE) {
> --
Need to follow FFmpeg coding style, I think, more information, you can
refer to the link: https://www.ffmpeg.org/developer.html. Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavc/qsvdec: release packet if mpeg2/vp8/vc1 decoding failure

2018-08-15 Thread Zhong Li
H264/265 have been fixed such an issue with commit
559370f2c45110afd8308eec7194437736c323d4.
Similar fixing is needed for other codecs.

Signed-off-by: Zhong Li 
---
 libavcodec/qsvdec_other.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsvdec_other.c b/libavcodec/qsvdec_other.c
index 3c872dc..472be71 100644
--- a/libavcodec/qsvdec_other.c
+++ b/libavcodec/qsvdec_other.c
@@ -138,8 +138,13 @@ static int qsv_decode_frame(AVCodecContext *avctx, void 
*data,
 }
 
 ret = ff_qsv_process_data(avctx, &s->qsv, frame, got_frame, 
&s->input_ref);
-if (ret < 0)
+if (ret < 0) {
+/* Drop input packet when failed to decode the packet. Otherwise,
+   the decoder will keep decoding the failure packet. */
+av_packet_unref(&s->input_ref);
+
 return ret;
+}
 
 s->input_ref.size -= ret;
 s->input_ref.data += ret;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH] lavc/qsvenc: fix a misleading log message

2018-08-15 Thread Zhong Li
Signed-off-by: Zhong Li 
---
 libavcodec/qsvenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 3ce5ffe..ab0db3b 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1119,7 +1119,7 @@ static void print_interlace_msg(AVCodecContext *avctx, 
QSVEncContext *q)
 q->param.mfx.CodecLevel > MFX_LEVEL_AVC_41)
 av_log(avctx, AV_LOG_WARNING,
"Interlaced coding is supported"
-   " at Main/High Profile Level 2.1-4.1\n");
+   " at Main/High Profile Level 2.2-4.0\n");
 }
 }
 
-- 
2.7.4

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


Re: [FFmpeg-devel] Resending Patch for hlsenc.c fixes for https://trac.ffmpeg.org/ticket/7281

2018-08-15 Thread Liu Steven


> 在 2018年8月15日,下午6:37,Ronak Patel  写道:
> 
>> 
>> On Aug 14, 2018, at 10:57 PM, Liu Steven  wrote:
>> 
>> 
>> 
>>> 在 2018年8月15日,上午9:31,Ronak  写道:
>>> 
>>> From: "Ronak Patel" mailto:ronak2...@yahoo.com>yahoo.com>
>>> 
>>> This fixes the creation of the hls manifest in hlsenc.c by writing the 
>>> entire manifest at the end for VOD playlists. Live & Event Playlists are 
>>> unaffected.
>>> This also fixes the behavior with HLS_TEMP_FILE to work correctly when 
>>> -hlsflags temp_file is specified, instead of always relying on use_rename, 
>>> which caused these problems.
>>> 
>>> Files that would previously take over a week to fragment now take 1 minute 
>>> on the same hardware. This was a 153 hour audio file (2.2GB of audio).
>>> 
>>> Signed-off-by: Ronak Patel >> >
>>> ---
>>> libavformat/hlsenc.c | 51 
>>> ---
>>> 1 file changed, 36 insertions(+), 15 deletions(-)
>>> 
>>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>>> index b5644f0..7933b79 100644
>>> --- a/libavformat/hlsenc.c
>>> +++ b/libavformat/hlsenc.c
>>> @@ -1168,7 +1168,6 @@ static int hls_rename_temp_file(AVFormatContext *s, 
>>> AVFormatContext *oc)
>>>   return AVERROR(ENOMEM);
>>>   final_filename[len-4] = '\0';
>>>   ret = ff_rename(oc->url, final_filename, s);
>>> -oc->url[len-4] = '\0';
>>>   av_freep(&final_filename);
>>>   return ret;
>>> }
>>> @@ -1374,7 +1373,7 @@ static int hls_window(AVFormatContext *s, int last, 
>>> VariantStream *vs)
>>>   char temp_filename[1024];
>>>   int64_t sequence = FFMAX(hls->start_sequence, vs->sequence - 
>>> vs->nb_entries);
>>>   const char *proto = avio_find_protocol_name(s->url);
>>> -int use_rename = proto && !strcmp(proto, "file");
>>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>>> HLS_TEMP_FILE);
>>>   static unsigned warned_non_file;
>>>   char *key_uri = NULL;
>>>   char *iv_string = NULL;
>>> @@ -1397,11 +1396,11 @@ static int hls_window(AVFormatContext *s, int last, 
>>> VariantStream *vs)
>>>   hls->version = 7;
>>>   }
>>> -if (!use_rename && !warned_non_file++)
>>> +if (!use_temp_file && !warned_non_file++)
>>>   av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
>>> may lead to races and temporary partial files\n");
>>>   set_http_options(s, &options, hls);
>>> -snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : 
>>> "%s", vs->m3u8_name);
>>> +snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? 
>>> "%s.tmp" : "%s", vs->m3u8_name);
>>>   if ((ret = hlsenc_io_open(s, &hls->m3u8_out, temp_filename, &options)) < 
>>> 0)
>>>   goto fail;
>>> @@ -1472,8 +1471,8 @@ fail:
>>>   av_dict_free(&options);
>>>   hlsenc_io_close(s, &hls->m3u8_out, temp_filename);
>>>   hlsenc_io_close(s, &hls->sub_m3u8_out, vs->vtt_m3u8_name);
>>> -if (ret >= 0 && use_rename)
>>> -ff_rename(temp_filename, vs->m3u8_name, s);
>>> +if (use_temp_file)
>>> +ff_rename(temp_filename, vs->m3u8_name, s);
>>>   if (ret >= 0 && hls->master_pl_name)
>>>   if (create_master_playlist(s, vs) < 0)
>>> @@ -1488,6 +1487,8 @@ static int hls_start(AVFormatContext *s, 
>>> VariantStream *vs)
>>>   AVFormatContext *oc = vs->avf;
>>>   AVFormatContext *vtt_oc = vs->vtt_avf;
>>>   AVDictionary *options = NULL;
>>> +const char *proto = avio_find_protocol_name(s->url);
>>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>>> HLS_TEMP_FILE);
>>>   char *filename, iv_string[KEYSIZE*2 + 1];
>>>   int err = 0;
>>> @@ -1583,7 +1584,7 @@ static int hls_start(AVFormatContext *s, 
>>> VariantStream *vs)
>>>   set_http_options(s, &options, c);
>>> -if (c->flags & HLS_TEMP_FILE) {
>>> +if (use_temp_file) {
>>>   char *new_name = av_asprintf("%s.tmp", oc->url);
>>>   if (!new_name)
>>>   return AVERROR(ENOMEM);
>>> @@ -2145,6 +2146,8 @@ static int hls_write_packet(AVFormatContext *s, 
>>> AVPacket *pkt)
>>>   int ret = 0, can_split = 1, i, j;
>>>   int stream_index = 0;
>>>   int range_length = 0;
>>> +const char *proto = avio_find_protocol_name(s->url);
>>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>>> HLS_TEMP_FILE);
>>>   uint8_t *buffer = NULL;
>>>   VariantStream *vs = NULL;
>>>   AVDictionary *options = NULL;
>>> @@ -2214,10 +2217,10 @@ static int hls_write_packet(AVFormatContext *s, 
>>> AVPacket *pkt)
>>>   }
>>> +char *old_filename = NULL;
>>>   if (vs->packets_written && can_split && av_compare_ts(pkt->pts - 
>>> vs->start_pts, st->time_base,
>>> end_pts, 
>>> AV_TIME_BASE_Q) >= 0) {
>>>   int64_t new_start_pos;
>>> -char *old_filename = NULL;
>>>   int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || 
>>> (hls->max_seg_size > 0);
>>>   av_write_frame(vs->avf, NULL); /* Flush any buffered data */
>>> @@ -2253,11 +2256,13 @@ static int hls_wri

Re: [FFmpeg-devel] Resending Patch for hlsenc.c fixes for https://trac.ffmpeg.org/ticket/7281

2018-08-15 Thread Ronak Patel

> On Aug 14, 2018, at 10:57 PM, Liu Steven  wrote:
> 
> 
> 
>> 在 2018年8月15日,上午9:31,Ronak  写道:
>> 
>> From: "Ronak Patel" mailto:ronak2...@yahoo.com>yahoo.com>
>> 
>> This fixes the creation of the hls manifest in hlsenc.c by writing the 
>> entire manifest at the end for VOD playlists. Live & Event Playlists are 
>> unaffected.
>> This also fixes the behavior with HLS_TEMP_FILE to work correctly when 
>> -hlsflags temp_file is specified, instead of always relying on use_rename, 
>> which caused these problems.
>> 
>> Files that would previously take over a week to fragment now take 1 minute 
>> on the same hardware. This was a 153 hour audio file (2.2GB of audio).
>> 
>> Signed-off-by: Ronak Patel mailto:ronak2...@yahoo.com>>
>> ---
>> libavformat/hlsenc.c | 51 ---
>> 1 file changed, 36 insertions(+), 15 deletions(-)
>> 
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index b5644f0..7933b79 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -1168,7 +1168,6 @@ static int hls_rename_temp_file(AVFormatContext *s, 
>> AVFormatContext *oc)
>>return AVERROR(ENOMEM);
>>final_filename[len-4] = '\0';
>>ret = ff_rename(oc->url, final_filename, s);
>> -oc->url[len-4] = '\0';
>>av_freep(&final_filename);
>>return ret;
>> }
>> @@ -1374,7 +1373,7 @@ static int hls_window(AVFormatContext *s, int last, 
>> VariantStream *vs)
>>char temp_filename[1024];
>>int64_t sequence = FFMAX(hls->start_sequence, vs->sequence - 
>> vs->nb_entries);
>>const char *proto = avio_find_protocol_name(s->url);
>> -int use_rename = proto && !strcmp(proto, "file");
>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>> HLS_TEMP_FILE);
>>static unsigned warned_non_file;
>>char *key_uri = NULL;
>>char *iv_string = NULL;
>> @@ -1397,11 +1396,11 @@ static int hls_window(AVFormatContext *s, int last, 
>> VariantStream *vs)
>>hls->version = 7;
>>}
>> -if (!use_rename && !warned_non_file++)
>> +if (!use_temp_file && !warned_non_file++)
>>av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
>> may lead to races and temporary partial files\n");
>>set_http_options(s, &options, hls);
>> -snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : 
>> "%s", vs->m3u8_name);
>> +snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? "%s.tmp" 
>> : "%s", vs->m3u8_name);
>>if ((ret = hlsenc_io_open(s, &hls->m3u8_out, temp_filename, &options)) < 
>> 0)
>>goto fail;
>> @@ -1472,8 +1471,8 @@ fail:
>>av_dict_free(&options);
>>hlsenc_io_close(s, &hls->m3u8_out, temp_filename);
>>hlsenc_io_close(s, &hls->sub_m3u8_out, vs->vtt_m3u8_name);
>> -if (ret >= 0 && use_rename)
>> -ff_rename(temp_filename, vs->m3u8_name, s);
>> +if (use_temp_file)
>> +ff_rename(temp_filename, vs->m3u8_name, s);
>>if (ret >= 0 && hls->master_pl_name)
>>if (create_master_playlist(s, vs) < 0)
>> @@ -1488,6 +1487,8 @@ static int hls_start(AVFormatContext *s, VariantStream 
>> *vs)
>>AVFormatContext *oc = vs->avf;
>>AVFormatContext *vtt_oc = vs->vtt_avf;
>>AVDictionary *options = NULL;
>> +const char *proto = avio_find_protocol_name(s->url);
>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>> HLS_TEMP_FILE);
>>char *filename, iv_string[KEYSIZE*2 + 1];
>>int err = 0;
>> @@ -1583,7 +1584,7 @@ static int hls_start(AVFormatContext *s, VariantStream 
>> *vs)
>>set_http_options(s, &options, c);
>> -if (c->flags & HLS_TEMP_FILE) {
>> +if (use_temp_file) {
>>char *new_name = av_asprintf("%s.tmp", oc->url);
>>if (!new_name)
>>return AVERROR(ENOMEM);
>> @@ -2145,6 +2146,8 @@ static int hls_write_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>int ret = 0, can_split = 1, i, j;
>>int stream_index = 0;
>>int range_length = 0;
>> +const char *proto = avio_find_protocol_name(s->url);
>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>> HLS_TEMP_FILE);
>>uint8_t *buffer = NULL;
>>VariantStream *vs = NULL;
>>AVDictionary *options = NULL;
>> @@ -2214,10 +2217,10 @@ static int hls_write_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>}
>> +char *old_filename = NULL;
>>if (vs->packets_written && can_split && av_compare_ts(pkt->pts - 
>> vs->start_pts, st->time_base,
>>  end_pts, 
>> AV_TIME_BASE_Q) >= 0) {
>>int64_t new_start_pos;
>> -char *old_filename = NULL;
>>int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || 
>> (hls->max_seg_size > 0);
>>av_write_frame(vs->avf, NULL); /* Flush any buffered data */
>> @@ -2253,11 +2256,13 @@ static int hls_write_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>hlsenc_io_close(s, &vs->vtt_avf->pb, vs->vtt_avf->url);
>> 

Re: [FFmpeg-devel] Resending Patch for hlsenc.c fixes for https://trac.ffmpeg.org/ticket/7281

2018-08-15 Thread Ronak Patel

> On Aug 15, 2018, at 6:46 AM, Liu Steven  wrote:
> 
> 
> 
>>> 在 2018年8月15日,下午6:37,Ronak Patel  写道:
>>> 
>>> 
>>> On Aug 14, 2018, at 10:57 PM, Liu Steven  wrote:
>>> 
>>> 
>>> 
 在 2018年8月15日,上午9:31,Ronak  写道:
 
 From: "Ronak Patel" mailto:ronak2...@yahoo.com>yahoo.com>
 
 This fixes the creation of the hls manifest in hlsenc.c by writing the 
 entire manifest at the end for VOD playlists. Live & Event Playlists are 
 unaffected.
 This also fixes the behavior with HLS_TEMP_FILE to work correctly when 
 -hlsflags temp_file is specified, instead of always relying on use_rename, 
 which caused these problems.
 
 Files that would previously take over a week to fragment now take 1 minute 
 on the same hardware. This was a 153 hour audio file (2.2GB of audio).
 
 Signed-off-by: Ronak Patel >>> >
 ---
 libavformat/hlsenc.c | 51 
 ---
 1 file changed, 36 insertions(+), 15 deletions(-)
 
 diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
 index b5644f0..7933b79 100644
 --- a/libavformat/hlsenc.c
 +++ b/libavformat/hlsenc.c
 @@ -1168,7 +1168,6 @@ static int hls_rename_temp_file(AVFormatContext *s, 
 AVFormatContext *oc)
  return AVERROR(ENOMEM);
  final_filename[len-4] = '\0';
  ret = ff_rename(oc->url, final_filename, s);
 -oc->url[len-4] = '\0';
  av_freep(&final_filename);
  return ret;
 }
 @@ -1374,7 +1373,7 @@ static int hls_window(AVFormatContext *s, int last, 
 VariantStream *vs)
  char temp_filename[1024];
  int64_t sequence = FFMAX(hls->start_sequence, vs->sequence - 
 vs->nb_entries);
  const char *proto = avio_find_protocol_name(s->url);
 -int use_rename = proto && !strcmp(proto, "file");
 +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
 HLS_TEMP_FILE);
  static unsigned warned_non_file;
  char *key_uri = NULL;
  char *iv_string = NULL;
 @@ -1397,11 +1396,11 @@ static int hls_window(AVFormatContext *s, int 
 last, VariantStream *vs)
  hls->version = 7;
  }
 -if (!use_rename && !warned_non_file++)
 +if (!use_temp_file && !warned_non_file++)
  av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
 may lead to races and temporary partial files\n");
  set_http_options(s, &options, hls);
 -snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" 
 : "%s", vs->m3u8_name);
 +snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? 
 "%s.tmp" : "%s", vs->m3u8_name);
  if ((ret = hlsenc_io_open(s, &hls->m3u8_out, temp_filename, &options)) < 
 0)
  goto fail;
 @@ -1472,8 +1471,8 @@ fail:
  av_dict_free(&options);
  hlsenc_io_close(s, &hls->m3u8_out, temp_filename);
  hlsenc_io_close(s, &hls->sub_m3u8_out, vs->vtt_m3u8_name);
 -if (ret >= 0 && use_rename)
 -ff_rename(temp_filename, vs->m3u8_name, s);
 +if (use_temp_file)
 +ff_rename(temp_filename, vs->m3u8_name, s);
  if (ret >= 0 && hls->master_pl_name)
  if (create_master_playlist(s, vs) < 0)
 @@ -1488,6 +1487,8 @@ static int hls_start(AVFormatContext *s, 
 VariantStream *vs)
  AVFormatContext *oc = vs->avf;
  AVFormatContext *vtt_oc = vs->vtt_avf;
  AVDictionary *options = NULL;
 +const char *proto = avio_find_protocol_name(s->url);
 +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
 HLS_TEMP_FILE);
  char *filename, iv_string[KEYSIZE*2 + 1];
  int err = 0;
 @@ -1583,7 +1584,7 @@ static int hls_start(AVFormatContext *s, 
 VariantStream *vs)
  set_http_options(s, &options, c);
 -if (c->flags & HLS_TEMP_FILE) {
 +if (use_temp_file) {
  char *new_name = av_asprintf("%s.tmp", oc->url);
  if (!new_name)
  return AVERROR(ENOMEM);
 @@ -2145,6 +2146,8 @@ static int hls_write_packet(AVFormatContext *s, 
 AVPacket *pkt)
  int ret = 0, can_split = 1, i, j;
  int stream_index = 0;
  int range_length = 0;
 +const char *proto = avio_find_protocol_name(s->url);
 +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
 HLS_TEMP_FILE);
  uint8_t *buffer = NULL;
  VariantStream *vs = NULL;
  AVDictionary *options = NULL;
 @@ -2214,10 +2217,10 @@ static int hls_write_packet(AVFormatContext *s, 
 AVPacket *pkt)
  }
 +char *old_filename = NULL;
  if (vs->packets_written && can_split && av_compare_ts(pkt->pts - 
 vs->start_pts, st->time_base,
end_pts, 
 AV_TIME_BASE_Q) >= 0) {
  int64_t new_start_pos;
 -char *old_filename = NULL;
  int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || 
 (hls

[FFmpeg-devel] [PATCH 1/2] docs/filters: add documentation to all existing OpenCL filters

2018-08-15 Thread Danil Iashchenko
docs/filters: add documentation to all existing OpenCL filters
---

Hi! Sorry for delay.

Added general instruction for format conversion in the start of overall section 
and separatly for overlay_opencl.

As far as I understand, different format conversion depends on which formats 
are supported by hwupload/hwdownload.  
So maybe it is better to clarify what formats are supported by them in 
hwupload/hwdownload section, since it is used not only by OpenCL and show set 
of possible input formats which do not need the conversion. All other 
unexpected formats should be converted by format filter.

Also added docs for erosion_opencl and dilation_opencl filters.

Thanks! 

Danil.

 doc/filters.texi | 498 +++
 1 file changed, 498 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 267bd04..12b6c9f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10190,6 +10190,7 @@ A floating point number which specifies chroma temporal 
strength. It defaults to
 @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
 @end table
 
+@anchor{hwdownload}
 @section hwdownload
 
 Download hardware frames to system memory.
@@ -10280,6 +10281,7 @@ ways if there are any additional constraints on that 
filter's output.
 Do not use it without fully understanding the implications of its use.
 @end table
 
+@anchor{hwupload}
 @section hwupload
 
 Upload system memory frames to hardware surfaces.
@@ -17595,6 +17597,502 @@ pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} 
is 1.
 
 @c man end VIDEO FILTERS
 
+@chapter OpenCL Video Filters
+@c man begin OPENCL VIDEO FILTERS
+
+Below is a description of the currently available OpenCL video filters.
+
+To enable compilation of these filters you need to configure FFmpeg with
+@code{--enable-opencl}.
+
+Running OpenCL filters requires you to initialize a hardware device and to 
pass that device to all filters in any filter graph.
+@table @option
+
+@item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
+Initialise a new hardware device of type @var{opencl} called @var{name}, using 
the
+given device parameters.
+
+@item -filter_hw_device @var{name}
+Pass the hardware device called @var{name} to all filters in any filter graph.
+
+@end table
+
+For more detailed information see 
@url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
+
+@itemize
+@item
+Example of choosing the first device on the second platform and running 
avgblur_opencl filter with default parameters on it.
+@example
+-init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, 
avgblur_opencl, hwdownload" OUTPUT
+@end example
+@end itemize
+
+Since OpenCL filters are not able to access frame data in normal memory, all 
frame data needs to be uploaded(@ref{hwupload}) to hardware surfaces connected 
to the appropriate device before being used and then 
downloaded(@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} 
will upload to a surface with the same layout as the software frame, so it may 
be necessary to add a @ref{format} filter immediately before to get the input 
into the right format and @ref{hwdownload} does not support all formats on the 
output - it may be necessary to insert an additional @ref{format} filter 
immediately following in the graph to get the output in a supported format.
+
+@section avgblur_opencl
+
+Apply average blur filter.
+
+The filter accepts the following options:
+
+@table @option
+@item sizeX
+Set horizontal radius size.
+Range is @code{[1, 1024]} and default value is @code{1}.
+
+@item planes
+Set which planes to filter. Default value is @code{0xf}, by which all planes 
are processed.
+
+@item sizeY
+Set vertical radius size. Range is @code{[1, 1024]} and default value is 
@code{0}. If zero, @code{sizeX} value will be used.
+@end table
+
+@subsection Example
+
+@itemize
+@item
+Apply average blur filter with horizontal and vertical size of 3, setting each 
pixel of the output to the average value of the 7x7 region centered on it in 
the input. For pixels on the edges of the image, the region does not extend 
beyond the image boundaries, and so out-of-range coordinates are not used in 
the calculations.
+@example
+-i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
+@end example
+@end itemize
+
+@section boxblur_opencl
+
+Apply a boxblur algorithm to the input video.
+
+It accepts the following parameters:
+
+@table @option
+
+@item luma_radius, lr
+@item luma_power, lp
+@item chroma_radius, cr
+@item chroma_power, cp
+@item alpha_radius, ar
+@item alpha_power, ap
+
+@end table
+
+A description of the accepted options follows.
+
+@table @option
+@item luma_radius, lr
+@item chroma_radius, cr
+@item alpha_radius, ar
+Set an expression for the box radius in pixels used for blurring the
+corresponding input plane.
+
+The radius value must be a non-negative number, and must not be
+greater than the value of the expression @code{min(w,h)/2} for the

Re: [FFmpeg-devel] [PATCH 6/7] libavfilter/vf_sr.c: Removes uint8 -> float and float -> uint8 conversions.

2018-08-15 Thread Pedro Arthur
2018-08-14 19:49 GMT-03:00 Marton Balint :
>
> On Tue, 14 Aug 2018, Pedro Arthur wrote:
>
>> 2018-08-14 15:45 GMT-03:00 Rostislav Pehlivanov :
>>>
>>> On Thu, 2 Aug 2018 at 20:00, Sergey Lavrushkin  wrote:
>>>
 This patch removes conversions, declared inside the sr filter, and uses
 libswscale inside
 the filter to perform them for only Y channel of input. The sr filter
 still has uint
 formats as input, as it does not use chroma channels in models and these
 channels are
 upscaled using libswscale, float formats for input would cause
 unnecessary
 conversions
 during scaling for these channels.

>
> [...]
>
>>> You are planning to remove *all* conversion still, right? Its still
>>> unacceptable that there *are* conversions.
>>
>>
>> They are here because it is the most efficient way to do it. The
>> filter works only on luminance channel therefore we only apply
>> conversion to Y channel, and bicubic upscale to chrominance.
>> I can't see how one can achieve the same result, without doing useless
>> computations, if not in this way.
>
>
> Is there a reason why only the luminance channel is scaled this way? Can't
> you also train scaling chroma planes the same way? This way you could really
> eliminate the internal calls to swscale. If the user prefers to scale only
> one channel, he can always split the planes and scale them separately (using
> different filters) and then merge them.
The sr cnn tries to restore high frequency therefore it is aplied only
to luminance because applying it to chrominance does not improve much
quality and would be much slower.
The most efficient way to do it is convert only Y channel to float
apply the cnn to it and convert it back to int, and just upscale the
UV with swscale bicubic filter.
>
> Thanks,
> Marton
>
> ___
> 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] Resending Patch for hlsenc.c fixes for https://trac.ffmpeg.org/ticket/7281

2018-08-15 Thread Steven Liu


> On Aug 15, 2018, at 09:31, Ronak  wrote:
> 
> From: "Ronak Patel" mailto:ron...@audible.com>yahoo.com>
> 
> This fixes the creation of the hls manifest in hlsenc.c by writing the entire 
> manifest at the end for VOD playlists. Live & Event Playlists are unaffected.
> This also fixes the behavior with HLS_TEMP_FILE to work correctly when 
> -hlsflags temp_file is specified, instead of always relying on use_rename, 
> which caused these problems.
> 
> Files that would previously take over a week to fragment now take 1 minute on 
> the same hardware. This was a 153 hour audio file (2.2GB of audio).
> 
> Signed-off-by: Ronak Patel mailto:ronak2...@yahoo.com>>
> ---
> libavformat/hlsenc.c | 51 ---
> 1 file changed, 36 insertions(+), 15 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index b5644f0..7933b79 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1168,7 +1168,6 @@ static int hls_rename_temp_file(AVFormatContext *s, 
> AVFormatContext *oc)
> return AVERROR(ENOMEM);
> final_filename[len-4] = '\0';
> ret = ff_rename(oc->url, final_filename, s);
> -oc->url[len-4] = '\0';
> av_freep(&final_filename);
> return ret;
> }
> @@ -1374,7 +1373,7 @@ static int hls_window(AVFormatContext *s, int last, 
> VariantStream *vs)
> char temp_filename[1024];
> int64_t sequence = FFMAX(hls->start_sequence, vs->sequence - 
> vs->nb_entries);
> const char *proto = avio_find_protocol_name(s->url);
> -int use_rename = proto && !strcmp(proto, "file");
> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
> HLS_TEMP_FILE);
> static unsigned warned_non_file;
> char *key_uri = NULL;
> char *iv_string = NULL;
> @@ -1397,11 +1396,11 @@ static int hls_window(AVFormatContext *s, int last, 
> VariantStream *vs)
> hls->version = 7;
> }
> -if (!use_rename && !warned_non_file++)
> +if (!use_temp_file && !warned_non_file++)
> av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
> may lead to races and temporary partial files\n");
> set_http_options(s, &options, hls);
> -snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : 
> "%s", vs->m3u8_name);
> +snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? "%s.tmp" 
> : "%s", vs->m3u8_name);
> if ((ret = hlsenc_io_open(s, &hls->m3u8_out, temp_filename, &options)) < 
> 0)
> goto fail;
> @@ -1472,8 +1471,8 @@ fail:
> av_dict_free(&options);
> hlsenc_io_close(s, &hls->m3u8_out, temp_filename);
> hlsenc_io_close(s, &hls->sub_m3u8_out, vs->vtt_m3u8_name);
> -if (ret >= 0 && use_rename)
> -ff_rename(temp_filename, vs->m3u8_name, s);
> + if (use_temp_file)
> + ff_rename(temp_filename, vs->m3u8_name, s);
> if (ret >= 0 && hls->master_pl_name)
> if (create_master_playlist(s, vs) < 0)
> @@ -1488,6 +1487,8 @@ static int hls_start(AVFormatContext *s, VariantStream 
> *vs)
> AVFormatContext *oc = vs->avf;
> AVFormatContext *vtt_oc = vs->vtt_avf;
> AVDictionary *options = NULL;
> + const char *proto = avio_find_protocol_name(s->url);
> + int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
> HLS_TEMP_FILE);
> char *filename, iv_string[KEYSIZE*2 + 1];
> int err = 0;
> @@ -1583,7 +1584,7 @@ static int hls_start(AVFormatContext *s, VariantStream 
> *vs)
> set_http_options(s, &options, c);
> -if (c->flags & HLS_TEMP_FILE) {
> +if (use_temp_file) {
> char *new_name = av_asprintf("%s.tmp", oc->url);
> if (!new_name)
> return AVERROR(ENOMEM);
> @@ -2145,6 +2146,8 @@ static int hls_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
> int ret = 0, can_split = 1, i, j;
> int stream_index = 0;
> int range_length = 0;
> +const char *proto = avio_find_protocol_name(s->url);
> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
> HLS_TEMP_FILE);
> uint8_t *buffer = NULL;
> VariantStream *vs = NULL;
> AVDictionary *options = NULL;
> @@ -2214,10 +2217,10 @@ static int hls_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
> }
> +char *old_filename = NULL;
> if (vs->packets_written && can_split && av_compare_ts(pkt->pts - 
> vs->start_pts, st->time_base,
>   end_pts, 
> AV_TIME_BASE_Q) >= 0) {
> int64_t new_start_pos;
> -char *old_filename = NULL;
> int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || 
> (hls->max_seg_size > 0);
> av_write_frame(vs->avf, NULL); /* Flush any buffered data */
> @@ -2253,11 +2256,13 @@ static int hls_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
> hlsenc_io_close(s, &vs->vtt_avf->pb, vs->vtt_avf->url);
> }
> }
> -if ((hls->flags & HLS_TEMP_FILE) && oc->url[0]) {
> +
> +// look to rename t

Re: [FFmpeg-devel] [PATCH 6/7] libavfilter/vf_sr.c: Removes uint8 -> float and float -> uint8 conversions.

2018-08-15 Thread Sergey Lavrushkin
2018-08-15 1:49 GMT+03:00 Marton Balint :

>
> On Tue, 14 Aug 2018, Pedro Arthur wrote:
>
> 2018-08-14 15:45 GMT-03:00 Rostislav Pehlivanov :
>>
>>> On Thu, 2 Aug 2018 at 20:00, Sergey Lavrushkin 
>>> wrote:
>>>
>>> This patch removes conversions, declared inside the sr filter, and uses
 libswscale inside
 the filter to perform them for only Y channel of input. The sr filter
 still has uint
 formats as input, as it does not use chroma channels in models and these
 channels are
 upscaled using libswscale, float formats for input would cause
 unnecessary
 conversions
 during scaling for these channels.


> [...]
>
> You are planning to remove *all* conversion still, right? Its still
>>> unacceptable that there *are* conversions.
>>>
>>
>> They are here because it is the most efficient way to do it. The
>> filter works only on luminance channel therefore we only apply
>> conversion to Y channel, and bicubic upscale to chrominance.
>> I can't see how one can achieve the same result, without doing useless
>> computations, if not in this way.
>>
>
> Is there a reason why only the luminance channel is scaled this way? Can't
> you also train scaling chroma planes the same way? This way you could
> really eliminate the internal calls to swscale. If the user prefers to
> scale only one channel, he can always split the planes and scale them
> separately (using different filters) and then merge them.
>

If it is possible, I can then change sr filter to work only for Y channel.
Can you give me some examples of how to split the planes, filter them
separately
and merge them back?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 6/7] libavfilter/vf_sr.c: Removes uint8 -> float and float -> uint8 conversions.

2018-08-15 Thread Paul B Mahol
On 8/15/18, Sergey Lavrushkin  wrote:
> 2018-08-15 1:49 GMT+03:00 Marton Balint :
>
>>
>> On Tue, 14 Aug 2018, Pedro Arthur wrote:
>>
>> 2018-08-14 15:45 GMT-03:00 Rostislav Pehlivanov :
>>>
 On Thu, 2 Aug 2018 at 20:00, Sergey Lavrushkin 
 wrote:

 This patch removes conversions, declared inside the sr filter, and uses
> libswscale inside
> the filter to perform them for only Y channel of input. The sr filter
> still has uint
> formats as input, as it does not use chroma channels in models and
> these
> channels are
> upscaled using libswscale, float formats for input would cause
> unnecessary
> conversions
> during scaling for these channels.
>
>
>> [...]
>>
>> You are planning to remove *all* conversion still, right? Its still
 unacceptable that there *are* conversions.

>>>
>>> They are here because it is the most efficient way to do it. The
>>> filter works only on luminance channel therefore we only apply
>>> conversion to Y channel, and bicubic upscale to chrominance.
>>> I can't see how one can achieve the same result, without doing useless
>>> computations, if not in this way.
>>>
>>
>> Is there a reason why only the luminance channel is scaled this way? Can't
>> you also train scaling chroma planes the same way? This way you could
>> really eliminate the internal calls to swscale. If the user prefers to
>> scale only one channel, he can always split the planes and scale them
>> separately (using different filters) and then merge them.
>>
>
> If it is possible, I can then change sr filter to work only for Y channel.
> Can you give me some examples of how to split the planes, filter them
> separately
> and merge them back?

see extractplanes and mergeplanes filters documentation.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] doc/filters.texi: Adds documentation for sr filter.

2018-08-15 Thread Sergey Lavrushkin
Resending patch with documentation for sr filter.

---
 doc/filters.texi | 60 
 1 file changed, 60 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 267bd04a43..b2a74cb1ce 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -15403,6 +15403,66 @@ option may cause flicker since the B-Frames have often 
larger QP. Default is
 @code{0} (not enabled).
 @end table
 
+@section sr
+
+Scale the input by applying one of the super-resolution methods based on
+convolutional neural networks.
+
+Training scripts as well as scripts for model generation are provided in
+the repository @url{https://github.com/HighVoltageRocknRoll/sr.git}.
+
+The filter accepts the following options:
+
+@table @option
+@item model
+Specify which super-resolution model to use. This option accepts the following 
values:
+
+@table @samp
+@item srcnn
+Super-Resolution Convolutional Neural Network model
+@url{https://arxiv.org/abs/1501.00092}.
+
+@item espcn
+Efficient Sub-Pixel Convolutional Neural Network model
+@url{https://arxiv.org/abs/1609.05158}.
+
+@end table
+
+Default value is @samp{srcnn}.
+
+@item dnn_backend
+Specify which DNN backend to use for model loading and execution. This option 
accepts
+the following values:
+
+@table @samp
+@item native
+Native implementation of DNN loading and execution.
+
+@item tensorflow
+TensorFlow backend @url{https://www.tensorflow.org/}. To enable this backend 
you
+need to install the TensorFlow for C library (see
+@url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
+@code{--enable-libtensorflow}
+
+@end table
+
+Default value is @samp{native}.
+
+@item scale_factor
+Set scale factor for SRCNN model, for which custom model file was provided.
+Allowed values are @code{2}, @code{3} and @code{4}. Scale factor is necessary
+for SRCNN model, because it accepts input upscaled using bicubic upscaling with
+proper scale factor.
+
+Default value is @code{2}.
+
+@item model_filename
+Set path to model file specifying network architecture and its parameters.
+Note that different backends use different file formats. If path to model
+file is not specified, built-in models for 2x upscaling are used.
+
+@end table
+
 @anchor{subtitles}
 @section subtitles
 
-- 
2.14.1

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


Re: [FFmpeg-devel] [PATCH 1/2] doc/filters.texi: Adds documentation for sr filter.

2018-08-15 Thread Gyan Doshi



On 15-08-2018 10:05 PM, Sergey Lavrushkin wrote:

Resending patch with documentation for sr filter.


LGTM. Will apply with some small changes.

I've merged the docs entry in the 2nd part, so remove it from there.

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


Re: [FFmpeg-devel] [PATCH 1/2] doc/filters.texi: Adds documentation for sr filter.

2018-08-15 Thread Sergey Lavrushkin
2018-08-15 19:59 GMT+03:00 Gyan Doshi :

>
>
> On 15-08-2018 10:05 PM, Sergey Lavrushkin wrote:
>
>> Resending patch with documentation for sr filter.
>>
>
> LGTM. Will apply with some small changes.
>
> I've merged the docs entry in the 2nd part, so remove it from there.
>

This entry corresponds to changes made in the second patch.
Without these changes it is not true.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] doc/filters.texi: Adds documentation for sr filter.

2018-08-15 Thread Gyan Doshi



On 15-08-2018 11:28 PM, Sergey Lavrushkin wrote:

2018-08-15 19:59 GMT+03:00 Gyan Doshi :



LGTM. Will apply with some small changes.

I've merged the docs entry in the 2nd part, so remove it from there.



This entry corresponds to changes made in the second patch.
Without these changes it is not true.


Ok. So,

"TensorFlow backend can load files for both formats"

is currently inaccurate.

I think some devs are insistent on removing the tables, so it's a matter 
of a few days. I'll leave it in there.


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


Re: [FFmpeg-devel] [PATCH 1/2] doc/filters.texi: Adds documentation for sr filter.

2018-08-15 Thread James Almer
On 8/15/2018 2:58 PM, Sergey Lavrushkin wrote:
> 2018-08-15 19:59 GMT+03:00 Gyan Doshi :
> 
>>
>>
>> On 15-08-2018 10:05 PM, Sergey Lavrushkin wrote:
>>
>>> Resending patch with documentation for sr filter.
>>>
>>
>> LGTM. Will apply with some small changes.
>>
>> I've merged the docs entry in the 2nd part, so remove it from there.
>>
> 
> This entry corresponds to changes made in the second patch.
> Without these changes it is not true.

Should have been the second patch in the set, in that case. If a change
is split into two patches, one for code and one for documentation, then
the former goes first.
Gyan should have paid more attention to it as well, to be fair.

It's not a problem, in any case. The second patch should be applied as
well sooner or later.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] doc/filters.texi: Adds documentation for sr filter.

2018-08-15 Thread Gyan Doshi



On 15-08-2018 11:37 PM, James Almer wrote:


Should have been the second patch in the set, in that case. If a change
is split into two patches, one for code and one for documentation, then
the former goes first.
Gyan should have paid more attention to it as well, to be fair.


I assumed he made a mistake and decided to rewrite and included it in 
patch 2. Did not expect an accompanying patch to override changes 
proposed in another one from the same set.


Gyan

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


Re: [FFmpeg-devel] [PATCH] avformat/avidec: fix demuxing of all keyframes of sample 200707170736151.avi

2018-08-15 Thread Michael Niedermayer
Hi

On Tue, Aug 14, 2018 at 08:09:47PM +0200, Paul B Mahol wrote:
> Hi,
> 
> very important patch attached.

>  avidec.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> cafdde2706e703bcac31ddfada057ccce61518c9  
> 0001-avformat-avidec-fix-demuxing-of-all-keyframes-of-sam.patch
> From 52e92ad5b608c93690b5fceeebc306f094b1905f Mon Sep 17 00:00:00 2001
> From: Paul B Mahol 
> Date: Tue, 14 Aug 2018 20:06:32 +0200
> Subject: [PATCH] avformat/avidec: fix demuxing of all keyframes of sample
>  200707170736151.avi
> 
> ---
>  libavformat/avidec.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
> index bafe1dc8da..61aedb6354 100644
> --- a/libavformat/avidec.c
> +++ b/libavformat/avidec.c
> @@ -1279,9 +1279,9 @@ start_sync:
>  goto start_sync;
>  } else if (((ast->prefix_count < 5 || sync + 9 > i) &&
>  d[2] < 128 && d[3] < 128) ||
> -   d[2] * 256 + d[3] == ast->prefix /* ||
> -   (d[2] == 'd' && d[3] == 'c') ||
> -   (d[2] == 'w' && d[3] == 'b') */) {
> +   d[2] * 256 + d[3] == ast->prefix ||
> +   (d[2] == 'd' && (d[3] == 'c' || d[3] == 'b')) ||
> +   (d[2] == 'w' && d[3] == 'b')) {

This change is ok but it is not a correct fix for the bug

looking at the sample file
it contains "wc" chunks, which the avi demuxer fails to parse (they also
look like they violate the RIFF spec but that doesnt matter here)
now after failing to parse a wc chunk the demuxer goes into "error resync mode"
and searches for the next chunk. 
And this is why i think this is not correct: It searches the apparent inside
of the wc chunk for the next chunk. This then continues after the wc chunk.
But fails as the chunks oscilate within streams. You patch improves error resync
for these oscilating chunk types. But it still searches the "wc inside" and
that could fail if by bad luck a chunk like sequence of bytes occurs in it

Please somehow detect these special odd wc chunks and skip over them so this 
data
is not searched for other chunk matches.
This alone should fix the issue but your patch here LGTM too in addition

thanks

[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


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


Re: [FFmpeg-devel] [GSOC][PATCH 2/3] lavc/cfhd:corrected decompanding for table 9 used in cfhd

2018-08-15 Thread Kieran Kunhya
On Tue, 14 Aug 2018 at 08:43 Gagandeep Singh 
wrote:

> Second patch for fixing decompanding in table 9.
>
> Gagandeep Singh
>

Seems ok

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


Re: [FFmpeg-devel] [PATCH] avformat/mov: Allow saio/saiz in clear content.

2018-08-15 Thread Michael Niedermayer
On Tue, Aug 14, 2018 at 11:12:58AM -0700, Jacob Trimble wrote:
> On Tue, Aug 14, 2018 at 10:39 AM Jacob Trimble  wrote:
> >
> > If there is a saio/saiz in clear content, we shouldn't create the
> > encryption index if we don't already have one.  Otherwise it will
> > confuse the cenc_filter.
> >
> > Found by Chromium's ClusterFuzz: https://crbug.com/873432
> >
> > Signed-off-by: Jacob Trimble 
> > ---
> >  libavformat/mov.c | 28 ++--
> >  1 file changed, 18 insertions(+), 10 deletions(-)
> >
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index c863047d79..50bc1cab4b 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -5828,7 +5828,7 @@ static int mov_read_frma(MOVContext *c, AVIOContext 
> > *pb, MOVAtom atom)
> >   * info for this fragment; otherwise this will return the global encryption
> >   * info for the current stream.
> >   */
> > -static int get_current_encryption_info(MOVContext *c, MOVEncryptionIndex 
> > **encryption_index, MOVStreamContext **sc)
> > +static int get_current_encryption_info(MOVContext *c, MOVEncryptionIndex 
> > **encryption_index, MOVStreamContext **sc, int create)
> >  {
> >  MOVFragmentStreamInfo *frag_stream_info;
> >  AVStream *st;
> > @@ -5847,9 +5847,13 @@ static int get_current_encryption_info(MOVContext 
> > *c, MOVEncryptionIndex **encry
> >  *sc = st->priv_data;
> >
> >  if (!frag_stream_info->encryption_index) {
> > -frag_stream_info->encryption_index = 
> > av_mallocz(sizeof(*frag_stream_info->encryption_index));
> > -if (!frag_stream_info->encryption_index)
> > -return AVERROR(ENOMEM);
> > +if (create) {
> > +frag_stream_info->encryption_index = 
> > av_mallocz(sizeof(*frag_stream_info->encryption_index));
> > +if (!frag_stream_info->encryption_index)
> > +return AVERROR(ENOMEM);
> > +} else {
> > +return 0;
> > +}
> >  }
> >  *encryption_index = frag_stream_info->encryption_index;
> >  return 1;
> > @@ -5862,9 +5866,13 @@ static int get_current_encryption_info(MOVContext 
> > *c, MOVEncryptionIndex **encry
> >  *sc = st->priv_data;
> >
> >  if (!(*sc)->cenc.encryption_index) {
> > -(*sc)->cenc.encryption_index = 
> > av_mallocz(sizeof(*frag_stream_info->encryption_index));
> > -if (!(*sc)->cenc.encryption_index)
> > -return AVERROR(ENOMEM);
> > +if (create) {
> > +(*sc)->cenc.encryption_index = 
> > av_mallocz(sizeof(*frag_stream_info->encryption_index));
> > +if (!(*sc)->cenc.encryption_index)
> > +return AVERROR(ENOMEM);
> > +} else {
> > +return 0;
> > +}
> >  }
> >
> >  *encryption_index = (*sc)->cenc.encryption_index;
> > @@ -5931,7 +5939,7 @@ static int mov_read_senc(MOVContext *c, AVIOContext 
> > *pb, MOVAtom atom)
> >  int use_subsamples, ret;
> >  unsigned int sample_count, i, alloc_size = 0;
> >
> > -ret = get_current_encryption_info(c, &encryption_index, &sc);
> > +ret = get_current_encryption_info(c, &encryption_index, &sc, /* create 
> > */ 1);
> >  if (ret != 1)
> >  return ret;
> >
> > @@ -6078,7 +6086,7 @@ static int mov_read_saiz(MOVContext *c, AVIOContext 
> > *pb, MOVAtom atom)
> >  int ret;
> >  unsigned int sample_count, aux_info_type, aux_info_param;
> >
> > -ret = get_current_encryption_info(c, &encryption_index, &sc);
> > +ret = get_current_encryption_info(c, &encryption_index, &sc, /* create 
> > */ 0);
> >  if (ret != 1)
> >  return ret;
> >
> > @@ -6152,7 +6160,7 @@ static int mov_read_saio(MOVContext *c, AVIOContext 
> > *pb, MOVAtom atom)
> >  unsigned int version, entry_count, aux_info_type, aux_info_param;
> >  unsigned int alloc_size = 0;
> >
> > -ret = get_current_encryption_info(c, &encryption_index, &sc);
> > +ret = get_current_encryption_info(c, &encryption_index, &sc, /* create 
> > */ 0);
> >  if (ret != 1)
> >  return ret;
> >
> > --
> > 2.18.0.865.gffc8e1a3cd6-goog
> >
> 
> After thinking of this more, this was the incorrect fix.  Attached is
> the correct fix.

>  mov.c |6 ++
>  1 file changed, 6 insertions(+)
> 0e583b4ad11852ce38a2b945644e178b7f13a42f  
> 0001-avformat-mov-Allow-saio-saiz-in-clear-content-v2.patch
> From 256880aca517f64257eb28342a656867d90307a7 Mon Sep 17 00:00:00 2001
> From: Jacob Trimble 
> Date: Tue, 14 Aug 2018 10:18:55 -0700
> Subject: [PATCH] avformat/mov: Allow saio/saiz in clear content.

This code is used in saio/saiz/senc. The message only mentions the first
2. 


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Whats the most studid thing your enemy could do ? Blow himself up
Whats the most studid thing you could do ? Give up your rights and
freedom becau

Re: [FFmpeg-devel] [PATCH] avfilter/vf_hue: 10bit support

2018-08-15 Thread Michael Niedermayer
On Fri, Aug 03, 2018 at 05:39:20PM +0200, Reto Kromer wrote:
> Michael Niedermayer wrote:
> 
> >Signed-off-by: Michael Niedermayer 
> >---
> > libavfilter/vf_hue.c | 103 +++
> > +++-
> > 1 file changed, 92 insertions(+), 11 deletions(-)
> 
> On my side it works fine, but don't have any official status in
> the project.

will apply

thanks

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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH 4/4] lavc/mpeg4videodec: fix can't dump AVOptions issue.

2018-08-15 Thread Michael Niedermayer
On Wed, Aug 15, 2018 at 08:44:31AM +0800, myp...@gmail.com wrote:
> On Tue, Aug 14, 2018 at 11:39 PM Michael Niedermayer 
> wrote:
> >
> > On Mon, Aug 13, 2018 at 09:51:47PM +0800, Jun Zhao wrote:
> > > fix can't dump the mpeg4videodec option with the command
> > > "ffmpeg -h decoder=mpeg4".
> > >
> > > Signed-off-by: Jun Zhao 
> > > ---
> > >  libavcodec/mpeg4videodec.c |5 +++--
> > >  1 files changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
> > > index 24c280d..549b7a5 100644
> > > --- a/libavcodec/mpeg4videodec.c
> > > +++ b/libavcodec/mpeg4videodec.c
> > > @@ -3435,9 +3435,10 @@ static av_cold int decode_end(AVCodecContext
> *avctx)
> > >  return ff_h263_decode_end(avctx, just );
> > >  }
> > >
> > > +#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
> > >  static const AVOption mpeg4_options[] = {
> > > -{"quarter_sample", "1/4 subpel MC", offsetof(MpegEncContext,
> quarter_sample), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0},
> > > -{"divx_packed", "divx style packed b frames",
> offsetof(MpegEncContext, divx_packed), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,
> 0},
> > > +{"quarter_sample", "1/4 subpel MC", offsetof(MpegEncContext,
> quarter_sample), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VD},
> > > +{"divx_packed", "divx style packed b frames",
> offsetof(MpegEncContext, divx_packed), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,
> VD},
> > >  {NULL}
> >
> > These are not options for the user to set, they are not supposed to be
> > in the "ffmpeg -h decoder=mpeg4" listing
> >
> >
> What's the reason
> to
> use the mpeg4_option for quarter_sample/divx_packed,  just want to
> initialize them?

They are there so the user application can access (read) their values cleanly

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

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


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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/scpr: Check for min > max in decompress_p()

2018-08-15 Thread Michael Niedermayer
On Mon, Aug 06, 2018 at 09:05:51AM +0200, Paul B Mahol wrote:
> On 8/5/18, Michael Niedermayer  wrote:
> > On Sun, Aug 05, 2018 at 10:08:31AM +0200, Paul B Mahol wrote:
> >> On 8/5/18, Michael Niedermayer  wrote:
> >> > Fixes: Timeout
> >> > Fixes:
> >> > 9342/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-4795990841229312
> >> >
> >> > Found-by: continuous fuzzing process
> >> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> >> > Signed-off-by: Michael Niedermayer 
> >> > ---
> >> >  libavcodec/scpr.c | 3 +++
> >> >  1 file changed, 3 insertions(+)
> >> >
> >> > diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c
> >> > index 72f59d5917..d1e47b09ac 100644
> >> > --- a/libavcodec/scpr.c
> >> > +++ b/libavcodec/scpr.c
> >> > @@ -525,6 +525,9 @@ static int decompress_p(AVCodecContext *avctx,
> >> >  if (ret < 0)
> >> >  return ret;
> >> >
> >> > +if (min > max)
> >> > +return AVERROR_INVALIDDATA;
> >> > +
> >>
> >> Shouldn't this check be actually bellow?
> >
> > yes, fixed, locally
> >
> >
> >> You sure this does not break valid files?
> >
> > i found no file that it breaks, beyond this, no iam not sure.
> > It mostly based on logic thinking that these would not be ordered the
> > other way, as that seems not usefull
> >
> > Is there some specification or more files i can test ?
> 
> It should be fine.

will apply

thx

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

"I am not trying to be anyone's saviour, I'm trying to think about the
 future and not be sad" - Elon Musk



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


Re: [FFmpeg-devel] [PATCH] fix memory leak in frame_thread_encoder: occurs when close encoder without sending eof and receiving to end

2018-08-15 Thread Michael Niedermayer
On Mon, Aug 06, 2018 at 01:13:00AM +0200, Michael Niedermayer wrote:
> On Sat, Aug 04, 2018 at 10:19:45AM +, lee ju wrote:
> > ---
> >  libavcodec/frame_thread_encoder.c | 17 +
> >  1 file changed, 17 insertions(+)
> 
> probably ok

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 


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


Re: [FFmpeg-devel] [PATCH 1/6] avcodec/shorten: Check verbatim length

2018-08-15 Thread Michael Niedermayer
On Mon, Aug 13, 2018 at 02:24:18AM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 
> 9252/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5780720709533696
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 

will apply

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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


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/6] avcodec/shorten: Fix integer overflow in residual/LPC combination

2018-08-15 Thread Michael Niedermayer
On Mon, Aug 13, 2018 at 02:24:19AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: -540538872 + -2012739576 cannot be 
> represented in type 'int'
> Fixes: 
> 9255/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5758630052757504
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 

will apply

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

Democracy is the form of government in which you can choose your dictator


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


Re: [FFmpeg-devel] [PATCH 3/6] avcodec/shorten: Fix signed 32bit overflow in shift in shorten_decode_frame()

2018-08-15 Thread Michael Niedermayer
On Mon, Aug 13, 2018 at 02:24:20AM +0200, Michael Niedermayer wrote:
> Fixes: runtime error: left shift of 1 by 31 places cannot be represented in 
> type 'int'
> Fixes: 
> 9480/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-6647324284551168
>  -rss_limit_mb=2000
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/shorten.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

No snowflake in an avalanche ever feels responsible. -- Voltaire


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


Re: [FFmpeg-devel] Resending Patch for hlsenc.c fixes for https://trac.ffmpeg.org/ticket/7281

2018-08-15 Thread Ronak Patel

> On Aug 15, 2018, at 11:08 AM, Steven Liu  wrote:
> 
> 
> 
>> On Aug 15, 2018, at 09:31, Ronak  wrote:
>> 
>> From: "Ronak Patel" mailto:ron...@audible.com>yahoo.com>
>> 
>> This fixes the creation of the hls manifest in hlsenc.c by writing the 
>> entire manifest at the end for VOD playlists. Live & Event Playlists are 
>> unaffected.
>> This also fixes the behavior with HLS_TEMP_FILE to work correctly when 
>> -hlsflags temp_file is specified, instead of always relying on use_rename, 
>> which caused these problems.
>> 
>> Files that would previously take over a week to fragment now take 1 minute 
>> on the same hardware. This was a 153 hour audio file (2.2GB of audio).
>> 
>> Signed-off-by: Ronak Patel mailto:ronak2...@yahoo.com>>
>> ---
>> libavformat/hlsenc.c | 51 ---
>> 1 file changed, 36 insertions(+), 15 deletions(-)
>> 
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index b5644f0..7933b79 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -1168,7 +1168,6 @@ static int hls_rename_temp_file(AVFormatContext *s, 
>> AVFormatContext *oc)
>>return AVERROR(ENOMEM);
>>final_filename[len-4] = '\0';
>>ret = ff_rename(oc->url, final_filename, s);
>> -oc->url[len-4] = '\0';
>>av_freep(&final_filename);
>>return ret;
>> }
>> @@ -1374,7 +1373,7 @@ static int hls_window(AVFormatContext *s, int last, 
>> VariantStream *vs)
>>char temp_filename[1024];
>>int64_t sequence = FFMAX(hls->start_sequence, vs->sequence - 
>> vs->nb_entries);
>>const char *proto = avio_find_protocol_name(s->url);
>> -int use_rename = proto && !strcmp(proto, "file");
>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>> HLS_TEMP_FILE);
>>static unsigned warned_non_file;
>>char *key_uri = NULL;
>>char *iv_string = NULL;
>> @@ -1397,11 +1396,11 @@ static int hls_window(AVFormatContext *s, int last, 
>> VariantStream *vs)
>>hls->version = 7;
>>}
>> -if (!use_rename && !warned_non_file++)
>> +if (!use_temp_file && !warned_non_file++)
>>av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
>> may lead to races and temporary partial files\n");
>>set_http_options(s, &options, hls);
>> -snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : 
>> "%s", vs->m3u8_name);
>> +snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? "%s.tmp" 
>> : "%s", vs->m3u8_name);
>>if ((ret = hlsenc_io_open(s, &hls->m3u8_out, temp_filename, &options)) < 
>> 0)
>>goto fail;
>> @@ -1472,8 +1471,8 @@ fail:
>>av_dict_free(&options);
>>hlsenc_io_close(s, &hls->m3u8_out, temp_filename);
>>hlsenc_io_close(s, &hls->sub_m3u8_out, vs->vtt_m3u8_name);
>> -if (ret >= 0 && use_rename)
>> -ff_rename(temp_filename, vs->m3u8_name, s);
>> +if (use_temp_file)
>> +ff_rename(temp_filename, vs->m3u8_name, s);
>>if (ret >= 0 && hls->master_pl_name)
>>if (create_master_playlist(s, vs) < 0)
>> @@ -1488,6 +1487,8 @@ static int hls_start(AVFormatContext *s, VariantStream 
>> *vs)
>>AVFormatContext *oc = vs->avf;
>>AVFormatContext *vtt_oc = vs->vtt_avf;
>>AVDictionary *options = NULL;
>> +const char *proto = avio_find_protocol_name(s->url);
>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>> HLS_TEMP_FILE);
>>char *filename, iv_string[KEYSIZE*2 + 1];
>>int err = 0;
>> @@ -1583,7 +1584,7 @@ static int hls_start(AVFormatContext *s, VariantStream 
>> *vs)
>>set_http_options(s, &options, c);
>> -if (c->flags & HLS_TEMP_FILE) {
>> +if (use_temp_file) {
>>char *new_name = av_asprintf("%s.tmp", oc->url);
>>if (!new_name)
>>return AVERROR(ENOMEM);
>> @@ -2145,6 +2146,8 @@ static int hls_write_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>int ret = 0, can_split = 1, i, j;
>>int stream_index = 0;
>>int range_length = 0;
>> +const char *proto = avio_find_protocol_name(s->url);
>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>> HLS_TEMP_FILE);
>>uint8_t *buffer = NULL;
>>VariantStream *vs = NULL;
>>AVDictionary *options = NULL;
>> @@ -2214,10 +2217,10 @@ static int hls_write_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>}
>> +char *old_filename = NULL;
>>if (vs->packets_written && can_split && av_compare_ts(pkt->pts - 
>> vs->start_pts, st->time_base,
>>  end_pts, 
>> AV_TIME_BASE_Q) >= 0) {
>>int64_t new_start_pos;
>> -char *old_filename = NULL;
>>int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || 
>> (hls->max_seg_size > 0);
>>av_write_frame(vs->avf, NULL); /* Flush any buffered data */
>> @@ -2253,11 +2256,13 @@ static int hls_write_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>hlsenc_io_close(s, &vs->vtt_avf->pb, vs->vtt_avf->url)

Re: [FFmpeg-devel] Resending Patch for hlsenc.c fixes for https://trac.ffmpeg.org/ticket/7281

2018-08-15 Thread Steven Liu


> On Aug 16, 2018, at 07:41, Ronak Patel  wrote:
> 
>> 
>> On Aug 15, 2018, at 11:08 AM, Steven Liu  wrote:
>> 
>> 
>> 
>>> On Aug 15, 2018, at 09:31, Ronak  wrote:
>>> 
>>> From: "Ronak Patel" mailto:ron...@audible.com>yahoo.com>
>>> 
>>> This fixes the creation of the hls manifest in hlsenc.c by writing the 
>>> entire manifest at the end for VOD playlists. Live & Event Playlists are 
>>> unaffected.
>>> This also fixes the behavior with HLS_TEMP_FILE to work correctly when 
>>> -hlsflags temp_file is specified, instead of always relying on use_rename, 
>>> which caused these problems.
>>> 
>>> Files that would previously take over a week to fragment now take 1 minute 
>>> on the same hardware. This was a 153 hour audio file (2.2GB of audio).
>>> 
>>> Signed-off-by: Ronak Patel >> >
>>> ---
>>> libavformat/hlsenc.c | 51 
>>> ---
>>> 1 file changed, 36 insertions(+), 15 deletions(-)
>>> 
>>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>>> index b5644f0..7933b79 100644
>>> --- a/libavformat/hlsenc.c
>>> +++ b/libavformat/hlsenc.c
>>> @@ -1168,7 +1168,6 @@ static int hls_rename_temp_file(AVFormatContext *s, 
>>> AVFormatContext *oc)
>>>   return AVERROR(ENOMEM);
>>>   final_filename[len-4] = '\0';
>>>   ret = ff_rename(oc->url, final_filename, s);
>>> -oc->url[len-4] = '\0';
>>>   av_freep(&final_filename);
>>>   return ret;
>>> }
>>> @@ -1374,7 +1373,7 @@ static int hls_window(AVFormatContext *s, int last, 
>>> VariantStream *vs)
>>>   char temp_filename[1024];
>>>   int64_t sequence = FFMAX(hls->start_sequence, vs->sequence - 
>>> vs->nb_entries);
>>>   const char *proto = avio_find_protocol_name(s->url);
>>> -int use_rename = proto && !strcmp(proto, "file");
>>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>>> HLS_TEMP_FILE);
>>>   static unsigned warned_non_file;
>>>   char *key_uri = NULL;
>>>   char *iv_string = NULL;
>>> @@ -1397,11 +1396,11 @@ static int hls_window(AVFormatContext *s, int last, 
>>> VariantStream *vs)
>>>   hls->version = 7;
>>>   }
>>> -if (!use_rename && !warned_non_file++)
>>> +if (!use_temp_file && !warned_non_file++)
>>>   av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
>>> may lead to races and temporary partial files\n");
>>>   set_http_options(s, &options, hls);
>>> -snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : 
>>> "%s", vs->m3u8_name);
>>> +snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? 
>>> "%s.tmp" : "%s", vs->m3u8_name);
>>>   if ((ret = hlsenc_io_open(s, &hls->m3u8_out, temp_filename, &options)) < 
>>> 0)
>>>   goto fail;
>>> @@ -1472,8 +1471,8 @@ fail:
>>>   av_dict_free(&options);
>>>   hlsenc_io_close(s, &hls->m3u8_out, temp_filename);
>>>   hlsenc_io_close(s, &hls->sub_m3u8_out, vs->vtt_m3u8_name);
>>> -if (ret >= 0 && use_rename)
>>> -ff_rename(temp_filename, vs->m3u8_name, s);
>>> +if (use_temp_file)
>>> +ff_rename(temp_filename, vs->m3u8_name, s);
>>>   if (ret >= 0 && hls->master_pl_name)
>>>   if (create_master_playlist(s, vs) < 0)
>>> @@ -1488,6 +1487,8 @@ static int hls_start(AVFormatContext *s, 
>>> VariantStream *vs)
>>>   AVFormatContext *oc = vs->avf;
>>>   AVFormatContext *vtt_oc = vs->vtt_avf;
>>>   AVDictionary *options = NULL;
>>> +const char *proto = avio_find_protocol_name(s->url);
>>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>>> HLS_TEMP_FILE);
>>>   char *filename, iv_string[KEYSIZE*2 + 1];
>>>   int err = 0;
>>> @@ -1583,7 +1584,7 @@ static int hls_start(AVFormatContext *s, 
>>> VariantStream *vs)
>>>   set_http_options(s, &options, c);
>>> -if (c->flags & HLS_TEMP_FILE) {
>>> +if (use_temp_file) {
>>>   char *new_name = av_asprintf("%s.tmp", oc->url);
>>>   if (!new_name)
>>>   return AVERROR(ENOMEM);
>>> @@ -2145,6 +2146,8 @@ static int hls_write_packet(AVFormatContext *s, 
>>> AVPacket *pkt)
>>>   int ret = 0, can_split = 1, i, j;
>>>   int stream_index = 0;
>>>   int range_length = 0;
>>> +const char *proto = avio_find_protocol_name(s->url);
>>> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
>>> HLS_TEMP_FILE);
>>>   uint8_t *buffer = NULL;
>>>   VariantStream *vs = NULL;
>>>   AVDictionary *options = NULL;
>>> @@ -2214,10 +2217,10 @@ static int hls_write_packet(AVFormatContext *s, 
>>> AVPacket *pkt)
>>>   }
>>> +char *old_filename = NULL;
>>>   if (vs->packets_written && can_split && av_compare_ts(pkt->pts - 
>>> vs->start_pts, st->time_base,
>>> end_pts, 
>>> AV_TIME_BASE_Q) >= 0) {
>>>   int64_t new_start_pos;
>>> -char *old_filename = NULL;
>>>   int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || 
>>> (hls->max_seg_size > 0);
>>>   av_write_frame(vs->avf, NULL); /* Flush any buffered data */
>>> @@ -2253,11 +2256,13 @@

Re: [FFmpeg-devel] [PATCH 4/4] lavc/mpeg4videodec: fix can't dump AVOptions issue.

2018-08-15 Thread myp...@gmail.com
On Thu, Aug 16, 2018 at 6:16 AM Michael Niedermayer
 wrote:
>
> On Wed, Aug 15, 2018 at 08:44:31AM +0800, myp...@gmail.com wrote:
> > On Tue, Aug 14, 2018 at 11:39 PM Michael Niedermayer 
> > 
> > wrote:
> > >
> > > On Mon, Aug 13, 2018 at 09:51:47PM +0800, Jun Zhao wrote:
> > > > fix can't dump the mpeg4videodec option with the command
> > > > "ffmpeg -h decoder=mpeg4".
> > > >
> > > > Signed-off-by: Jun Zhao 
> > > > ---
> > > >  libavcodec/mpeg4videodec.c |5 +++--
> > > >  1 files changed, 3 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
> > > > index 24c280d..549b7a5 100644
> > > > --- a/libavcodec/mpeg4videodec.c
> > > > +++ b/libavcodec/mpeg4videodec.c
> > > > @@ -3435,9 +3435,10 @@ static av_cold int decode_end(AVCodecContext
> > *avctx)
> > > >  return ff_h263_decode_end(avctx, just );
> > > >  }
> > > >
> > > > +#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
> > > >  static const AVOption mpeg4_options[] = {
> > > > -{"quarter_sample", "1/4 subpel MC", offsetof(MpegEncContext,
> > quarter_sample), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0},
> > > > -{"divx_packed", "divx style packed b frames",
> > offsetof(MpegEncContext, divx_packed), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,
> > 0},
> > > > +{"quarter_sample", "1/4 subpel MC", offsetof(MpegEncContext,
> > quarter_sample), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VD},
> > > > +{"divx_packed", "divx style packed b frames",
> > offsetof(MpegEncContext, divx_packed), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,
> > VD},
> > > >  {NULL}
> > >
> > > These are not options for the user to set, they are not supposed to be
> > > in the "ffmpeg -h decoder=mpeg4" listing
> > >
> > >
> > What's the reason
> > to
> > use the mpeg4_option for quarter_sample/divx_packed,  just want to
> > initialize them?
>
> They are there so the user application can access (read) their values cleanly
>
I see, thanks the clarification..
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iEYEARECAAYFAlt0pjoACgkQYR7HhwQLD6ucqACfZCPlr+yUPWBIvlke+r7MLAWB
QawAn0DroTpGBXHjBNE5SO15bWknIy72
=IxqQ
-END PGP SIGNATURE-
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Resending Patch for hlsenc.c fixes for https://trac.ffmpeg.org/ticket/7281

2018-08-15 Thread Ronak Patel

> On Aug 15, 2018, at 8:39 PM, Ronak Patel  wrote:
> 
> 
>> On Aug 15, 2018, at 8:21 PM, Steven Liu  wrote:
>> 
>> 
>> 
 On Aug 16, 2018, at 07:41, Ronak Patel  wrote:
 
 
 On Aug 15, 2018, at 11:08 AM, Steven Liu  wrote:
 
 
 
> On Aug 15, 2018, at 09:31, Ronak  
> wrote:
> 
> From: "Ronak Patel" mailto:ron...@audible.com>yahoo.com>
> 
> This fixes the creation of the hls manifest in hlsenc.c by writing the 
> entire manifest at the end for VOD playlists. Live & Event Playlists are 
> unaffected.
> This also fixes the behavior with HLS_TEMP_FILE to work correctly when 
> -hlsflags temp_file is specified, instead of always relying on 
> use_rename, which caused these problems.
> 
> Files that would previously take over a week to fragment now take 1 
> minute on the same hardware. This was a 153 hour audio file (2.2GB of 
> audio).
> 
> Signed-off-by: Ronak Patel  >
> ---
> libavformat/hlsenc.c | 51 
> ---
> 1 file changed, 36 insertions(+), 15 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index b5644f0..7933b79 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1168,7 +1168,6 @@ static int hls_rename_temp_file(AVFormatContext *s, 
> AVFormatContext *oc)
> return AVERROR(ENOMEM);
> final_filename[len-4] = '\0';
> ret = ff_rename(oc->url, final_filename, s);
> -oc->url[len-4] = '\0';
> av_freep(&final_filename);
> return ret;
> }
> @@ -1374,7 +1373,7 @@ static int hls_window(AVFormatContext *s, int last, 
> VariantStream *vs)
> char temp_filename[1024];
> int64_t sequence = FFMAX(hls->start_sequence, vs->sequence - 
> vs->nb_entries);
> const char *proto = avio_find_protocol_name(s->url);
> -int use_rename = proto && !strcmp(proto, "file");
> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
> HLS_TEMP_FILE);
> static unsigned warned_non_file;
> char *key_uri = NULL;
> char *iv_string = NULL;
> @@ -1397,11 +1396,11 @@ static int hls_window(AVFormatContext *s, int 
> last, VariantStream *vs)
> hls->version = 7;
> }
> -if (!use_rename && !warned_non_file++)
> +if (!use_temp_file && !warned_non_file++)
> av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
> may lead to races and temporary partial files\n");
> set_http_options(s, &options, hls);
> -snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" 
> : "%s", vs->m3u8_name);
> +snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? 
> "%s.tmp" : "%s", vs->m3u8_name);
> if ((ret = hlsenc_io_open(s, &hls->m3u8_out, temp_filename, &options)) < 
> 0)
> goto fail;
> @@ -1472,8 +1471,8 @@ fail:
> av_dict_free(&options);
> hlsenc_io_close(s, &hls->m3u8_out, temp_filename);
> hlsenc_io_close(s, &hls->sub_m3u8_out, vs->vtt_m3u8_name);
> -if (ret >= 0 && use_rename)
> -ff_rename(temp_filename, vs->m3u8_name, s);
> +if (use_temp_file)
> +ff_rename(temp_filename, vs->m3u8_name, s);
> if (ret >= 0 && hls->master_pl_name)
> if (create_master_playlist(s, vs) < 0)
> @@ -1488,6 +1487,8 @@ static int hls_start(AVFormatContext *s, 
> VariantStream *vs)
> AVFormatContext *oc = vs->avf;
> AVFormatContext *vtt_oc = vs->vtt_avf;
> AVDictionary *options = NULL;
> +const char *proto = avio_find_protocol_name(s->url);
> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
> HLS_TEMP_FILE);
> char *filename, iv_string[KEYSIZE*2 + 1];
> int err = 0;
> @@ -1583,7 +1584,7 @@ static int hls_start(AVFormatContext *s, 
> VariantStream *vs)
> set_http_options(s, &options, c);
> -if (c->flags & HLS_TEMP_FILE) {
> +if (use_temp_file) {
> char *new_name = av_asprintf("%s.tmp", oc->url);
> if (!new_name)
> return AVERROR(ENOMEM);
> @@ -2145,6 +2146,8 @@ static int hls_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
> int ret = 0, can_split = 1, i, j;
> int stream_index = 0;
> int range_length = 0;
> +const char *proto = avio_find_protocol_name(s->url);
> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
> HLS_TEMP_FILE);
> uint8_t *buffer = NULL;
> VariantStream *vs = NULL;
> AVDictionary *options = NULL;
> @@ -2214,10 +2217,10 @@ static int hls_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
> }
> +char *old_filename = NULL;
> if (vs->packets_written && can_split && av_compare_ts(pkt->pts - 
> vs->start_pts, st->time_base,
>   end_pts, 
> AV_

Re: [FFmpeg-devel] Resending Patch for hlsenc.c fixes for https://trac.ffmpeg.org/ticket/7281

2018-08-15 Thread Steven Liu


> On Aug 16, 2018, at 08:39, Ronak Patel  wrote:
> 
>> 
>> On Aug 15, 2018, at 8:21 PM, Steven Liu  wrote:
>> 
>> 
>> 
 On Aug 16, 2018, at 07:41, Ronak Patel  wrote:
 
 
 On Aug 15, 2018, at 11:08 AM, Steven Liu  wrote:
 
 
 
> On Aug 15, 2018, at 09:31, Ronak  
> wrote:
> 
> From: "Ronak Patel" mailto:ron...@audible.com>yahoo.com>
> 
> This fixes the creation of the hls manifest in hlsenc.c by writing the 
> entire manifest at the end for VOD playlists. Live & Event Playlists are 
> unaffected.
> This also fixes the behavior with HLS_TEMP_FILE to work correctly when 
> -hlsflags temp_file is specified, instead of always relying on 
> use_rename, which caused these problems.
> 
> Files that would previously take over a week to fragment now take 1 
> minute on the same hardware. This was a 153 hour audio file (2.2GB of 
> audio).
> 
> Signed-off-by: Ronak Patel  >
> ---
> libavformat/hlsenc.c | 51 
> ---
> 1 file changed, 36 insertions(+), 15 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index b5644f0..7933b79 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -1168,7 +1168,6 @@ static int hls_rename_temp_file(AVFormatContext *s, 
> AVFormatContext *oc)
> return AVERROR(ENOMEM);
> final_filename[len-4] = '\0';
> ret = ff_rename(oc->url, final_filename, s);
> -oc->url[len-4] = '\0';
> av_freep(&final_filename);
> return ret;
> }
> @@ -1374,7 +1373,7 @@ static int hls_window(AVFormatContext *s, int last, 
> VariantStream *vs)
> char temp_filename[1024];
> int64_t sequence = FFMAX(hls->start_sequence, vs->sequence - 
> vs->nb_entries);
> const char *proto = avio_find_protocol_name(s->url);
> -int use_rename = proto && !strcmp(proto, "file");
> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
> HLS_TEMP_FILE);
> static unsigned warned_non_file;
> char *key_uri = NULL;
> char *iv_string = NULL;
> @@ -1397,11 +1396,11 @@ static int hls_window(AVFormatContext *s, int 
> last, VariantStream *vs)
> hls->version = 7;
> }
> -if (!use_rename && !warned_non_file++)
> +if (!use_temp_file && !warned_non_file++)
> av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
> may lead to races and temporary partial files\n");
> set_http_options(s, &options, hls);
> -snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" 
> : "%s", vs->m3u8_name);
> +snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? 
> "%s.tmp" : "%s", vs->m3u8_name);
> if ((ret = hlsenc_io_open(s, &hls->m3u8_out, temp_filename, &options)) < 
> 0)
> goto fail;
> @@ -1472,8 +1471,8 @@ fail:
> av_dict_free(&options);
> hlsenc_io_close(s, &hls->m3u8_out, temp_filename);
> hlsenc_io_close(s, &hls->sub_m3u8_out, vs->vtt_m3u8_name);
> -if (ret >= 0 && use_rename)
> -ff_rename(temp_filename, vs->m3u8_name, s);
> +if (use_temp_file)
> +ff_rename(temp_filename, vs->m3u8_name, s);
> if (ret >= 0 && hls->master_pl_name)
> if (create_master_playlist(s, vs) < 0)
> @@ -1488,6 +1487,8 @@ static int hls_start(AVFormatContext *s, 
> VariantStream *vs)
> AVFormatContext *oc = vs->avf;
> AVFormatContext *vtt_oc = vs->vtt_avf;
> AVDictionary *options = NULL;
> +const char *proto = avio_find_protocol_name(s->url);
> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
> HLS_TEMP_FILE);
> char *filename, iv_string[KEYSIZE*2 + 1];
> int err = 0;
> @@ -1583,7 +1584,7 @@ static int hls_start(AVFormatContext *s, 
> VariantStream *vs)
> set_http_options(s, &options, c);
> -if (c->flags & HLS_TEMP_FILE) {
> +if (use_temp_file) {
> char *new_name = av_asprintf("%s.tmp", oc->url);
> if (!new_name)
> return AVERROR(ENOMEM);
> @@ -2145,6 +2146,8 @@ static int hls_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
> int ret = 0, can_split = 1, i, j;
> int stream_index = 0;
> int range_length = 0;
> +const char *proto = avio_find_protocol_name(s->url);
> +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
> HLS_TEMP_FILE);
> uint8_t *buffer = NULL;
> VariantStream *vs = NULL;
> AVDictionary *options = NULL;
> @@ -2214,10 +2217,10 @@ static int hls_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
> }
> +char *old_filename = NULL;
> if (vs->packets_written && can_split && av_compare_ts(pkt->pts - 
> vs->start_pts, st->time_base,
>   end_pts, 
> AV_

Re: [FFmpeg-devel] Resending Patch for hlsenc.c fixes for https://trac.ffmpeg.org/ticket/7281

2018-08-15 Thread Ronak Patel

> On Aug 15, 2018, at 8:21 PM, Steven Liu  wrote:
> 
> 
> 
>>> On Aug 16, 2018, at 07:41, Ronak Patel  wrote:
>>> 
>>> 
>>> On Aug 15, 2018, at 11:08 AM, Steven Liu  wrote:
>>> 
>>> 
>>> 
 On Aug 15, 2018, at 09:31, Ronak  wrote:
 
 From: "Ronak Patel" mailto:ron...@audible.com>yahoo.com>
 
 This fixes the creation of the hls manifest in hlsenc.c by writing the 
 entire manifest at the end for VOD playlists. Live & Event Playlists are 
 unaffected.
 This also fixes the behavior with HLS_TEMP_FILE to work correctly when 
 -hlsflags temp_file is specified, instead of always relying on use_rename, 
 which caused these problems.
 
 Files that would previously take over a week to fragment now take 1 minute 
 on the same hardware. This was a 153 hour audio file (2.2GB of audio).
 
 Signed-off-by: Ronak Patel >>> >
 ---
 libavformat/hlsenc.c | 51 
 ---
 1 file changed, 36 insertions(+), 15 deletions(-)
 
 diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
 index b5644f0..7933b79 100644
 --- a/libavformat/hlsenc.c
 +++ b/libavformat/hlsenc.c
 @@ -1168,7 +1168,6 @@ static int hls_rename_temp_file(AVFormatContext *s, 
 AVFormatContext *oc)
  return AVERROR(ENOMEM);
  final_filename[len-4] = '\0';
  ret = ff_rename(oc->url, final_filename, s);
 -oc->url[len-4] = '\0';
  av_freep(&final_filename);
  return ret;
 }
 @@ -1374,7 +1373,7 @@ static int hls_window(AVFormatContext *s, int last, 
 VariantStream *vs)
  char temp_filename[1024];
  int64_t sequence = FFMAX(hls->start_sequence, vs->sequence - 
 vs->nb_entries);
  const char *proto = avio_find_protocol_name(s->url);
 -int use_rename = proto && !strcmp(proto, "file");
 +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
 HLS_TEMP_FILE);
  static unsigned warned_non_file;
  char *key_uri = NULL;
  char *iv_string = NULL;
 @@ -1397,11 +1396,11 @@ static int hls_window(AVFormatContext *s, int 
 last, VariantStream *vs)
  hls->version = 7;
  }
 -if (!use_rename && !warned_non_file++)
 +if (!use_temp_file && !warned_non_file++)
  av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this 
 may lead to races and temporary partial files\n");
  set_http_options(s, &options, hls);
 -snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" 
 : "%s", vs->m3u8_name);
 +snprintf(temp_filename, sizeof(temp_filename), use_temp_file ? 
 "%s.tmp" : "%s", vs->m3u8_name);
  if ((ret = hlsenc_io_open(s, &hls->m3u8_out, temp_filename, &options)) < 
 0)
  goto fail;
 @@ -1472,8 +1471,8 @@ fail:
  av_dict_free(&options);
  hlsenc_io_close(s, &hls->m3u8_out, temp_filename);
  hlsenc_io_close(s, &hls->sub_m3u8_out, vs->vtt_m3u8_name);
 -if (ret >= 0 && use_rename)
 -ff_rename(temp_filename, vs->m3u8_name, s);
 +if (use_temp_file)
 +ff_rename(temp_filename, vs->m3u8_name, s);
  if (ret >= 0 && hls->master_pl_name)
  if (create_master_playlist(s, vs) < 0)
 @@ -1488,6 +1487,8 @@ static int hls_start(AVFormatContext *s, 
 VariantStream *vs)
  AVFormatContext *oc = vs->avf;
  AVFormatContext *vtt_oc = vs->vtt_avf;
  AVDictionary *options = NULL;
 +const char *proto = avio_find_protocol_name(s->url);
 +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
 HLS_TEMP_FILE);
  char *filename, iv_string[KEYSIZE*2 + 1];
  int err = 0;
 @@ -1583,7 +1584,7 @@ static int hls_start(AVFormatContext *s, 
 VariantStream *vs)
  set_http_options(s, &options, c);
 -if (c->flags & HLS_TEMP_FILE) {
 +if (use_temp_file) {
  char *new_name = av_asprintf("%s.tmp", oc->url);
  if (!new_name)
  return AVERROR(ENOMEM);
 @@ -2145,6 +2146,8 @@ static int hls_write_packet(AVFormatContext *s, 
 AVPacket *pkt)
  int ret = 0, can_split = 1, i, j;
  int stream_index = 0;
  int range_length = 0;
 +const char *proto = avio_find_protocol_name(s->url);
 +int use_temp_file = proto && !strcmp(proto, "file") && (s->flags & 
 HLS_TEMP_FILE);
  uint8_t *buffer = NULL;
  VariantStream *vs = NULL;
  AVDictionary *options = NULL;
 @@ -2214,10 +2217,10 @@ static int hls_write_packet(AVFormatContext *s, 
 AVPacket *pkt)
  }
 +char *old_filename = NULL;
  if (vs->packets_written && can_split && av_compare_ts(pkt->pts - 
 vs->start_pts, st->time_base,
end_pts, 
 AV_TIME_BASE_Q) >= 0) {
  int64_t new_start_pos;
 -char *old_filename = NULL;
  int byterange_mode = (hls->flags & HLS_SINGLE_

[FFmpeg-devel] [PATCH] lavc/hevc_ps: fix crop info

2018-08-15 Thread Zhao Zhili
---
 libavcodec/hevc_ps.c | 26 ++
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index fbd9fbf..4161ab6 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -628,8 +628,17 @@ static void decode_vui(GetBitContext *gb, AVCodecContext 
*avctx,
 vui->default_display_window_flag = get_bits1(gb);
 
 if (vui->default_display_window_flag) {
-int vert_mult  = 1 + (sps->chroma_format_idc < 2);
-int horiz_mult = 1 + (sps->chroma_format_idc < 3);
+unsigned horiz_mult, vert_mult;
+if (sps->chroma_format_idc == 1) {
+horiz_mult = 2;
+vert_mult = 2;
+} else if (sps->chroma_format_idc == 2) {
+horiz_mult = 2;
+vert_mult = 1;
+} else {
+horiz_mult = 1;
+vert_mult = 1;
+}
 vui->def_disp_win.left_offset   = get_ue_golomb_long(gb) * horiz_mult;
 vui->def_disp_win.right_offset  = get_ue_golomb_long(gb) * horiz_mult;
 vui->def_disp_win.top_offset= get_ue_golomb_long(gb) *  vert_mult;
@@ -923,8 +932,17 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, 
unsigned int *sps_id,
 return ret;
 
 if (get_bits1(gb)) { // pic_conformance_flag
-int vert_mult  = 1 + (sps->chroma_format_idc < 2);
-int horiz_mult = 1 + (sps->chroma_format_idc < 3);
+unsigned horiz_mult, vert_mult;
+if (sps->chroma_format_idc == 1) {
+horiz_mult = 2;
+vert_mult = 2;
+} else if (sps->chroma_format_idc == 2) {
+horiz_mult = 2;
+vert_mult = 1;
+} else {
+horiz_mult = 1;
+vert_mult = 1;
+}
 sps->pic_conf_win.left_offset   = get_ue_golomb_long(gb) * horiz_mult;
 sps->pic_conf_win.right_offset  = get_ue_golomb_long(gb) * horiz_mult;
 sps->pic_conf_win.top_offset= get_ue_golomb_long(gb) *  vert_mult;
-- 
2.9.5



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


Re: [FFmpeg-devel] [PATCH] lavc/hevc_ps: fix crop info

2018-08-15 Thread James Almer
On 8/16/2018 12:29 AM, Zhao Zhili wrote:
> ---
>  libavcodec/hevc_ps.c | 26 ++
>  1 file changed, 22 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
> index fbd9fbf..4161ab6 100644
> --- a/libavcodec/hevc_ps.c
> +++ b/libavcodec/hevc_ps.c
> @@ -628,8 +628,17 @@ static void decode_vui(GetBitContext *gb, AVCodecContext 
> *avctx,
>  vui->default_display_window_flag = get_bits1(gb);
>  
>  if (vui->default_display_window_flag) {
> -int vert_mult  = 1 + (sps->chroma_format_idc < 2);
> -int horiz_mult = 1 + (sps->chroma_format_idc < 3);
> +unsigned horiz_mult, vert_mult;
> +if (sps->chroma_format_idc == 1) {
> +horiz_mult = 2;
> +vert_mult = 2;
> +} else if (sps->chroma_format_idc == 2) {
> +horiz_mult = 2;
> +vert_mult = 1;
> +} else {
> +horiz_mult = 1;
> +vert_mult = 1;

Can you explain what this patch is meant to do? For chroma_format_idc ==
1, 2 and 3 nothing changes with this, only chroma_format_idc == 0, where
both horiz_mult and vert_mult become 1 instead of 2. Is that
correct/intended?

> +}
>  vui->def_disp_win.left_offset   = get_ue_golomb_long(gb) * 
> horiz_mult;
>  vui->def_disp_win.right_offset  = get_ue_golomb_long(gb) * 
> horiz_mult;
>  vui->def_disp_win.top_offset= get_ue_golomb_long(gb) *  
> vert_mult;
> @@ -923,8 +932,17 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, 
> unsigned int *sps_id,
>  return ret;
>  
>  if (get_bits1(gb)) { // pic_conformance_flag
> -int vert_mult  = 1 + (sps->chroma_format_idc < 2);
> -int horiz_mult = 1 + (sps->chroma_format_idc < 3);
> +unsigned horiz_mult, vert_mult;
> +if (sps->chroma_format_idc == 1) {
> +horiz_mult = 2;
> +vert_mult = 2;
> +} else if (sps->chroma_format_idc == 2) {
> +horiz_mult = 2;
> +vert_mult = 1;
> +} else {
> +horiz_mult = 1;
> +vert_mult = 1;
> +}
>  sps->pic_conf_win.left_offset   = get_ue_golomb_long(gb) * 
> horiz_mult;
>  sps->pic_conf_win.right_offset  = get_ue_golomb_long(gb) * 
> horiz_mult;
>  sps->pic_conf_win.top_offset= get_ue_golomb_long(gb) *  
> vert_mult;
> 

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


Re: [FFmpeg-devel] [PATCH] lavc/hevc_ps: fix crop info

2018-08-15 Thread Zhao Zhili



On 2018年08月16日 11:46, James Almer wrote:

On 8/16/2018 12:29 AM, Zhao Zhili wrote:

---
  libavcodec/hevc_ps.c | 26 ++
  1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index fbd9fbf..4161ab6 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -628,8 +628,17 @@ static void decode_vui(GetBitContext *gb, AVCodecContext 
*avctx,
  vui->default_display_window_flag = get_bits1(gb);
  
  if (vui->default_display_window_flag) {

-int vert_mult  = 1 + (sps->chroma_format_idc < 2);
-int horiz_mult = 1 + (sps->chroma_format_idc < 3);
+unsigned horiz_mult, vert_mult;
+if (sps->chroma_format_idc == 1) {
+horiz_mult = 2;
+vert_mult = 2;
+} else if (sps->chroma_format_idc == 2) {
+horiz_mult = 2;
+vert_mult = 1;
+} else {
+horiz_mult = 1;
+vert_mult = 1;

Can you explain what this patch is meant to do? For chroma_format_idc ==
1, 2 and 3 nothing changes with this, only chroma_format_idc == 0, where
both horiz_mult and vert_mult become 1 instead of 2. Is that
correct/intended?


Yes, this is intended. See ISO/IEC 23008-2 Table 6-1.

./ffprobe ~/Videos/hevc-monochrome.ts
    Stream #0:0[0x100]: Video: hevc (Rext) ([36][0][0][0] / 0x0024), 
gray(tv), 384x224, 15 fps, 15 tbr, 90k tbn, 15 tbc


The correct size is 384x240.


+}
  vui->def_disp_win.left_offset   = get_ue_golomb_long(gb) * horiz_mult;
  vui->def_disp_win.right_offset  = get_ue_golomb_long(gb) * horiz_mult;
  vui->def_disp_win.top_offset= get_ue_golomb_long(gb) *  vert_mult;
@@ -923,8 +932,17 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, 
unsigned int *sps_id,
  return ret;
  
  if (get_bits1(gb)) { // pic_conformance_flag

-int vert_mult  = 1 + (sps->chroma_format_idc < 2);
-int horiz_mult = 1 + (sps->chroma_format_idc < 3);
+unsigned horiz_mult, vert_mult;
+if (sps->chroma_format_idc == 1) {
+horiz_mult = 2;
+vert_mult = 2;
+} else if (sps->chroma_format_idc == 2) {
+horiz_mult = 2;
+vert_mult = 1;
+} else {
+horiz_mult = 1;
+vert_mult = 1;
+}
  sps->pic_conf_win.left_offset   = get_ue_golomb_long(gb) * horiz_mult;
  sps->pic_conf_win.right_offset  = get_ue_golomb_long(gb) * horiz_mult;
  sps->pic_conf_win.top_offset= get_ue_golomb_long(gb) *  vert_mult;


___
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 0/4] fix "ffmpeg -h full" can't dump some options issue

2018-08-15 Thread myp...@gmail.com
On Mon, Aug 13, 2018 at 9:52 PM Jun Zhao  wrote:
>
> V1: - add a new avfilter_graph_get_class function for AVFilterGraph
options.
> - fix can't dump "slice" sub-option for AVFilter.
> - fix can't dump mpeg4videodec options issue. (use command "ffmpeg -h
decoder=mpeg4")
>
> Jun Zhao (4):
>   lavfi: fix can't dispaly "slice" sub-option in "ffmpeg -h full"
>   lavfi: add new function avfilter_graph_get_class.
>   fftools/ffmpeg: dump AVFilterGraph options in "ffmpeg -h full".
>   lavc/mpeg4videodec: fix can't dump AVOptions issue.
>
>  fftools/ffmpeg_opt.c|1 +
>  libavcodec/mpeg4videodec.c  |5 +++--
>  libavfilter/avfilter.c  |2 +-
>  libavfilter/avfilter.h  |7 +++
>  libavfilter/avfiltergraph.c |5 +
>  5 files changed, 17 insertions(+), 3 deletions(-)
>

Will apply the patch " lavfi: fix can't dispaly "slice" sub-option in
"ffmpeg -h full"" for AVFilter sub-option "slice" and hold on the other 3
patches, Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel