Re: [FFmpeg-devel] [PATCH v4] avformat/movenc: Added an option to disable SIDX atom

2018-12-11 Thread Liu Steven


> 在 2018年12月12日,上午5:08,Ronak  写道:
> 
>> 
>> On Dec 11, 2018, at 3:28 PM, Gyan  wrote:
>> 
>> 
>> On 12-12-2018 01:13 AM, Ronak wrote:
>>> 
>>> Looks like I found out why: 
>>> https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/hlsenc.c#L790. The 
>>> hlsenc.c file overwrites whatever I pass in the command line...
>> 
>> That is a bug but there's still an error in your command. It should be,
>> 
>> 
>>-hls_ts_options movflags=+skip_sidx
>> 
>> This is because mp4 is a child muxer in this context. That hls option should 
>> be renamed.
>> 
>> Line 790 should be patched by adding + before frag_custom
> 
> That doesn't work.
> 
> ffmpeg -i input.mp4 -hls_ts_options movflags=+skip_sidx -codec copy -hls_time 
> 0.97523809523809 -hls_segment_type fmp4 -hls_flags single_file 
> -hls_playlist_type vod output.m3u8
> ffmpeg version N-92677-gdd7d6034f1 Copyright (c) 2000-2018 the FFmpeg 
> developers
>  built with gcc 4.4.6 (GCC) 20110731 (Red Hat 4.4.6-3)
>  configuration: --prefix=/home/ronakp/ffmpeg_build 
> --pkg-config-flags=--static 
> --extra-cflags=-I/home/ronakp/ffmpeg_build/include 
> --extra-ldflags=-L/home/ronakp/ffmpeg_build/lib --extra-libs=-lpthread 
> --extra-libs=-lm --bindir=/home/ronakp/bin --enable-gpl --enable-libfdk_aac 
> --enable-libmp3lame --enable-libopus --enable-nonfree
>  libavutil  56. 24.101 / 56. 24.101
>  libavcodec 58. 42.100 / 58. 42.100
>  libavformat58. 24.100 / 58. 24.100
>  libavdevice58.  6.101 / 58.  6.101
>  libavfilter 7. 46.101 /  7. 46.101
>  libswscale  5.  4.100 /  5.  4.100
>  libswresample   3.  4.100 /  3.  4.100
>  libpostproc55.  4.100 / 55.  4.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
>  Metadata:
>major_brand : isom
>minor_version   : 1
>compatible_brands: isom
>creation_time   : 2013-11-14T18:23:26.00Z
>  Duration: 02:39:09.39, start: 0.00, bitrate: 31 kb/s
>Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, 
> fltp, 30 kb/s (default)
>Metadata:
>  creation_time   : 2013-11-14T18:23:26.00Z
>  handler_name: GPAC ISO Audio Handler
> [hls @ 0x23e1b00] Opening 'output.m4s' for writing
> [hls @ 0x23e1b00] Some of provided format options in 'movflags=+skip_sidx' 
> are not recognized
> Could not write header for output file #0 (incorrect codec parameters ?): 
> Invalid argument
> Stream mapping:
>  Stream #0:0 -> #0:0 (copy)
>Last message repeated 1 times
> 
> Also, I think whatever options I set on the command line are going to be 
> overwritten by line 790 in hlsenc.c anyway no?
https://patchwork.ffmpeg.org/patch/11378/

Try this patch please :D
> 
>> 
>> Gyan
>> 
>> ___
>> 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



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


[FFmpeg-devel] [PATCH v2] lavc/qsvenc: set pict_type to be I for IDR frames.

2018-12-11 Thread Zhong Li
Signed-off-by: Zhong Li 
---
 libavcodec/qsvenc.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 931e994..96cf642 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1377,11 +1377,10 @@ int ff_qsv_encode(AVCodecContext *avctx, QSVEncContext 
*q,
 new_pkt.pts  = av_rescale_q(bs->TimeStamp,   (AVRational){1, 
9}, avctx->time_base);
 new_pkt.size = bs->DataLength;
 
-if (bs->FrameType & MFX_FRAMETYPE_IDR ||
-bs->FrameType & MFX_FRAMETYPE_xIDR)
+if (bs->FrameType & MFX_FRAMETYPE_IDR || bs->FrameType & 
MFX_FRAMETYPE_xIDR) {
 new_pkt.flags |= AV_PKT_FLAG_KEY;
-
-if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType & 
MFX_FRAMETYPE_xI)
+pict_type = AV_PICTURE_TYPE_I;
+} else if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType & 
MFX_FRAMETYPE_xI)
 pict_type = AV_PICTURE_TYPE_I;
 else if (bs->FrameType & MFX_FRAMETYPE_P || bs->FrameType & 
MFX_FRAMETYPE_xP)
 pict_type = AV_PICTURE_TYPE_P;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH] avformat/hlsenc: remove duplicate operation at hls_write_header

2018-12-11 Thread Steven Liu
the options have set when avformat_init_output at hls_mux_init

Signed-off-by: Steven Liu 
---
 libavformat/hlsenc.c | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index bdd2a113bd..03a32b65d8 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -787,7 +787,7 @@ static int hls_mux_init(AVFormatContext *s, VariantStream 
*vs)
 
 av_dict_copy(, hls->format_options, 0);
 av_dict_set(, "fflags", "-autobsf", 0);
-av_dict_set(, "movflags", "frag_custom+dash+delay_moov", 0);
+av_dict_set(, "movflags", "+frag_custom+dash+delay_moov", 
AV_DICT_APPEND);
 ret = avformat_init_output(oc, );
 if (ret < 0)
 return ret;
@@ -2079,15 +2079,9 @@ static int hls_write_header(AVFormatContext *s)
 for (i = 0; i < hls->nb_varstreams; i++) {
 vs = >var_streams[i];
 
-av_dict_copy(, hls->format_options, 0);
-ret = avformat_write_header(vs->avf, );
-if (av_dict_count(options)) {
-av_log(s, AV_LOG_ERROR, "Some of provided format options in '%s' 
are not recognized\n", hls->format_options_str);
-ret = AVERROR(EINVAL);
-av_dict_free();
-goto fail;
-}
-av_dict_free();
+ret = avformat_write_header(vs->avf, NULL);
+if (ret < 0)
+return ret;
 //av_assert0(s->nb_streams == hls->avf->nb_streams);
 for (j = 0; j < vs->nb_streams; j++) {
 AVStream *inner_st;
-- 
2.15.2 (Apple Git-101.1)



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


[FFmpeg-devel] [PATCH 1/2] avformat/dashenc : Refactored HLS media playlist related code

2018-12-11 Thread Karthick J
Made it as a separate function, so that it could be reused (in future)
---
 libavformat/dashenc.c | 135 +++---
 1 file changed, 75 insertions(+), 60 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 585b34cb97..f797b7bd1c 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -407,6 +407,78 @@ static void get_hls_playlist_name(char *playlist_name, int 
string_size,
 snprintf(playlist_name, string_size, "media_%d.m3u8", id);
 }
 
+static void get_start_index_number(OutputStream *os, DASHContext *c,
+   int *start_index, int *start_number) {
+*start_index = 0;
+*start_number = 1;
+if (c->window_size) {
+*start_index  = FFMAX(os->nb_segments   - c->window_size, 0);
+*start_number = FFMAX(os->segment_index - c->window_size, 1);
+}
+}
+
+static void write_hls_media_playlist(OutputStream *os, AVFormatContext *s,
+ int representation_id, int final) {
+DASHContext *c = s->priv_data;
+int timescale = os->ctx->streams[0]->time_base.den;
+char temp_filename_hls[1024];
+char filename_hls[1024];
+AVDictionary *http_opts = NULL;
+int target_duration = 0;
+int ret = 0;
+const char *proto = avio_find_protocol_name(c->dirname);
+int use_rename = proto && !strcmp(proto, "file");
+int i, start_index, start_number;
+
+get_start_index_number(os, c, _index, _number);
+get_hls_playlist_name(filename_hls, sizeof(filename_hls),
+  c->dirname, representation_id);
+
+snprintf(temp_filename_hls, sizeof(temp_filename_hls), use_rename ? 
"%s.tmp" : "%s", filename_hls);
+
+set_http_options(_opts, c);
+ret = dashenc_io_open(s, >m3u8_out, temp_filename_hls, _opts);
+av_dict_free(_opts);
+if (ret < 0) {
+handle_io_open_error(s, ret, temp_filename_hls);
+return;
+}
+for (i = start_index; i < os->nb_segments; i++) {
+Segment *seg = os->segments[i];
+double duration = (double) seg->duration / timescale;
+if (target_duration <= duration)
+target_duration = lrint(duration);
+}
+
+ff_hls_write_playlist_header(c->m3u8_out, 6, -1, target_duration,
+ start_number, PLAYLIST_TYPE_NONE);
+
+ff_hls_write_init_file(c->m3u8_out, os->initfile, c->single_file,
+   os->init_range_length, os->init_start_pos);
+
+for (i = start_index; i < os->nb_segments; i++) {
+Segment *seg = os->segments[i];
+ret = ff_hls_write_file_entry(c->m3u8_out, 0, c->single_file,
+(double) seg->duration / timescale, 0,
+seg->range_length, seg->start_pos, NULL,
+c->single_file ? os->initfile : seg->file,
+NULL);
+if (ret < 0) {
+av_log(os->ctx, AV_LOG_WARNING, "ff_hls_write_file_entry get 
error\n");
+}
+}
+
+if (final)
+ff_hls_write_end_list(c->m3u8_out);
+
+dashenc_io_close(s, >m3u8_out, temp_filename_hls);
+
+if (use_rename)
+if (avpriv_io_move(temp_filename_hls, filename_hls) < 0) {
+av_log(os->ctx, AV_LOG_WARNING, "renaming file %s to %s 
failed\n\n", temp_filename_hls, filename_hls);
+}
+}
+
 static int flush_init_segment(AVFormatContext *s, OutputStream *os)
 {
 DASHContext *c = s->priv_data;
@@ -463,11 +535,8 @@ static void output_segment_list(OutputStream *os, 
AVIOContext *out, AVFormatCont
 int representation_id, int final)
 {
 DASHContext *c = s->priv_data;
-int i, start_index = 0, start_number = 1;
-if (c->window_size) {
-start_index  = FFMAX(os->nb_segments   - c->window_size, 0);
-start_number = FFMAX(os->segment_index - c->window_size, 1);
-}
+int i, start_index, start_number;
+get_start_index_number(os, c, _index, _number);
 
 if (c->use_template) {
 int timescale = c->use_timeline ? os->ctx->streams[0]->time_base.den : 
AV_TIME_BASE;
@@ -527,61 +596,7 @@ static void output_segment_list(OutputStream *os, 
AVIOContext *out, AVFormatCont
 }
 if (c->hls_playlist && start_index < os->nb_segments && os->segment_type 
== SEGMENT_TYPE_MP4)
 {
-int timescale = os->ctx->streams[0]->time_base.den;
-char temp_filename_hls[1024];
-char filename_hls[1024];
-AVDictionary *http_opts = NULL;
-int target_duration = 0;
-int ret = 0;
-const char *proto = avio_find_protocol_name(c->dirname);
-int use_rename = proto && !strcmp(proto, "file");
-
-get_hls_playlist_name(filename_hls, sizeof(filename_hls),
-  c->dirname, representation_id);
-
-snprintf(temp_filename_hls, sizeof(temp_filename_hls), use_rename ? 
"%s.tmp" : "%s", filename_hls);
-
-

[FFmpeg-devel] [PATCH 2/2] avformat/dashenc: Added support for Low-latency HLS(LHLS)

2018-12-11 Thread Karthick J
Apple doesn't have an official spec for LHLS. Meanwhile hls.js player folks are
trying to standardize a open LHLS spec. The draft spec is available in 
https://github.com/video-dev/hlsjs-rfcs/blob/lhls-spec/proposals/0001-lhls.md
This option will also try to comply with the above open spec, till Apple's spec 
officially supports it.
Applicable only when @var{streaming} and @var{hls_playlist} options are enabled.
---
 doc/muxers.texi   |  7 +++
 libavformat/dashenc.c | 31 +++
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 809f88662e..f09a89db82 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -305,6 +305,13 @@ If this flag is set, the dash segment files will be in in 
WebM format.
 @item -ignore_io_errors @var{ignore_io_errors}
 Ignore IO errors during open and write. Useful for long-duration runs with 
network output.
 
+@item -lhls @var{lhls}
+Enable Low-latency HLS(LHLS). Adds #EXT-X-PREFETCH tag with current segment's 
URI.
+Apple doesn't have an official spec for LHLS. Meanwhile hls.js player folks are
+trying to standardize a open LHLS spec. The draft spec is available in 
https://github.com/video-dev/hlsjs-rfcs/blob/lhls-spec/proposals/0001-lhls.md
+This option will also try to comply with the above open spec, till Apple's 
spec officially supports it.
+Applicable only when @var{streaming} and @var{hls_playlist} options are 
enabled.
+
 @end table
 
 @anchor{framecrc}
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index f797b7bd1c..8685642437 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -139,6 +139,7 @@ typedef struct DASHContext {
 char *format_options_str;
 SegmentType segment_type_option;  /* segment type as specified in options 
*/
 int ignore_io_errors;
+int lhls;
 } DASHContext;
 
 static struct codec_string {
@@ -418,7 +419,8 @@ static void get_start_index_number(OutputStream *os, 
DASHContext *c,
 }
 
 static void write_hls_media_playlist(OutputStream *os, AVFormatContext *s,
- int representation_id, int final) {
+ int representation_id, int final,
+ char *prefetch_url) {
 DASHContext *c = s->priv_data;
 int timescale = os->ctx->streams[0]->time_base.den;
 char temp_filename_hls[1024];
@@ -431,6 +433,11 @@ static void write_hls_media_playlist(OutputStream *os, 
AVFormatContext *s,
 int i, start_index, start_number;
 
 get_start_index_number(os, c, _index, _number);
+
+if (!c->hls_playlist || start_index >= os->nb_segments ||
+os->segment_type != SEGMENT_TYPE_MP4)
+return;
+
 get_hls_playlist_name(filename_hls, sizeof(filename_hls),
   c->dirname, representation_id);
 
@@ -468,6 +475,9 @@ static void write_hls_media_playlist(OutputStream *os, 
AVFormatContext *s,
 }
 }
 
+if (prefetch_url)
+avio_printf(c->m3u8_out, "#EXT-X-PREFETCH:%s\n", prefetch_url);
+
 if (final)
 ff_hls_write_end_list(c->m3u8_out);
 
@@ -594,9 +604,8 @@ static void output_segment_list(OutputStream *os, 
AVIOContext *out, AVFormatCont
 }
 avio_printf(out, "\t\t\t\t\n");
 }
-if (c->hls_playlist && start_index < os->nb_segments && os->segment_type 
== SEGMENT_TYPE_MP4)
-{
-write_hls_media_playlist(os, s, representation_id, final);
+if (!c->lhls || final) {
+write_hls_media_playlist(os, s, representation_id, final, NULL);
 }
 
 }
@@ -1054,6 +1063,15 @@ static int dash_init(AVFormatContext *s)
 c->seg_duration = c->min_seg_duration;
 }
 #endif
+if (c->lhls && !c->streaming) {
+av_log(s, AV_LOG_WARNING, "LHLS option will be ignored as streaming is 
not enabled\n");
+c->lhls = 0;
+}
+
+if (c->lhls && !c->hls_playlist) {
+av_log(s, AV_LOG_WARNING, "LHLS option will be ignored as hls_playlist 
is not enabled\n");
+c->lhls = 0;
+}
 
 av_strlcpy(c->dirname, s->url, sizeof(c->dirname));
 ptr = strrchr(c->dirname, '/');
@@ -1635,6 +1653,10 @@ static int dash_write_packet(AVFormatContext *s, 
AVPacket *pkt)
 if (ret < 0) {
 return handle_io_open_error(s, ret, os->temp_path);
 }
+if (c->lhls) {
+char *prefetch_url = use_rename ? NULL : os->filename;
+write_hls_media_playlist(os, s, pkt->stream_index, 0, 
prefetch_url);
+}
 }
 
 //write out the data immediately in streaming mode
@@ -1760,6 +1782,7 @@ static const AVOption options[] = {
 { "mp4", "make segment file in ISOBMFF format", 0, AV_OPT_TYPE_CONST, 
{.i64 = SEGMENT_TYPE_MP4 }, 0, UINT_MAX,   E, "segment_type"},
 { "webm", "make segment file in WebM format", 0, AV_OPT_TYPE_CONST, {.i64 
= SEGMENT_TYPE_WEBM }, 0, UINT_MAX,   E, "segment_type"},
 { "ignore_io_errors", "Ignore IO errors during open and write. Useful for 

Re: [FFmpeg-devel] [PATCH] lavc/qsvenc: set pict_type to be I for IDR frames.

2018-12-11 Thread Li, Zhong
> On Wed, Dec 12, 2018 at 2:13 PM Li, Zhong  wrote:
> >
> > > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index
> > > > aa7f347..8289a32 100644
> > > > --- a/libavcodec/qsvenc.c
> > > > +++ b/libavcodec/qsvenc.c
> > > > @@ -1378,10 +1378,11 @@ int ff_qsv_encode(AVCodecContext
> *avctx,
> > > > QSVEncContext *q,
> > > >  new_pkt.size = bs->DataLength;
> > > >
> > > >  if (bs->FrameType & MFX_FRAMETYPE_IDR ||
> > > > -bs->FrameType & MFX_FRAMETYPE_xIDR)
> > > > +bs->FrameType & MFX_FRAMETYPE_xIDR) {
> > > >  new_pkt.flags |= AV_PKT_FLAG_KEY;
> > > > -
> > > > -if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType &
> > > > MFX_FRAMETYPE_xI)
> > > > +pict_type = AV_PICTURE_TYPE_I;
> > >
> > > > +}
> > > > +else if (bs->FrameType & MFX_FRAMETYPE_I ||
> bs->FrameType
> > > &
> > > > MFX_FRAMETYPE_xI)
> > >
> > > Please merge these lines.
> > >
> > > Carl Eugen
> >
> > Sorry, I haven't seen any line can be merged.
> > The only way I think something like this:
> > If (MFX_FRAMETYPE_I || MFX_FRAMETYPE_xI || MFX_FRAMETYPE_IDR ||
> MFX_FRAMETYPE_xIDR)
> >pict_type = AV_PICTURE_TYPE_I;
> >if (MFX_FRAMETYPE_IDR || MFX_FRAMETYPE_xIDR)
> >new_pkt.flags |= AV_PKT_FLAG_KEY; else if ...
> I think carl's comment means mege:
> > +}
> > +else if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType
> &
> like } else if (xxx)

Got it. Thanks. Will update.


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


[FFmpeg-devel] [PATCH] lavc/qsv_hevc: correct QSV HEVC default plugin on Windows

2018-12-11 Thread Zhong Li
1. Old logic meaned: everywhere, except Windows, ffmpeg has to use HW
acceleration, but on Windows ffmpeg has to use (unavailable) software
HEVC by default
2. Software HEVC is available only if you provide corresponding
software MediaSDK library, which isn't provided with ffmpeg. More
information could be found in
https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/samples/readme-encode_linux.pdf
3. HW HEVC decoding/encoding are available on Windows in the driver by default

Note: Default case should be the most common case but this change still has 
potential risk
on windows if HW path is not supported(or doesn't work as expection).
(See the historical disscution: 
https://lists.libav.org/pipermail/libav-devel/2016-November/080419.html).
In such case, two options suggested:
1. Use the option "-load_plugin hevc_sw" to switch SW path manually.
2. Or report bug to Intel windows driver if your GPU can support HEVC HW codec.
  (HEVC decoding is supported since Braswell, and encoding supported since 
Skylake)

Patch started by Landgraph. Add similar change for hevc decoder and bump a new 
version.

Reviewed-by: Mark Thompson 
Reviewed-by: Maxym Dmytrychenko 
Signed-off-by: Landgraph 
Signed-off-by: Zhong Li 
---
 libavcodec/qsvdec_h2645.c | 8 +---
 libavcodec/qsvenc_hevc.c  | 8 +---
 libavcodec/version.h  | 2 +-
 3 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/libavcodec/qsvdec_h2645.c b/libavcodec/qsvdec_h2645.c
index b8a78aa..9b49f55 100644
--- a/libavcodec/qsvdec_h2645.c
+++ b/libavcodec/qsvdec_h2645.c
@@ -178,12 +178,6 @@ static void qsv_decode_flush(AVCodecContext *avctx)
 ff_qsv_decode_flush(avctx, >qsv);
 }
 
-#if defined(_WIN32)
-#define LOAD_PLUGIN_DEFAULT LOAD_PLUGIN_HEVC_SW
-#else
-#define LOAD_PLUGIN_DEFAULT LOAD_PLUGIN_HEVC_HW
-#endif
-
 #define OFFSET(x) offsetof(QSVH2645Context, x)
 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 
@@ -191,7 +185,7 @@ static void qsv_decode_flush(AVCodecContext *avctx)
 static const AVOption hevc_options[] = {
 { "async_depth", "Internal parallelization depth, the higher the value the 
higher the latency.", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = 
ASYNC_DEPTH_DEFAULT }, 1, INT_MAX, VD },
 
-{ "load_plugin", "A user plugin to load in an internal session", 
OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_DEFAULT }, 
LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VD, "load_plugin" },
+{ "load_plugin", "A user plugin to load in an internal session", 
OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_HEVC_HW }, 
LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VD, "load_plugin" },
 { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_NONE },
0, 0, VD, "load_plugin" },
 { "hevc_sw",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_SW }, 
0, 0, VD, "load_plugin" },
 { "hevc_hw",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_HW }, 
0, 0, VD, "load_plugin" },
diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
index 4339b31..1c615b4 100644
--- a/libavcodec/qsvenc_hevc.c
+++ b/libavcodec/qsvenc_hevc.c
@@ -217,12 +217,6 @@ static av_cold int qsv_enc_close(AVCodecContext *avctx)
 return ff_qsv_enc_close(avctx, >qsv);
 }
 
-#if defined(_WIN32)
-#define LOAD_PLUGIN_DEFAULT LOAD_PLUGIN_HEVC_SW
-#else
-#define LOAD_PLUGIN_DEFAULT LOAD_PLUGIN_HEVC_HW
-#endif
-
 #define OFFSET(x) offsetof(QSVHEVCEncContext, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
@@ -230,7 +224,7 @@ static const AVOption options[] = {
 
 { "idr_interval", "Distance (in I-frames) between IDR frames", 
OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT_MAX, VE, 
"idr_interval" },
 { "begin_only", "Output an IDR-frame only at the beginning of the stream", 
0, AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0, VE, "idr_interval" },
-{ "load_plugin", "A user plugin to load in an internal session", 
OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_DEFAULT }, 
LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VE, "load_plugin" },
+{ "load_plugin", "A user plugin to load in an internal session", 
OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_HEVC_HW }, 
LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VE, "load_plugin" },
 { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_NONE },
0, 0, VE, "load_plugin" },
 { "hevc_sw",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_SW }, 
0, 0, VE, "load_plugin" },
 { "hevc_hw",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_HW }, 
0, 0, VE, "load_plugin" },
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 5677a7f..9e43338 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  42
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  

Re: [FFmpeg-devel] [PATCH] lavc/qsvenc: set pict_type to be I for IDR frames.

2018-12-11 Thread myp...@gmail.com
On Wed, Dec 12, 2018 at 2:13 PM Li, Zhong  wrote:
>
> > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index
> > > aa7f347..8289a32 100644
> > > --- a/libavcodec/qsvenc.c
> > > +++ b/libavcodec/qsvenc.c
> > > @@ -1378,10 +1378,11 @@ int ff_qsv_encode(AVCodecContext *avctx,
> > > QSVEncContext *q,
> > >  new_pkt.size = bs->DataLength;
> > >
> > >  if (bs->FrameType & MFX_FRAMETYPE_IDR ||
> > > -bs->FrameType & MFX_FRAMETYPE_xIDR)
> > > +bs->FrameType & MFX_FRAMETYPE_xIDR) {
> > >  new_pkt.flags |= AV_PKT_FLAG_KEY;
> > > -
> > > -if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType &
> > > MFX_FRAMETYPE_xI)
> > > +pict_type = AV_PICTURE_TYPE_I;
> >
> > > +}
> > > +else if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType
> > &
> > > MFX_FRAMETYPE_xI)
> >
> > Please merge these lines.
> >
> > Carl Eugen
>
> Sorry, I haven't seen any line can be merged.
> The only way I think something like this:
> If (MFX_FRAMETYPE_I || MFX_FRAMETYPE_xI || MFX_FRAMETYPE_IDR || 
> MFX_FRAMETYPE_xIDR)
>pict_type = AV_PICTURE_TYPE_I;
>if (MFX_FRAMETYPE_IDR || MFX_FRAMETYPE_xIDR)
>new_pkt.flags |= AV_PKT_FLAG_KEY;
> else if ...
I think carl's comment means mege:
> +}
> +else if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType &
like } else if (xxx)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/qsvenc: set pict_type to be I for IDR frames.

2018-12-11 Thread Li, Zhong
> > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index
> > aa7f347..8289a32 100644
> > --- a/libavcodec/qsvenc.c
> > +++ b/libavcodec/qsvenc.c
> > @@ -1378,10 +1378,11 @@ int ff_qsv_encode(AVCodecContext *avctx,
> > QSVEncContext *q,
> >  new_pkt.size = bs->DataLength;
> >
> >  if (bs->FrameType & MFX_FRAMETYPE_IDR ||
> > -bs->FrameType & MFX_FRAMETYPE_xIDR)
> > +bs->FrameType & MFX_FRAMETYPE_xIDR) {
> >  new_pkt.flags |= AV_PKT_FLAG_KEY;
> > -
> > -if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType &
> > MFX_FRAMETYPE_xI)
> > +pict_type = AV_PICTURE_TYPE_I;
> 
> > +}
> > +else if (bs->FrameType & MFX_FRAMETYPE_I || bs->FrameType
> &
> > MFX_FRAMETYPE_xI)
> 
> Please merge these lines.
> 
> Carl Eugen

Sorry, I haven't seen any line can be merged. 
The only way I think something like this:
If (MFX_FRAMETYPE_I || MFX_FRAMETYPE_xI || MFX_FRAMETYPE_IDR || 
MFX_FRAMETYPE_xIDR)
   pict_type = AV_PICTURE_TYPE_I;
   if (MFX_FRAMETYPE_IDR || MFX_FRAMETYPE_xIDR)
   new_pkt.flags |= AV_PKT_FLAG_KEY;
else if ...
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] ffmpeg: implement input file stream disabling

2018-12-11 Thread Gyan


On 12-12-2018 03:40 AM, Michael Niedermayer wrote:

On Mon, Dec 10, 2018 at 08:57:44PM +0530, Gyan wrote:

At Michael's suggestion, this patch lets -vn/-an/-sn/-dn work for input
files. Individual streams can still be let through e.g.

     ffmpeg -an -discard:a:1 none -i file ...

will let (only) the 2nd audio stream be seen during stream selection and
filtergraph construction.

Thanks,
Gyan
  ffmpeg_filter.c |7 +++
  ffmpeg_opt.c|   17 +
  2 files changed, 24 insertions(+)
212c7bcecbd62329f3f18893c71f464ebeee3b67  
0001-ffmpeg-implement-input-file-stream-disabling.patch
 From 9823a71f2055f2c4c4484536291bbd2afee36a81 Mon Sep 17 00:00:00 2001
From: Gyan Doshi 
Date: Mon, 10 Dec 2018 20:38:20 +0530
Subject: [PATCH] ffmpeg: implement input file stream disabling

-vn/-an/-sn/-dn can be set to stop processing of streams
of said type from an input file.

isnt this 2 seperate changes ?
one is adding -vn/-an/-sn/-dn input support and the other is fixing some input
discard issues related to existing -discard functionality



Only one change. I provided an example command syntax to show how to 
selectively enable streams while leaving others of the same type disabled.


Gyan

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


Re: [FFmpeg-devel] [PATCH] swscale/ppc: Move VSX-using code to its own file

2018-12-11 Thread Michael Niedermayer
On Tue, Dec 11, 2018 at 09:10:02AM +0200, Lauri Kasanen wrote:
> On Thu, 6 Dec 2018 21:47:18 +0100
> Michael Niedermayer  wrote:
> 
> > On Tue, Dec 04, 2018 at 02:27:22PM +0100, Michael Niedermayer wrote:
> > > > > > On Mon, Dec 03, 2018 at 09:24:47AM +0200, Lauri Kasanen wrote:
> > > > > > > Also ping on "swscale/output: VSX-optimize
> > > > > > > nbps yuv2plane1".
> > > > > > 
> > > > > > This IIUC has not been tested on BE yet
> > > > > > 
> > > > > > my ppc emulation setup is a bit broken and my ppc hw ive not tried 
> > > > > > using
> > > > > > since years and it was not in good shape last i used it.
> > > > > > So i cant just quickly test this ...
> > > these are more suggestions than i expected :)
> > > but i just got cross build working again and i also just eliminated a
> > > mysterious ld.so related segfault
> > > ATM iam re rerunning fate with a freshly rebuilt qemu
> > > (the past one had an issue with altivec)
> > 
> > i have cross build with ppc and qemu partly working
> > but it appears gcc or something is just buggy
> 
> Hi,
> 
> Carl Eugen Hoyos reported that it builds fine on BE, the guards being
> in correct place not to affect BE. How are things on your side?

a small number of tests fail independant of this patch, i had no time to
look into these failures.
Ill apply the patch

thanks

[...]

-- 
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 3/3] Add ADPCM IMA CRYO APC encoder

2018-12-11 Thread Michael Niedermayer
On Mon, Dec 10, 2018 at 12:32:51PM +0100, Tomas Härdin wrote:
> 

>  Changelog  |1 +
>  libavcodec/adpcmenc.c  |   33 +
>  libavcodec/allcodecs.c |1 +
>  libavcodec/version.h   |4 ++--
>  tests/fate/acodec.mak  |2 ++
>  tests/ref/acodec/adpcm-ima_apc |4 
>  6 files changed, 43 insertions(+), 2 deletions(-)
> e86974218c35b93a077f5a38bcccb56ee3b36ca5  
> 0003-Add-ADPCM-IMA-CRYO-APC-encoder.patch
> From 32cc6a96f80b5406e8327d912c8fc38812e6a664 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= 
> Date: Fri, 23 Nov 2018 15:15:02 +0100
> Subject: [PATCH 3/3] Add ADPCM IMA CRYO APC encoder
> 
> No trellis quantization yet
> ---
>  Changelog  |  1 +
>  libavcodec/adpcmenc.c  | 33 +
>  libavcodec/allcodecs.c |  1 +
>  libavcodec/version.h   |  4 ++--
>  tests/fate/acodec.mak  |  2 ++
>  tests/ref/acodec/adpcm-ima_apc |  4 
>  6 files changed, 43 insertions(+), 2 deletions(-)
>  create mode 100644 tests/ref/acodec/adpcm-ima_apc
> 
> diff --git a/Changelog b/Changelog
> index f678feed65..e6ae0c1187 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -11,6 +11,7 @@ version :
>  - dhav demuxer
>  - PCM-DVD encoder
>  - CRYO APC muxer
> +- ADPCM IMA CRYO APC encoder
>  
>  
>  version 4.1:
> diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
> index 668939c778..0d757d5b46 100644
> --- a/libavcodec/adpcmenc.c
> +++ b/libavcodec/adpcmenc.c
> @@ -54,6 +54,7 @@ typedef struct ADPCMEncodeContext {
>  TrellisNode *node_buf;
>  TrellisNode **nodep_buf;
>  uint8_t *trellis_hash;
> +int extradata_updated;
>  } ADPCMEncodeContext;
>  
>  #define FREEZE_INTERVAL 128
> @@ -124,6 +125,15 @@ static av_cold int adpcm_encode_init(AVCodecContext 
> *avctx)
>  bytestream_put_le16(, ff_adpcm_AdaptCoeff2[i] * 4);
>  }
>  break;
> +case AV_CODEC_ID_ADPCM_IMA_APC:
> +if (avctx->trellis) {
> +av_log(avctx, AV_LOG_ERROR, "trellis encoding not implemented 
> for CRYO APC\n");
> +return AVERROR_PATCHWELCOME;
> +}
> +//extradata will be output in adpcm_encode_frame()
> +avctx->frame_size  = BLKSIZE * 2 / avctx->channels;
> +avctx->block_align = BLKSIZE;
> +break;
>  case AV_CODEC_ID_ADPCM_YAMAHA:
>  avctx->frame_size  = BLKSIZE * 2 / avctx->channels;
>  avctx->block_align = BLKSIZE;
> @@ -491,6 +501,28 @@ static int adpcm_encode_frame(AVCodecContext *avctx, 
> AVPacket *avpkt,
>  dst = avpkt->data;
>  
>  switch(avctx->codec->id) {
> +case AV_CODEC_ID_ADPCM_IMA_APC:
> +//initialize predictors using initial samples
> +if (!c->extradata_updated) {
> +uint8_t *side_data = av_packet_new_side_data(
> +avpkt, AV_PKT_DATA_NEW_EXTRADATA, 8);
> +
> +if (!side_data) {
> +return AVERROR(ENOMEM);
> +}
> +
> +for (ch = 0; ch < avctx->channels; ch++) {
> +c->status[ch].prev_sample = samples[ch];
> +bytestream_put_le32(_data, c->status[ch].prev_sample);
> +}
> +c->extradata_updated = 1;
> +}

This looks like something went wrong with how IMA_APC was implemented

the first samples are not a global header. extradata is a global header
If its done as its implemented then extradata will not be available before
the first packet and it will not work with many muxers
in fact the muxer submitted here needs to special case the late occurance
of extradata.
I suspect the related code would be simpler if the data currently passed
through extradata would be passed as part of the first packet (not counting
code for compatibility with the old way of handling it)

another aspect of this is seeking. Seeking back to the begin has to reset
the initial sample stuff. This would occur naturally if its in the first packet
as is i think this doesnt work as extradata is not reused after init. That 
issue is about the demuxer/decoder though but its also connected via the way
extradata is used

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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


Re: [FFmpeg-devel] [PATCH] ffmpeg: implement input file stream disabling

2018-12-11 Thread Michael Niedermayer
On Mon, Dec 10, 2018 at 08:57:44PM +0530, Gyan wrote:
> At Michael's suggestion, this patch lets -vn/-an/-sn/-dn work for input
> files. Individual streams can still be let through e.g.
> 
>     ffmpeg -an -discard:a:1 none -i file ...
> 
> will let (only) the 2nd audio stream be seen during stream selection and
> filtergraph construction.
> 
> Thanks,
> Gyan

>  ffmpeg_filter.c |7 +++
>  ffmpeg_opt.c|   17 +
>  2 files changed, 24 insertions(+)
> 212c7bcecbd62329f3f18893c71f464ebeee3b67  
> 0001-ffmpeg-implement-input-file-stream-disabling.patch
> From 9823a71f2055f2c4c4484536291bbd2afee36a81 Mon Sep 17 00:00:00 2001
> From: Gyan Doshi 
> Date: Mon, 10 Dec 2018 20:38:20 +0530
> Subject: [PATCH] ffmpeg: implement input file stream disabling
> 
> -vn/-an/-sn/-dn can be set to stop processing of streams
> of said type from an input file.

isnt this 2 seperate changes ?
one is adding -vn/-an/-sn/-dn input support and the other is fixing some input
discard issues related to existing -discard functionality

if thats the case it should be 2 seperate patches

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"Nothing to hide" only works if the folks in power share the values of
you and everyone you know entirely and always will -- Tom Scott



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


Re: [FFmpeg-devel] [PATCH v4] avformat/movenc: Added an option to disable SIDX atom

2018-12-11 Thread Ronak

> On Dec 11, 2018, at 3:28 PM, Gyan  wrote:
> 
> 
> On 12-12-2018 01:13 AM, Ronak wrote:
>> 
>> Looks like I found out why: 
>> https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/hlsenc.c#L790. The 
>> hlsenc.c file overwrites whatever I pass in the command line...
> 
> That is a bug but there's still an error in your command. It should be,
> 
> 
> -hls_ts_options movflags=+skip_sidx
> 
> This is because mp4 is a child muxer in this context. That hls option should 
> be renamed.
> 
> Line 790 should be patched by adding + before frag_custom

That doesn't work.

ffmpeg -i input.mp4 -hls_ts_options movflags=+skip_sidx -codec copy -hls_time 
0.97523809523809 -hls_segment_type fmp4 -hls_flags single_file 
-hls_playlist_type vod output.m3u8
ffmpeg version N-92677-gdd7d6034f1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 4.4.6 (GCC) 20110731 (Red Hat 4.4.6-3)
  configuration: --prefix=/home/ronakp/ffmpeg_build --pkg-config-flags=--static 
--extra-cflags=-I/home/ronakp/ffmpeg_build/include 
--extra-ldflags=-L/home/ronakp/ffmpeg_build/lib --extra-libs=-lpthread 
--extra-libs=-lm --bindir=/home/ronakp/bin --enable-gpl --enable-libfdk_aac 
--enable-libmp3lame --enable-libopus --enable-nonfree
  libavutil  56. 24.101 / 56. 24.101
  libavcodec 58. 42.100 / 58. 42.100
  libavformat58. 24.100 / 58. 24.100
  libavdevice58.  6.101 / 58.  6.101
  libavfilter 7. 46.101 /  7. 46.101
  libswscale  5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc55.  4.100 / 55.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
major_brand : isom
minor_version   : 1
compatible_brands: isom
creation_time   : 2013-11-14T18:23:26.00Z
  Duration: 02:39:09.39, start: 0.00, bitrate: 31 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, 
fltp, 30 kb/s (default)
Metadata:
  creation_time   : 2013-11-14T18:23:26.00Z
  handler_name: GPAC ISO Audio Handler
[hls @ 0x23e1b00] Opening 'output.m4s' for writing
[hls @ 0x23e1b00] Some of provided format options in 'movflags=+skip_sidx' are 
not recognized
Could not write header for output file #0 (incorrect codec parameters ?): 
Invalid argument
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Last message repeated 1 times

Also, I think whatever options I set on the command line are going to be 
overwritten by line 790 in hlsenc.c anyway no?

> 
> Gyan
> 
> ___
> 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


[FFmpeg-devel] [PATCH 2/2] avcodec/gif: add support for alpha

2018-12-11 Thread Paul B Mahol
Fixes #6813.

Signed-off-by: Paul B Mahol 
---
 libavcodec/gif.c | 168 ---
 1 file changed, 144 insertions(+), 24 deletions(-)

diff --git a/libavcodec/gif.c b/libavcodec/gif.c
index ef04fabe86..798953b8c6 100644
--- a/libavcodec/gif.c
+++ b/libavcodec/gif.c
@@ -2,6 +2,8 @@
  * Copyright (c) 2000 Fabrice Bellard
  * Copyright (c) 2002 Francois Revol
  * Copyright (c) 2006 Baptiste Coudurier
+ * Copyright (c) 2018 Byorn Roche
+ * Copyright (c) 2018 Paul B Mahol
  *
  * first version by Francois Revol 
  *
@@ -60,6 +62,27 @@ enum {
 GF_TRANSDIFF  = 1<<1,
 };
 
+static int is_image_translucent(AVCodecContext *avctx,
+const uint8_t *buf, const int linesize)
+{
+GIFContext *s = avctx->priv_data;
+int trans = s->transparent_index;
+
+if (trans < 0)
+return 0;
+
+for (int y = 0; y < avctx->height; y++) {
+for (int x = 0; x < avctx->width; x++) {
+if (buf[x] == trans) {
+return 1;
+}
+}
+buf += linesize;
+}
+
+return 0;
+}
+
 static int get_palette_transparency_index(const uint32_t *palette)
 {
 int transparent_color_index = -1;
@@ -94,17 +117,91 @@ static int pick_palette_entry(const uint8_t *buf, int 
linesize, int w, int h)
 return -1;
 }
 
-static int gif_image_write_image(AVCodecContext *avctx,
- uint8_t **bytestream, uint8_t *end,
- const uint32_t *palette,
+static void gif_crop_translucent(AVCodecContext *avctx,
  const uint8_t *buf, const int linesize,
- AVPacket *pkt)
+ int *width, int *height,
+ int *x_start, int *y_start)
+{
+GIFContext *s = avctx->priv_data;
+int trans = s->transparent_index;
+
+/* Crop image */
+if ((s->flags & GF_OFFSETTING) && trans >= 0) {
+const int w = avctx->width;
+const int h = avctx->height;
+int x_end = w - 1,
+y_end = h - 1;
+
+// crop top
+while (*y_start < y_end) {
+int is_trans = 1;
+for (int i = 0; i < w; i++) {
+if (buf[w * *y_start + i] != trans) {
+is_trans = 0;
+break;
+}
+}
+
+if (!is_trans)
+break;
+(*y_start)++;
+}
+
+// crop bottom
+while (y_end < h) {
+int is_trans = 1;
+for (int i = 0; i < w; i++) {
+if (buf[w * y_end + i] != trans) {
+is_trans = 0;
+break;
+}
+}
+if (!is_trans)
+break;
+y_end--;
+}
+
+// crop left
+while (*x_start < x_end) {
+int is_trans = 1;
+for (int i = *y_start; i < y_end; i++) {
+if (buf[w * i + *x_start] != trans) {
+is_trans = 0;
+break;
+}
+}
+if (!is_trans)
+break;
+(*x_start)++;
+}
+
+// crop right
+while (x_end < w) {
+int is_trans = 1;
+for (int i = *y_start; i < y_end; i++) {
+if (buf[w * i + x_end] != trans) {
+is_trans = 0;
+break;
+}
+}
+if (!is_trans)
+break;
+x_end--;
+}
+
+*height = y_end + 1 - *y_start;
+*width  = x_end + 1 - *x_start;
+av_log(avctx, AV_LOG_DEBUG,"%dx%d image at pos (%d;%d) [area:%dx%d]\n",
+   *width, *height, *x_start, *y_start, avctx->width, 
avctx->height);
+}
+}
+
+static void gif_crop_opaque(AVCodecContext *avctx,
+const uint32_t *palette,
+const uint8_t *buf, const int linesize,
+int *width, int *height, int *x_start, int 
*y_start)
 {
 GIFContext *s = avctx->priv_data;
-int len = 0, height = avctx->height, width = avctx->width, x, y;
-int x_start = 0, y_start = 0, trans = s->transparent_index;
-int bcid = -1, honor_transparency = (s->flags & GF_TRANSDIFF) && 
s->last_frame && !palette;
-const uint8_t *ptr;
 
 /* Crop image */
 if ((s->flags & GF_OFFSETTING) && s->last_frame && !palette) {
@@ -114,34 +211,34 @@ static int gif_image_write_image(AVCodecContext *avctx,
 y_end = avctx->height - 1;
 
 /* skip common lines */
-while (y_start < y_end) {
-if (memcmp(ref + y_start*ref_linesize, buf + y_start*linesize, 
width))
+while (*y_start < y_end) {
+if (memcmp(ref + *y_start*ref_linesize, buf + *y_start*linesize, 
*width))
 break;
-y_start++;
+(*y_start)++;
  

Re: [FFmpeg-devel] [PATCH v4] avformat/movenc: Added an option to disable SIDX atom

2018-12-11 Thread Gyan


On 12-12-2018 01:13 AM, Ronak wrote:


Looks like I found out why: 
https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/hlsenc.c#L790. 
The hlsenc.c file overwrites whatever I pass in the command line...


That is a bug but there's still an error in your command. It should be,


    -hls_ts_options movflags=+skip_sidx

This is because mp4 is a child muxer in this context. That hls option 
should be renamed.


Line 790 should be patched by adding + before frag_custom

Gyan

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


[FFmpeg-devel] Add alternative delogo algorithm for my donation

2018-12-11 Thread uwe . freese

Hello,

I would like that the delogo filter is improved by an alternative way of 
removing the logo. It's the "UGLARM" mode known from Virtual Dub's 
DeLogo filter and ffdshow.
I used it many years (under Windows), but now moving to Linux miss it 
using ffmpeg as encoding tool.


Since an ffmpeg developer can probably add the code in a fragment of the 
time and more consistently than it would take me to add it, I'd like to 
hire someone to do so.


The code is just ~50 lines, and already available in c for ffdshow. I'd 
donate 50 EUR (PayPal) for someone adding it - hopefully into the normal 
production code for everyone to use. :)
So if someone knows the delogo code / filter code and volunteers, let me 
know. :) I would be really glad if this could be done.



++ How does it work:

The algorith is called "UGLARM mode" and takes all pixels of the 1-pixel 
border of the box covering the logo into account to interpolate the 
inner pixels. Each pixel is taken into account according to an 
exponential value of the distance. The result is a more blurred and I 
find much more pleasing effect than the current xy-algorithm in 
ffmpgeg's delogo filter, which tends to show vertical and horizontal 
lines / crosses. Although the calculation takes more time than the 
xy-interpolation, this is absolutely not relevant compared to the video 
encoding time.


The code was impemented by myself ~15 years ago for the VirtualDub 
filter "LogoAway" by Chris Wojdon. It was taken over in the ffdshow 
Codec package for Windows.


"UGLARM" stands for "Uwe's Great LogoAway Remove Mode". :-) It was my 
not-so-serious answer to Chris about how we could name it. But the name 
was taken over in his filter and later ffdshow, where it's available 
until now.


++ How does it look:

See these examples:
http://www.fixya.com/support/r3995122-remove_logo_from_avi_mpg4_file_using
https://forum.videohelp.com/threads/260207-Remove-Spoilers-Logos-etc 
(search for "UGLARM" for the image).


++ Code to add:

I alreday took a look at the ffmpeg code and ffdshow code.
In ffdshow, you can find the functions in TimgFilterLogoaway.cpp:
https://sourceforge.net/p/ffdshow-tryout/code/HEAD/tree/trunk/src/imgFilters/TimgFilterLogoaway.cpp

In ffmpeg, it has to be added in libavfilter/vf_delogo.c, function 
apply_delogo.


Here's the relevant code to add (+ some config variable to set the mode 
I guess):


// Precalculate weights once.
void TimgFilterLogoaway::Tplane::calcUweWeightTable(int w, int h, int power)
{
    double e = 1.0 + (0.3 * power);
    int x;
    for (x = 0; x < w; x++)
    for (int y = 0; y < h; y++)
    if (x + y != 0) {
    double d = pow(sqrt(double(x * x + y * y)), e);
    uwetable[x + y * w] = 1.0 / d;
    } else {
    uwetable[x + y * w] = 1.0;
    }

    for (x = 1; x < w - 1; x++)
    for (int y = 1; y < h - 1; y++) {
    double weightsum = 0;
    for (int bx = 0; bx < w; bx++) {
    weightsum += uwetable[abs(bx - x) + y * w];
    weightsum += uwetable[abs(bx - x) + abs(h - 1 - y) * w];
    }
    for (int by = 1; by < h - 1; by++) {
    weightsum += uwetable[x + abs(by - y) * w];
    weightsum += uwetable[abs(w - 1 - x) + abs(by - y) * w];
    }
    uweweightsum[y * w + x] = weightsum;
    }
}

// apply filter
void TimgFilterLogoaway::Tplane::uwe(const TlogoawaySettings *cfg)
{
    if (!uwetable) {
    uwetable = (double*)aligned_malloc(w * h * sizeof(double));
    uweweightsum = (double*)aligned_malloc(w * h * sizeof(double));
    calcUweWeightTable(w, h, cfg->blur);
    }

    for (int x = 1; x < w - 1; x++)
    for (int y = 1; y < h - 1; y++) {
    double r = 0;
    const unsigned char *lineN = bordn, *lineS = bords;
    for (int bx = 0; bx < w; bx++) {
    r += lineN[bx] * uwetable[abs(bx - x) + y * w];
    r += lineS[bx] * uwetable[abs(bx - x) + abs(h - 1 - y) 
* w];

    }
    const unsigned char *lineW = bordw, *lineE = borde;
    for (int by = 1; by < h - 1; by++) {
    r += lineW[by] * uwetable[x + abs(by - y) * w];
    r += lineE[by] * uwetable[abs(w - 1 - x) + abs(by - y) 
* w];

    }
    logotempdata[y * logotempstride + x] = uint8_t(r / 
uweweightsum[y * w + x]);

    }

}


Regards,
Uwe

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


Re: [FFmpeg-devel] [PATCH v4] avformat/movenc: Added an option to disable SIDX atom

2018-12-11 Thread Ronak


> On Dec 11, 2018, at 1:42 PM, Ronak  wrote:
> 
> 
> 
>> On Dec 11, 2018, at 12:35 AM, Jeyapal, Karthick  wrote:
>> 
>> 
>> 
>> On 12/11/18, 9:07 AM, "Ronak"  wrote:
>> 
>>> 
 On Dec 6, 2018, at 4:47 AM, Tobias Rapp  wrote:
 
 On 06.12.2018 08:28, Karthick J wrote:
> ---
> [...]
 
 Looks OK now, no more comments from my side.
>>> 
>>> I actually was going to submit a patch that would remove sidx atoms being 
>>> written out for any non-video content.
>>> 
>>> Is that now unnecessary because of your changes here?
>>> 
>>> So adding -movflags skip_sidx for our audio only fmp4 files would allow us 
>>> to skip the sidx atoms?
>> Yes
> 
> Hey Tobias,
> 
> 
> So I just pulled HEAD and tried to use your support, but I can't figure out 
> how to engage it:
> 
> ffmpeg -i input.mp4 -codec copy -hls_time 0.97523809523809 -hls_segment_type 
> fmp4 -hls_flags single_file -hls_playlist_type vod -movflags skip_sidx 
> output.m3u8
> ffmpeg -i input.mp4 -codec copy -hls_time 0.97523809523809 -hls_segment_type 
> fmp4 -hls_flags single_file -hls_playlist_type vod -movflags skip_sidx=1 
> output.m3u8
> 
> None of these command lines produced an mp4 file without sidx atoms. The 
> input.mp4 file is an audio only mp4 so I don't need sidx.
> 
> 

Looks like I found out why: 
https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/hlsenc.c#L790. The 
hlsenc.c file overwrites whatever I pass in the command line...


> Ronak
> 
>>> 
>>> Ronak
>>> 
 
 Regards,
 Tobias
>> 
>> ___
>> 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 v4] avformat/movenc: Added an option to disable SIDX atom

2018-12-11 Thread Ronak


> On Dec 11, 2018, at 12:35 AM, Jeyapal, Karthick  wrote:
> 
> 
> 
> On 12/11/18, 9:07 AM, "Ronak"  wrote:
> 
>> 
>>> On Dec 6, 2018, at 4:47 AM, Tobias Rapp  wrote:
>>> 
>>> On 06.12.2018 08:28, Karthick J wrote:
 ---
 [...]
>>> 
>>> Looks OK now, no more comments from my side.
>> 
>> I actually was going to submit a patch that would remove sidx atoms being 
>> written out for any non-video content.
>> 
>> Is that now unnecessary because of your changes here?
>> 
>> So adding -movflags skip_sidx for our audio only fmp4 files would allow us 
>> to skip the sidx atoms?
> Yes

Hey Tobias,


So I just pulled HEAD and tried to use your support, but I can't figure out how 
to engage it:

ffmpeg -i input.mp4 -codec copy -hls_time 0.97523809523809 -hls_segment_type 
fmp4 -hls_flags single_file -hls_playlist_type vod -movflags skip_sidx 
output.m3u8
ffmpeg -i input.mp4 -codec copy -hls_time 0.97523809523809 -hls_segment_type 
fmp4 -hls_flags single_file -hls_playlist_type vod -movflags skip_sidx=1 
output.m3u8

None of these command lines produced an mp4 file without sidx atoms. The 
input.mp4 file is an audio only mp4 so I don't need sidx.


Ronak

>> 
>> Ronak
>> 
>>> 
>>> Regards,
>>> Tobias
> 
> ___
> 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] fix for transparencies in animated gifs

2018-12-11 Thread Paul B Mahol
Hi,

On 11/27/17, Carl Eugen Hoyos  wrote:
> 2017-11-27 18:50 GMT+01:00 Bjorn Roche :
>> Sorry for the very delayed response, Carl:
>>
>> On Tue, Nov 21, 2017 at 6:55 PM, Carl Eugen Hoyos 
>> wrote:
>>
>>> 2017-11-21 18:53 GMT+01:00 Bjorn Roche :
>>> > Support for transparencies in animated gifs requires modifying both
>>> > libavcodec/gif.c and libavformat/gif.c because both the graphics
>>> > control extension (handled by libavformat/gif.c) and the raw frame data
>>> > (handled by libavcodec/gif.c) must be changed.
>>>
>>> Does remuxing animated gif with transparency work with your patch?
>>
>> A command like this:
>>
>> ffmpeg -i in.gif out.gif
>>
>> seems to produce the same output as before: transparency replaces
>> with opacity.
>
> remuxing == -vcodec copy
>
> What about ffmpeg -i in.gif -vcodec copy out.gif ?
>
>> However a command like this:
>>
>> ffmpeg -i in.gif  -vf palettegen -y /tmp/pal.png && ffmpeg -i in.gif
>> -i /tmp/pal.png -lavfi paletteuse -y -f gif out.gif
>>
>> produces an output that looks like the input (including transparency).
>>
>> I believe this is a problem with the decoder, however, since
>>
>> ffmpeg -i /Users/bjorn/Desktop/smoketrail.gif
>> /Users/bjorn/Desktop/smoketrail-out%d.png
>
> This produces transparent images here for the output
> file of ticket #6813.

Can anybody get this patch to output correct output for this command:
ffmpeg -v debug -f lavfi -i testsrc2=d=10:alpha=0,format=rgba -lavfi
"[0:v]palettegen[p],[0:v][p]paletteuse" 1.gif ?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]tests/api-flac-test: Rename NUMBER_OF_FRAMES as NUMBER_OF_AUDIO_FRAMES

2018-12-11 Thread Carl Eugen Hoyos
2018-12-04 2:57 GMT+01:00, Michael Niedermayer :
> On Mon, Dec 03, 2018 at 01:17:42AM +0100, Carl Eugen Hoyos wrote:
>> Hi!
>>
>> Both aix and sunos define NUMBER_OF_FRAMES in a system header (as
>> _NUMBER_OF_FRAMES), attached patch fixes a warning when running fate.
>>
>> Please comment, Carl Eugen
>
>>  api-flac-test.c |   10 +-
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>> 389d56ef407b6d7d7c8c023e6ebb41abbbd36a62
>> 0001-tests-api-flac-test-Rename-NUMBER_OF_FRAMES-as-NUMBE.patch
>> From 7360f2e9721b88bb58e55f05911b16222c249e59 Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos 
>> Date: Mon, 3 Dec 2018 01:14:24 +0100
>> Subject: [PATCH] tests/api-flac-test: Rename NUMBER_OF_FRAMES as
>>  NUMBER_OF_AUDIO_FRAMES.
>>
>> Both sunos and aix define NUMBER_OF_FRAMES in a system header,
>> causing redefinition warnings.
>> ---
>>  tests/api/api-flac-test.c |   10 +-
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> this is probably a bug in the system header ...
>
> but renaming does no harm so this patch should be ok

Patch applied.

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


Re: [FFmpeg-devel] [PATCH] avcodec: rewrite gif muxing and encoding

2018-12-11 Thread Carl Eugen Hoyos
2018-12-11 17:40 GMT+01:00, Paul B Mahol :
> On 12/11/18, Carl Eugen Hoyos  wrote:
>> 2018-12-11 17:37 GMT+01:00, Paul B Mahol :
>>> On 12/11/18, Paul B Mahol  wrote:
 On 12/11/18, Carl Eugen Hoyos  wrote:
> 2018-12-11 17:18 GMT+01:00, Paul B Mahol :
>> On 12/11/18, Carl Eugen Hoyos  wrote:
>>> 2018-12-11 16:02 GMT+01:00, Paul B Mahol :
 Now "-c copy" works.
>>>
>>> Please mention ticket #6640.
>>>
>>> When using the commands there, the output file has a different
>>> byte at position 0xbb06 (0x0a -> 0x05), do you know why?
>>
>> Dunno, md5 of decoded output is same. I fixed some artifacts in last
>> patch
>
> md5sum of original and decoded file is different here.

 Test latest patch.
>>
>> With the latest patch, md5sum of original and remuxed file are different
>> here.
>>
>
> Of course, you found single byte change.
>
>>> Test -f md5 - not md5sum.
>>
>> How can you compare a file and FFmpeg's output with -f md5?
>
> You do not know? How so?

I have no idea.

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


Re: [FFmpeg-devel] [PATCH] avcodec: rewrite gif muxing and encoding

2018-12-11 Thread Paul B Mahol
On 12/11/18, Carl Eugen Hoyos  wrote:
> 2018-12-11 17:37 GMT+01:00, Paul B Mahol :
>> On 12/11/18, Paul B Mahol  wrote:
>>> On 12/11/18, Carl Eugen Hoyos  wrote:
 2018-12-11 17:18 GMT+01:00, Paul B Mahol :
> On 12/11/18, Carl Eugen Hoyos  wrote:
>> 2018-12-11 16:02 GMT+01:00, Paul B Mahol :
>>> Now "-c copy" works.
>>
>> Please mention ticket #6640.
>>
>> When using the commands there, the output file has a different
>> byte at position 0xbb06 (0x0a -> 0x05), do you know why?
>
> Dunno, md5 of decoded output is same. I fixed some artifacts in last
> patch

 md5sum of original and decoded file is different here.
>>>
>>> Test latest patch.
>
> With the latest patch, md5sum of original and remuxed file are different
> here.
>

Of course, you found single byte change.

>> Test -f md5 - not md5sum.
>
> How can you compare a file and FFmpeg's output with -f md5?

You do not know? How so?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec: rewrite gif muxing and encoding

2018-12-11 Thread Carl Eugen Hoyos
2018-12-11 17:37 GMT+01:00, Paul B Mahol :
> On 12/11/18, Paul B Mahol  wrote:
>> On 12/11/18, Carl Eugen Hoyos  wrote:
>>> 2018-12-11 17:18 GMT+01:00, Paul B Mahol :
 On 12/11/18, Carl Eugen Hoyos  wrote:
> 2018-12-11 16:02 GMT+01:00, Paul B Mahol :
>> Now "-c copy" works.
>
> Please mention ticket #6640.
>
> When using the commands there, the output file has a different
> byte at position 0xbb06 (0x0a -> 0x05), do you know why?

 Dunno, md5 of decoded output is same. I fixed some artifacts in last
 patch
>>>
>>> md5sum of original and decoded file is different here.
>>
>> Test latest patch.

With the latest patch, md5sum of original and remuxed file are different
here.

> Test -f md5 - not md5sum.

How can you compare a file and FFmpeg's output with -f md5?

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


Re: [FFmpeg-devel] [PATCH] avcodec: rewrite gif muxing and encoding

2018-12-11 Thread Paul B Mahol
On 12/11/18, Paul B Mahol  wrote:
> On 12/11/18, Carl Eugen Hoyos  wrote:
>> 2018-12-11 17:18 GMT+01:00, Paul B Mahol :
>>> On 12/11/18, Carl Eugen Hoyos  wrote:
 2018-12-11 16:02 GMT+01:00, Paul B Mahol :
> Now "-c copy" works.

 Please mention ticket #6640.

 When using the commands there, the output file has a different
 byte at position 0xbb06 (0x0a -> 0x05), do you know why?
>>>
>>> Dunno, md5 of decoded output is same. I fixed some artifacts in last
>>> patch
>>
>> md5sum of original and decoded file is different here.
>
> Test latest patch.
>

Test -f md5 - not md5sum.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec: rewrite gif muxing and encoding

2018-12-11 Thread Paul B Mahol
On 12/11/18, Carl Eugen Hoyos  wrote:
> 2018-12-11 17:18 GMT+01:00, Paul B Mahol :
>> On 12/11/18, Carl Eugen Hoyos  wrote:
>>> 2018-12-11 16:02 GMT+01:00, Paul B Mahol :
 Now "-c copy" works.
>>>
>>> Please mention ticket #6640.
>>>
>>> When using the commands there, the output file has a different
>>> byte at position 0xbb06 (0x0a -> 0x05), do you know why?
>>
>> Dunno, md5 of decoded output is same. I fixed some artifacts in last patch
>
> md5sum of original and decoded file is different here.

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


Re: [FFmpeg-devel] [PATCH] avcodec: rewrite gif muxing and encoding

2018-12-11 Thread Carl Eugen Hoyos
2018-12-11 17:18 GMT+01:00, Paul B Mahol :
> On 12/11/18, Carl Eugen Hoyos  wrote:
>> 2018-12-11 16:02 GMT+01:00, Paul B Mahol :
>>> Now "-c copy" works.
>>
>> Please mention ticket #6640.
>>
>> When using the commands there, the output file has a different
>> byte at position 0xbb06 (0x0a -> 0x05), do you know why?
>
> Dunno, md5 of decoded output is same. I fixed some artifacts in last patch

md5sum of original and decoded file is different here.

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


Re: [FFmpeg-devel] [PATCH] avcodec: rewrite gif muxing and encoding

2018-12-11 Thread Paul B Mahol
On 12/11/18, Carl Eugen Hoyos  wrote:
> 2018-12-11 16:02 GMT+01:00, Paul B Mahol :
>> Now "-c copy" works.
>
> Please mention ticket #6640.
>
> When using the commands there, the output file has a different
> byte at position 0xbb06 (0x0a -> 0x05), do you know why?

Dunno, md5 of decoded output is same. I fixed some artifacts in last patch
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] fate: add prog suffix in fate-mov-mp4-with-mov-in24-ver

2018-12-11 Thread Gyan


On 11-12-2018 02:18 PM, Gyan wrote:


On 10-12-2018 08:53 PM, Gyan wrote:
Maybe we should set a ffprobe variable in the fate Makefile, like 
done for ffmpeg on ln 8.


Gyan


Will push tonight if no objections.


Pushed as 3b825b2f81e74bf9709d376f61fd1bf9a394f6ad

Gyan

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


Re: [FFmpeg-devel] [PATCH] avcodec: rewrite gif muxing and encoding

2018-12-11 Thread Carl Eugen Hoyos
2018-12-11 16:02 GMT+01:00, Paul B Mahol :
> Now "-c copy" works.

Please mention ticket #6640.

When using the commands there, the output file has a different
byte at position 0xbb06 (0x0a -> 0x05), do you know why?

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


Re: [FFmpeg-devel] [PATCH] avcodec: rewrite gif muxing and encoding

2018-12-11 Thread Carl Eugen Hoyos
2018-12-11 15:12 GMT+01:00, Paul B Mahol :
> Now "-c copy" works.

Please mention ticket #6640.

The last frame seems missing, at least with the commands
from this ticket.

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


Re: [FFmpeg-devel] [PATCH] avcodec/h264_refs: reset MMCO when invalid mmco code is found

2018-12-11 Thread Paul B Mahol
On 12/11/18, Carl Eugen Hoyos  wrote:
> 2018-12-10 23:41 GMT+01:00, Mark Thompson :
>> On 09/12/2018 14:21, Mark Thompson wrote:
>>> On 09/12/2018 13:54, Paul B Mahol wrote:
 On 12/9/18, Mark Thompson  wrote:
> On 09/12/2018 08:52, Paul B Mahol wrote:
>> On 12/7/18, Paul B Mahol  wrote:
>>> On 12/7/18, Michael Niedermayer  wrote:
 On Fri, Dec 07, 2018 at 10:36:23AM +0100, Paul B Mahol wrote:
> On 12/7/18, Paul B Mahol  wrote:
>> On 12/7/18, Michael Niedermayer  wrote:
>>> On Thu, Dec 06, 2018 at 03:26:41PM +0100, Paul B Mahol wrote:
 This recovers state with #7374 linked sample.

 Work funded by Open Broadcast Systems.

 Signed-off-by: Paul B Mahol 
 ---
  libavcodec/h264_refs.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
 index eaf965e43d..5645a203a7 100644
 --- a/libavcodec/h264_refs.c
 +++ b/libavcodec/h264_refs.c
 @@ -718,6 +718,7 @@ int
 ff_h264_execute_ref_pic_marking(H264Context
 *h)
  }
  break;
  case MMCO_RESET:
 +default:
  while (h->short_ref_count) {
  remove_short(h, h->short_ref[0]->frame_num, 0);
  }
 @@ -730,7 +731,6 @@ int
 ff_h264_execute_ref_pic_marking(H264Context
 *h)
  for (j = 0; j < MAX_DELAYED_PIC_COUNT; j++)
  h->last_pocs[j] = INT_MIN;
  break;
 -default: assert(0);
  }
  }
>>>
>>> mmco[i].opcode should not be invalid, its checked around the
>>> point
>>> where
>>> this
>>> array is filled.
>>> unless there is something iam missing
>>
>> Yes, you are missing big time.
>> If you think by "checked" about those nice asserts they are not
>> enabled
>> at
>> all.
>>
>
> There is check for invalid opcode, but stored invalid opcode is not
> changed.

 Theres no question that we end with a invalid value in the struct,
 but
 that
 is not intended to be in there. You can see that this is not
 intended
 by
 simply looking at the variable that holds the number of entries, it
 is
 not written at all in this case.

 So for example if this code stores 5 correct looking mmcos and the
 6th
 is
 invalid, 6 are in the array but the number of entries is just left
 where
 it
 was, that could be maybe 3 or 8 or 1. Just "defaulting out" the
 invalid
 value
 later doesnt feel ideal.
>>>
>>> Nope, mmco state is left in inconsistent state, and my patch fix it.
>>> As
>>> you
>>> provided nothing valuable to consider as alternative I will apply it.
>>>
>>
>> What about converting any invalid mmco opcode to mmco reset and
>> updating mmco size too?
>> Currently mmco size is left in previous state.
>
> Don't invent a new RESET (= 5) operation - that type is special and its
> presence implies other constraints which we probably don't want to
> think
> about here (around frame_num in particular).
>
> I think END / truncating the list would be best option?
>

 Nope, that would still put it into bad state. With your approach decoder
 does
 not recover from artifacts. Try sample from bug report #7374.
>>>
>>> Adding a spurious reset here throws away all previous reference frames,
>>> which will break the stream where it wouldn't otherwise be if the
>>> corrupted frame would have been bypassed for referencing.  For example,
>>> in
>>> real-time cases with feedback a stream which has encountered errors can
>>> be
>>> recovered without an intra frame by referring to an older frame which
>>> still exists in the DPB.
>>
>> Sample: .  The bad frame
>> here has frame_num 24, but we already hit an error before that point and
>> the
>> feedback about that makes frame_num 25 refer to LTRF 1 such that 24 is
>> never
>> used.  (From a simulator rather than a real capture, because random bit
>> errors are never where you want them.)
>>
>> It doesn't exactly hit the original issue because the leftover MMCO count
>> from the previous slice is not large enough.  With:
>>
>> diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
>> index 5645a203a7..977b4ed12f 100644
>> --- a/libavcodec/h264_refs.c
>> +++ b/libavcodec/h264_refs.c
>> @@ -875,6 +875,7 @@ int 

Re: [FFmpeg-devel] Separated FFserver code

2018-12-11 Thread Carl Eugen Hoyos
2018-11-30 15:48 GMT+01:00, Harshil Makwana :
> Hello All,
>
> I have created separate ffserver code which can be used for rtsp server only
> with no other dependency,
>
> Have a look into it:
>
> Https://github.com/harshil1991/ffserver.git

Why did you remove the copyright notice?

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


Re: [FFmpeg-devel] [RFC]lavc/mjpegenc_common: Fix aspect ratio

2018-12-11 Thread Kevin Wheatley
I guess it depends if you think that it is better to align with
defacto behaviour (and maybe clarify/correct the specifications) or
follow the specs and have users grumble about not matching the
behaviour of 'applications X, Y and Z', I'm pretty certain Photoshop
won't easily change its behaviour. The other messy option would be to
have a compatibility mode flag.

I don't think any of this is perfect!
Kevin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] fate: add prog suffix in fate-mov-mp4-with-mov-in24-ver

2018-12-11 Thread Gyan


On 10-12-2018 08:53 PM, Gyan wrote:
Maybe we should set a ffprobe variable in the fate Makefile, like done 
for ffmpeg on ln 8.


Gyan


Will push tonight if no objections.

Gyan

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