Re: [FFmpeg-devel] [PATCH] lavfi/drawtext: add alias "expr_int_format" to expansion function "eif"

2014-07-18 Thread Nicolas George
Le decadi 30 messidor, an CCXXII, Clément Bœsch a écrit :
> It's not present in 2.3 release?

No, it was applied a little bit later.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH 3/4] smacker: remove dead code

2014-07-18 Thread Paul B Mahol
On Fri, Jul 18, 2014 at 4:25 AM, Timothy Gu  wrote:

> Signed-off-by: Timothy Gu 
> ---
>  libavcodec/smacker.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
> index 644beb3..518bdad 100644
> --- a/libavcodec/smacker.c
> +++ b/libavcodec/smacker.c
> @@ -438,7 +438,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame,
>  bw = avctx->width >> 2;
>  bh = avctx->height >> 2;
>  blocks = bw * bh;
> -out = smk->pic->data[0];
>  stride = smk->pic->linesize[0];
>  while(blk < blocks) {
>  int type, run, mode;
> @@ -499,7 +498,6 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame,
>  out += stride;
>  out[0] = out[1] = pix & 0xFF;
>  out[2] = out[3] = pix >> 8;
> -out += stride;



 break;
>  case 2:
>  for(i = 0; i < 2; i++) {
> --
> 1.9.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

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


Re: [FFmpeg-devel] avformat/hlsenc: pull request for single file mode

2014-07-18 Thread Nicolas Martyanoff
Hi,

Any chance someone could take a look to these patches ?

-- 
Nicolas Martyanoff
http://wandrian.net
khae...@gmail.com
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avformat/hlsenc: pull request for single file mode

2014-07-18 Thread Stefano Sabatini
On date Friday 2014-07-18 10:07:21 +0200, Nicolas Martyanoff encoded:
> Hi,
> 
> Any chance someone could take a look to these patches ?

Could you send them to this mailing-list?

This way we will be able to make a proper inline review, thanks.
-- 
FFmpeg = Fundamentalist & Freak Mysterious Power Ecstatic Guide
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] avformat/hlsenc: pull request for single file mode

2014-07-18 Thread Nicolas Martyanoff
The FFmpeg developer info page said it was fine to use github instead of
mailing patches, but if you prefer, I can mail them.

-- 
Nicolas Martyanoff
http://wandrian.net
khae...@gmail.com
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] ffmpeg_filter: refuse to configure input without a decoder.

2014-07-18 Thread Nicolas George
The decoder is necessary in order to filter frames.
This makes the error message clearer in this case:
currently, it will usually fail because the pixel or sample
format is not defined and is converted into "(null)"
(non-portable).

Signed-off-by: Nicolas George 
---
 ffmpeg_filter.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 50ee422..b6dc42f 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -830,6 +830,12 @@ static int configure_input_filter(FilterGraph *fg, 
InputFilter *ifilter,
 av_freep(&ifilter->name);
 DESCRIBE_FILTER_LINK(ifilter, in, 1);
 
+if (!ifilter->ist->dec) {
+av_log(NULL, AV_LOG_ERROR,
+   "No decoder for stream #%d:%d, filtering impossible\n",
+   ifilter->ist->file_index, ifilter->ist->st->index);
+return AVERROR_DECODER_NOT_FOUND;
+}
 switch (avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx)) {
 case AVMEDIA_TYPE_VIDEO: return configure_input_video_filter(fg, ifilter, 
in);
 case AVMEDIA_TYPE_AUDIO: return configure_input_audio_filter(fg, ifilter, 
in);
-- 
2.0.1

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


[FFmpeg-devel] [PATCH 1/7] avformat/hlsenc: correctly compute target duration

2014-07-18 Thread Nicolas Martyanoff
With HLS, the duration of all segments must be lower or equal to the target
duration. Therefore floor(duration + 0.5) yields incorrect results.

For example, for duration = 1.35, floor(duration + 0.5) yields 1.0, but the
correct result is 2.0.
---
 libavformat/hlsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 86447d8..388a23a 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -141,7 +141,7 @@ static int hls_window(AVFormatContext *s, int last)
 
 for (en = hls->list; en; en = en->next) {
 if (target_duration < en->duration)
-target_duration = (int) floor(en->duration + 0.5);
+target_duration = ceil(en->duration);
 }
 
 avio_printf(hls->pb, "#EXTM3U\n");
-- 
1.8.5.5

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


[FFmpeg-devel] [PATCH 3/7] avformat/hlsenc: fix segmentation issues

2014-07-18 Thread Nicolas Martyanoff
- Select a reference stream (the first video stream, or the first audio
  stream if there is no video stream) instead of using the PTS of any video
  stream.

- Control the segment length using the time since the last segment.
---
 libavformat/hlsenc.c | 165 +++
 1 file changed, 101 insertions(+), 64 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 30b320f..76cbd0e 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -41,23 +41,25 @@ typedef struct HLSSegment {
 typedef struct HLSContext {
 const AVClass *class;  // Class for private options.
 
-unsigned number;
 int64_t sequence;
 int64_t start_sequence;
+int nb_entries;
+int max_nb_segments;
 
 AVOutputFormat *oformat;
 AVFormatContext *ctx;
 
 float target_duration;
-int max_nb_segments;
 int wrap;
 
 int64_t recording_time;
 int has_video;
-int64_t start_pts;
-int64_t end_pts;
-double duration;  // last segment duration computed so far, in seconds
-int nb_entries;
+int64_t first_pts; ///< first PTS found in the input file
+int64_t last_pts;  ///< PTS of the last packet we splitted at
+
+int ref_stream; ///< the index of the stream used as time reference
+
+double segment_duration; // last segment duration computed so far, in 
seconds
 
 HLSSegment *segments;
 HLSSegment *last_segment;
@@ -71,10 +73,15 @@ typedef struct HLSContext {
 static int hls_mux_init(AVFormatContext *ctx)
 {
 HLSContext *hls;
-int i;
+int i, video_ref, audio_ref;
 
 hls = ctx->priv_data;
 
+hls->segment_duration = 0.0;
+
+hls->first_pts = AV_NOPTS_VALUE;
+hls->last_pts = AV_NOPTS_VALUE;
+
 hls->ctx = avformat_alloc_context();
 if (!hls->ctx)
 return AVERROR(ENOMEM);
@@ -83,21 +90,61 @@ static int hls_mux_init(AVFormatContext *ctx)
 hls->ctx->interrupt_callback = ctx->interrupt_callback;
 av_dict_copy(&hls->ctx->metadata, ctx->metadata, 0);
 
+hls->ref_stream = -1;
+video_ref = -1;
+audio_ref = -1;
+
 for (i = 0; i < ctx->nb_streams; i++) {
-AVStream *stream;
+AVStream *stream, *input_stream;
 
+input_stream = ctx->streams[i];
+
+/* Create output stream */
 stream = avformat_new_stream(hls->ctx, NULL);
 if (!stream)
 return AVERROR(ENOMEM);
 
-avcodec_copy_context(stream->codec, ctx->streams[i]->codec);
-stream->sample_aspect_ratio = ctx->streams[i]->sample_aspect_ratio;
+avcodec_copy_context(stream->codec, input_stream->codec);
+stream->sample_aspect_ratio = input_stream->sample_aspect_ratio;
+
+/* See if we can use this stream as a time reference. We use the first
+ * video stream found, or the first audio stream if there is no video
+ * stream. */
+switch (input_stream->codec->codec_type) {
+case AVMEDIA_TYPE_VIDEO:
+hls->has_video++;
+if (video_ref == -1)
+video_ref = i;
+break;
+
+case AVMEDIA_TYPE_AUDIO:
+if (audio_ref == -1)
+audio_ref = i;
+break;
+
+default:
+break;
+}
+}
+
+if (hls->has_video > 1) {
+av_log(ctx, AV_LOG_WARNING,
+   "More than a single video stream present, "
+   "expect issues decoding it.\n");
+}
+
+if (video_ref >= 0) {
+hls->ref_stream = video_ref;
+} else if (audio_ref >= 0) {
+hls->ref_stream = audio_ref;
+} else {
+return AVERROR_STREAM_NOT_FOUND;
 }
 
 return 0;
 }
 
-static int hls_append_segment(HLSContext *hls, double duration)
+static int hls_append_segment(HLSContext *hls)
 {
 const char *basename;
 HLSSegment *segment;
@@ -111,7 +158,8 @@ static int hls_append_segment(HLSContext *hls, double 
duration)
 basename = av_basename(hls->ctx->filename);
 av_strlcpy(segment->filename, basename, sizeof(segment->filename));
 
-segment->duration = duration;
+segment->duration = hls->segment_duration;
+
 segment->next = NULL;
 
 if (!hls->segments) {
@@ -214,7 +262,6 @@ static int hls_create_file(AVFormatContext *ctx)
"Invalid segment filename template '%s'\n", 
hls->media_filename);
 return AVERROR(EINVAL);
 }
-hls->number++;
 
 ret = avio_open2(&hls->ctx->pb, hls->ctx->filename, AVIO_FLAG_WRITE,
  &ctx->interrupt_callback, NULL);
@@ -230,30 +277,15 @@ static int hls_create_file(AVFormatContext *ctx)
 static int hls_write_header(AVFormatContext *ctx)
 {
 HLSContext *hls;
-int ret, i;
+int ret;
 char *dot;
 size_t basename_size;
 char filename[1024];
 
 hls = ctx->priv_data;
 
-hls->sequence   = hls->start_sequence;
+hls->sequence  = hls->start_sequence;
 hls->recording_time = hls->target_duration * AV_TIME_BASE;
-hls->start_pts

[FFmpeg-devel] [PATCH 2/7] avformat/hlsenc: make the code easier to read

2014-07-18 Thread Nicolas Martyanoff
Before adding new features, I read the code and cleaned it. The main issue was
abstruse identifier names.

The behaviour of the muxer is *not* modified, by this patch, this is only
cosmetic. If this is not the case, it is a mistake.
---
 libavformat/hlsenc.c | 360 ++-
 1 file changed, 213 insertions(+), 147 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 388a23a..30b320f 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -31,236 +31,294 @@
 #include "avformat.h"
 #include "internal.h"
 
-typedef struct ListEntry {
-char  name[1024];
-double   duration;
-struct ListEntry *next;
-} ListEntry;
+typedef struct HLSSegment {
+char filename[1024];
+double duration; /* in seconds */
+
+struct HLSSegment *next;
+} HLSSegment;
 
 typedef struct HLSContext {
 const AVClass *class;  // Class for private options.
+
 unsigned number;
 int64_t sequence;
 int64_t start_sequence;
+
 AVOutputFormat *oformat;
-AVFormatContext *avf;
-float time;// Set by a private option.
-int  size; // Set by a private option.
-int  wrap; // Set by a private option.
+AVFormatContext *ctx;
+
+float target_duration;
+int max_nb_segments;
+int wrap;
+
 int64_t recording_time;
 int has_video;
 int64_t start_pts;
 int64_t end_pts;
 double duration;  // last segment duration computed so far, in seconds
 int nb_entries;
-ListEntry *list;
-ListEntry *end_list;
-char *basename;
+
+HLSSegment *segments;
+HLSSegment *last_segment;
+
+char *media_filename;
 char *baseurl;
+
 AVIOContext *pb;
 } HLSContext;
 
-static int hls_mux_init(AVFormatContext *s)
+static int hls_mux_init(AVFormatContext *ctx)
 {
-HLSContext *hls = s->priv_data;
-AVFormatContext *oc;
+HLSContext *hls;
 int i;
 
-hls->avf = oc = avformat_alloc_context();
-if (!oc)
+hls = ctx->priv_data;
+
+hls->ctx = avformat_alloc_context();
+if (!hls->ctx)
 return AVERROR(ENOMEM);
 
-oc->oformat= hls->oformat;
-oc->interrupt_callback = s->interrupt_callback;
-av_dict_copy(&oc->metadata, s->metadata, 0);
+hls->ctx->oformat = hls->oformat;
+hls->ctx->interrupt_callback = ctx->interrupt_callback;
+av_dict_copy(&hls->ctx->metadata, ctx->metadata, 0);
 
-for (i = 0; i < s->nb_streams; i++) {
-AVStream *st;
-if (!(st = avformat_new_stream(oc, NULL)))
+for (i = 0; i < ctx->nb_streams; i++) {
+AVStream *stream;
+
+stream = avformat_new_stream(hls->ctx, NULL);
+if (!stream)
 return AVERROR(ENOMEM);
-avcodec_copy_context(st->codec, s->streams[i]->codec);
-st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
+
+avcodec_copy_context(stream->codec, ctx->streams[i]->codec);
+stream->sample_aspect_ratio = ctx->streams[i]->sample_aspect_ratio;
 }
 
 return 0;
 }
 
-static int append_entry(HLSContext *hls, double duration)
+static int hls_append_segment(HLSContext *hls, double duration)
 {
-ListEntry *en = av_malloc(sizeof(*en));
+const char *basename;
+HLSSegment *segment;
 
-if (!en)
+/* Create a new segment and append it to the segment list */
+
+segment = av_malloc(sizeof(*segment));
+if (!segment)
 return AVERROR(ENOMEM);
 
-av_strlcpy(en->name, av_basename(hls->avf->filename), sizeof(en->name));
+basename = av_basename(hls->ctx->filename);
+av_strlcpy(segment->filename, basename, sizeof(segment->filename));
 
-en->duration = duration;
-en->next = NULL;
+segment->duration = duration;
+segment->next = NULL;
 
-if (!hls->list)
-hls->list = en;
-else
-hls->end_list->next = en;
+if (!hls->segments) {
+hls->segments = segment;
+} else {
+hls->last_segment->next = segment;
+}
 
-hls->end_list = en;
+hls->last_segment = segment;
 
-if (hls->size && hls->nb_entries >= hls->size) {
-en = hls->list;
-hls->list = en->next;
-av_free(en);
-} else
+if (hls->max_nb_segments > 0 && hls->nb_entries >= hls->max_nb_segments) {
+segment = hls->segments;
+hls->segments = segment->next;
+av_free(segment);
+} else {
 hls->nb_entries++;
+}
 
 hls->sequence++;
 
 return 0;
 }
 
-static void free_entries(HLSContext *hls)
+static void hls_free_segments(HLSContext *hls)
 {
-ListEntry *p = hls->list, *en;
+HLSSegment *segment;
 
-while(p) {
-en = p;
-p = p->next;
-av_free(en);
+segment = hls->segments;
+
+while (segment) {
+HLSSegment *next;
+
+next = segment->next;
+av_free(segment);
+segment = next;
 }
 }
 
-static int hls_window(AVFormatContext *s, int last)
+static int hls_generate_playlist(AVFormatContex

[FFmpeg-devel] [PATCH 4/7] avformat/hlsenc: do not regenerate the playlist for each segment

2014-07-18 Thread Nicolas Martyanoff
Since we need all segments to find out the target duration, we can only
generate the playlist after writing all segments.

There is no need to rewrite the segment list every time we create a new
segment file.
---
 libavformat/hlsenc.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 76cbd0e..5dde17a 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -198,7 +198,7 @@ static void hls_free_segments(HLSContext *hls)
 }
 }
 
-static int hls_generate_playlist(AVFormatContext *ctx, int last)
+static int hls_generate_playlist(AVFormatContext *ctx)
 {
 HLSContext *hls;
 HLSSegment *segment;
@@ -233,8 +233,7 @@ static int hls_generate_playlist(AVFormatContext *ctx, int 
last)
 (hls->baseurl ? hls->baseurl : ""), segment->filename);
 }
 
-if (last)
-avio_printf(hls->pb, "#EXT-X-ENDLIST\n");
+avio_printf(hls->pb, "#EXT-X-ENDLIST\n");
 
 avio_closep(&hls->pb);
 return 0;
@@ -395,10 +394,6 @@ static int hls_write_packet(AVFormatContext *ctx, AVPacket 
*pkt)
 ret = hls_create_file(ctx);
 if (ret)
 return ret;
-
-ret = hls_generate_playlist(ctx, 0);
-if (ret < 0)
-return ret;
 }
 
 ret = ff_write_chained(hls->ctx, pkt->stream_index, pkt, ctx);
@@ -420,7 +415,7 @@ static int hls_write_trailer(struct AVFormatContext *ctx)
 av_free(hls->media_filename);
 hls_append_segment(hls);
 
-hls_generate_playlist(ctx, 1);
+hls_generate_playlist(ctx);
 
 hls_free_segments(hls);
 avio_close(hls->pb);
-- 
1.8.5.5

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


[FFmpeg-devel] [PATCH 6/7] avformat/hlsenc: add a flag disabling the filename in segment names

2014-07-18 Thread Nicolas Martyanoff
The default way to name segment is to use the name of the media file, with an
optional prefix (-hls_base_url).

However in applications where the URL used to fetch segments does not contain
the name of the file, it is useful to have the ability not to include the
filename in segment names.

Of course this only makes sense in single file mode, since without it,
segments are stored in individual files.
---
 doc/muxers.texi  |  6 ++
 libavformat/hlsenc.c | 22 +-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 186619e..b97775b 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -256,6 +256,12 @@ ffmpeg -i in.nut -hls_flags single_file out.m3u8
 @end example
 Will produce the playlist, @file{out.m3u8}, and a single segment file,
 @file{out.ts}.
+
+@item hls_flags no_filename
+If this flag is set, the HLS playlist will not include the filename in each
+segment description, only the URL provided with the @option{baseurl} option.
+This option can only be used if the @option{single_file} flag is set, and if
+the @option{baseurl} option is provided.
 @end table
 
 @anchor{ico}
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 8b644a2..0faf53f 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -43,6 +43,8 @@ typedef struct HLSSegment {
 typedef enum HLSFlags {
 // Generate a single media file and use byte ranges in the playlist.
 HLS_SINGLE_FILE = (1 << 0),
+// Do not include the media filename in segment name (only the base url)
+HLS_NO_FILENAME = (1 << 1),
 } HLSFlags;
 
 typedef struct HLSContext {
@@ -87,6 +89,22 @@ static int hls_mux_init(AVFormatContext *ctx)
 
 hls = ctx->priv_data;
 
+if (hls->flags & HLS_NO_FILENAME) {
+if (!(hls->flags & HLS_SINGLE_FILE)) {
+av_log(ctx, AV_LOG_ERROR,
+   "HLS flag 'no_filename' cannot be used without flag "
+   "'single_file'\n");
+return AVERROR(EINVAL);
+}
+
+if (!hls->baseurl) {
+av_log(ctx, AV_LOG_ERROR,
+   "HLS flag 'no_filename' cannot be used without "
+   "-hls_base_url\n");
+return AVERROR(EINVAL);
+}
+}
+
 hls->segment_duration = 0.0;
 hls->segment_size = 0;
 hls->segment_pos = 0;
@@ -260,7 +278,8 @@ static int hls_generate_playlist(AVFormatContext *ctx)
 }
 
 avio_printf(hls->pb, "%s%s\n",
-(hls->baseurl ? hls->baseurl : ""), segment->filename);
+(hls->baseurl ? hls->baseurl : ""),
+((hls->flags & HLS_NO_FILENAME) ? "" : segment->filename));
 }
 
 avio_printf(hls->pb, "#EXT-X-ENDLIST\n");
@@ -486,6 +505,7 @@ static const AVOption options[] = {
 
 {"hls_flags",   "set flags affecting HLS playlist and media file 
generation", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0 }, 0, UINT_MAX, E, 
"flags"},
 {"single_file", "generate a single media file indexed with byte ranges", 
0, AV_OPT_TYPE_CONST, {.i64 = HLS_SINGLE_FILE }, 0, UINT_MAX,   E, "flags"},
+{"no_filename", "do not use the name of the media file in segment names", 
0, AV_OPT_TYPE_CONST, {.i64 = HLS_NO_FILENAME }, 0, UINT_MAX,   E, "flags"},
 
 { NULL },
 };
-- 
1.8.5.5

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


[FFmpeg-devel] [PATCH 7/7] avformat/hlsenc: add an option to set the media filename

2014-07-18 Thread Nicolas Martyanoff
Works with or without the 'single_file' HLS flag.
---
 doc/muxers.texi  | 11 +++
 libavformat/hlsenc.c | 31 ++-
 2 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index b97775b..63a0fdf 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -246,6 +246,17 @@ and it is not to be confused with the segment filename 
sequence number
 which can be cyclic, for example if the @option{wrap} option is
 specified.
 
+@item hls_media_filename @var{filename}
+Set the name used for generated MPEG-TS files. If the @option{single_file}
+flag is set, this is the name of the single file. If this flag was not set,
+this is the pattern used for generated files.
+For example:
+@example
+ffmpeg -i in.nut -hls_media_filename test-%d.ts out.m3u8
+@end example
+Will produce the playlist, @file{out.m3u8}, and segment files:
+@file{test-0.ts}, @file{test-1.ts}, @file{test-2.ts}, etc.
+
 @item hls_flags single_file
 If this flag is set, the muxer will store all segments in a single MPEG-TS
 file, and will use byte ranges in the playlist. HLS playlists generated with
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 0faf53f..79736a1 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -76,6 +76,7 @@ typedef struct HLSContext {
 HLSSegment *segments;
 HLSSegment *last_segment;
 
+char *media_filename_opt;
 char *media_filename;
 char *baseurl;
 
@@ -333,8 +334,6 @@ static int hls_write_header(AVFormatContext *ctx)
 HLSContext *hls;
 int ret;
 char *dot;
-size_t basename_size;
-char filename[1024];
 
 hls = ctx->priv_data;
 
@@ -349,23 +348,28 @@ static int hls_write_header(AVFormatContext *ctx)
 }
 
 /* Generate the name of the media file(s) */
-av_strlcpy(filename, ctx->filename, sizeof(filename));
-dot = strrchr(filename, '.');
-if (dot)
-*dot = '\0';
+if (hls->media_filename_opt) {
+hls->media_filename = av_strdup(hls->media_filename_opt);
+} else {
+char filename[1024];
+
+av_strlcpy(filename, ctx->filename, sizeof(filename));
+dot = strrchr(filename, '.');
+if (dot)
+*dot = '\0';
+
+if (!(hls->flags & HLS_SINGLE_FILE))
+av_strlcat(filename, "%d", sizeof(filename));
+av_strlcat(filename, ".ts", sizeof(filename));
+
+hls->media_filename = av_strdup(filename);
+}
 
-basename_size = sizeof(filename);
-hls->media_filename = av_malloc(basename_size);
 if (!hls->media_filename) {
 ret = AVERROR(ENOMEM);
 goto fail;
 }
 
-av_strlcpy(hls->media_filename, filename, basename_size);
-if (!(hls->flags & HLS_SINGLE_FILE))
-av_strlcat(hls->media_filename, "%d", basename_size);
-av_strlcat(hls->media_filename, ".ts", basename_size);
-
 /* Initialize the muxer and create the first file */
 ret = hls_mux_init(ctx);
 if (ret < 0)
@@ -502,6 +506,7 @@ static const AVOption options[] = {
 {"hls_list_size", "set maximum number of playlist entries",  
OFFSET(max_nb_segments), AV_OPT_TYPE_INT,{.i64 = 5}, 0, INT_MAX, E},
 {"hls_wrap",  "set number after which the index wraps",  OFFSET(wrap), 
   AV_OPT_TYPE_INT,{.i64 = 0}, 0, INT_MAX, E},
 {"hls_base_url",  "url to prepend to each playlist entry",   
OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   E},
+{"hls_media_filename",  "the name of generated media files", 
OFFSET(media_filename_opt), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0, E},
 
 {"hls_flags",   "set flags affecting HLS playlist and media file 
generation", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0 }, 0, UINT_MAX, E, 
"flags"},
 {"single_file", "generate a single media file indexed with byte ranges", 
0, AV_OPT_TYPE_CONST, {.i64 = HLS_SINGLE_FILE }, 0, UINT_MAX,   E, "flags"},
-- 
1.8.5.5

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


[FFmpeg-devel] [PATCH 5/7] avformat/hlsenc: add single file mode

2014-07-18 Thread Nicolas Martyanoff
HLS version 4 offers the possibility to keep the media file whole instead of
splitting it. In that case, segments are specified with byte ranges.

We introduce a new '-hls_flags' option for the hlsenc muxer, with a single
flag for the time being, 'single_file'.
---
 doc/muxers.texi  | 23 ++---
 libavformat/hlsenc.c | 91 ++--
 2 files changed, 93 insertions(+), 21 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index dc2a08b..186619e 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -194,15 +194,19 @@ can not be smaller than one centi second.
 Apple HTTP Live Streaming muxer that segments MPEG-TS according to
 the HTTP Live Streaming (HLS) specification.
 
-It creates a playlist file and numbered segment files. The output
-filename specifies the playlist filename; the segment filenames
-receive the same basename as the playlist, a sequential number and
-a .ts extension.
+It creates a playlist file, and one or more segment files. The output filename
+specifies the playlist filename.
+
+By default, the muxer creates a file for each segment produced. These files
+have the same name as the playlist, followed by a sequential number and a
+.ts extension.
 
 For example, to convert an input file with @command{ffmpeg}:
 @example
 ffmpeg -i in.nut out.m3u8
 @end example
+This example will produce the playlist, @file{out.m3u8}, and segment files:
+@file{out0.ts}, @file{out1.ts}, @file{out2.ts}, etc.
 
 See also the @ref{segment} muxer, which provides a more generic and
 flexible implementation of a segmenter, and can be used to perform HLS
@@ -241,6 +245,17 @@ Note that the playlist sequence number must be unique for 
each segment
 and it is not to be confused with the segment filename sequence number
 which can be cyclic, for example if the @option{wrap} option is
 specified.
+
+@item hls_flags single_file
+If this flag is set, the muxer will store all segments in a single MPEG-TS
+file, and will use byte ranges in the playlist. HLS playlists generated with
+this way will have the version number 4.
+For example:
+@example
+ffmpeg -i in.nut -hls_flags single_file out.m3u8
+@end example
+Will produce the playlist, @file{out.m3u8}, and a single segment file,
+@file{out.ts}.
 @end table
 
 @anchor{ico}
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 5dde17a..8b644a2 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -34,10 +34,17 @@
 typedef struct HLSSegment {
 char filename[1024];
 double duration; /* in seconds */
+size_t size; /* in bytes */
+int64_t pos; /* in bytes */
 
 struct HLSSegment *next;
 } HLSSegment;
 
+typedef enum HLSFlags {
+// Generate a single media file and use byte ranges in the playlist.
+HLS_SINGLE_FILE = (1 << 0),
+} HLSFlags;
+
 typedef struct HLSContext {
 const AVClass *class;  // Class for private options.
 
@@ -51,6 +58,7 @@ typedef struct HLSContext {
 
 float target_duration;
 int wrap;
+uint32_t flags; // enum HLSFlags
 
 int64_t recording_time;
 int has_video;
@@ -60,6 +68,8 @@ typedef struct HLSContext {
 int ref_stream; ///< the index of the stream used as time reference
 
 double segment_duration; // last segment duration computed so far, in 
seconds
+size_t segment_size; // in bytes
+int64_t segment_pos; // offset in bytes
 
 HLSSegment *segments;
 HLSSegment *last_segment;
@@ -78,6 +88,8 @@ static int hls_mux_init(AVFormatContext *ctx)
 hls = ctx->priv_data;
 
 hls->segment_duration = 0.0;
+hls->segment_size = 0;
+hls->segment_pos = 0;
 
 hls->first_pts = AV_NOPTS_VALUE;
 hls->last_pts = AV_NOPTS_VALUE;
@@ -159,6 +171,8 @@ static int hls_append_segment(HLSContext *hls)
 av_strlcpy(segment->filename, basename, sizeof(segment->filename));
 
 segment->duration = hls->segment_duration;
+segment->size = hls->segment_size;
+segment->pos = hls->segment_pos;
 
 segment->next = NULL;
 
@@ -204,12 +218,22 @@ static int hls_generate_playlist(AVFormatContext *ctx)
 HLSSegment *segment;
 int target_duration;
 int64_t sequence;
+unsigned int version;
 int ret;
 
 hls = ctx->priv_data;
 target_duration = 0;
 ret = 0;
 
+if (hls->flags & HLS_SINGLE_FILE) {
+/* Byte ranges are part of HLS version 4. */
+version = 4;
+} else {
+/* We use floating point values for segment durations, which are part
+ * of HLS version 3. */
+version = 3;
+}
+
 ret = avio_open2(&hls->pb, ctx->filename, AVIO_FLAG_WRITE,
  &ctx->interrupt_callback, NULL);
 if (ret < 0)
@@ -221,7 +245,7 @@ static int hls_generate_playlist(AVFormatContext *ctx)
 }
 
 avio_printf(hls->pb, "#EXTM3U\n");
-avio_printf(hls->pb, "#EXT-X-VERSION:3\n");
+avio_printf(hls->pb, "#EXT-X-VERSION:%u\n", version);
 avio_printf(hls->pb, "#EXT-X-TARGETDURATION:%d\n", target_duration);
 
 sequence = FFM

[FFmpeg-devel] [PATCH] libavu: add pkt_timebase to AVFrame.

2014-07-18 Thread Benoit Fouet
In order to easily correlate pkt_duration to its real duration, add the
packet time base information to the frame structure.

Fixes issue #3052
---
 libavcodec/utils.c |  6 ++
 libavutil/frame.c  |  3 +++
 libavutil/frame.h  | 11 +++
 3 files changed, 20 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 9fa8e16..2fe4aba 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -751,6 +751,7 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame 
*frame)
 frame->pkt_pts = pkt->pts;
 av_frame_set_pkt_pos (frame, pkt->pos);
 av_frame_set_pkt_duration(frame, pkt->duration);
+av_frame_set_pkt_timebase(frame, avctx->time_base);
 av_frame_set_pkt_size(frame, pkt->size);
 
 /* copy the replaygain data to the output frame */
@@ -776,6 +777,7 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame 
*frame)
 frame->pkt_pts = AV_NOPTS_VALUE;
 av_frame_set_pkt_pos (frame, -1);
 av_frame_set_pkt_duration(frame, 0);
+av_frame_set_pkt_timebase(frame, (AVRational){ 0, });
 av_frame_set_pkt_size(frame, -1);
 }
 frame->reordered_opaque = avctx->reordered_opaque;
@@ -2063,6 +2065,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
 avpkt->size = 0;
 else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY))
 avpkt->pts = avpkt->dts = frame->pts;
+if (frame && av_frame_get_pkt_timebase(frame).num)
+avpkt->duration = av_rescale_q(av_frame_get_pkt_duration(frame),
+   av_frame_get_pkt_timebase(frame),
+   avctx->time_base);
 
 if (needs_realloc && avpkt->data) {
 ret = av_buffer_realloc(&avpkt->buf, avpkt->size + 
FF_INPUT_BUFFER_PADDING_SIZE);
diff --git a/libavutil/frame.c b/libavutil/frame.c
index fdfbc46..be60776 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -29,6 +29,7 @@
 
 MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
 MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
+MAKE_ACCESSORS(AVFrame, frame, AVRational, pkt_timebase)
 MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
 MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout)
 MAKE_ACCESSORS(AVFrame, frame, int, channels)
@@ -98,6 +99,7 @@ static void get_frame_defaults(AVFrame *frame)
 frame->pkt_pts   = AV_NOPTS_VALUE;
 av_frame_set_best_effort_timestamp(frame, AV_NOPTS_VALUE);
 av_frame_set_pkt_duration (frame, 0);
+av_frame_set_pkt_timebase (frame, (AVRational){ 0, });
 av_frame_set_pkt_pos  (frame, -1);
 av_frame_set_pkt_size (frame, -1);
 frame->key_frame   = 1;
@@ -475,6 +477,7 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
 dst->pkt_pos= src->pkt_pos;
 dst->pkt_size   = src->pkt_size;
 dst->pkt_duration   = src->pkt_duration;
+dst->pkt_timebase   = src->pkt_timebase;
 dst->reordered_opaque   = src->reordered_opaque;
 dst->quality= src->quality;
 dst->best_effort_timestamp  = src->best_effort_timestamp;
diff --git a/libavutil/frame.h b/libavutil/frame.h
index a39c8d0..954b765 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -530,6 +530,15 @@ typedef struct AVFrame {
  * Not to be accessed directly from outside libavutil
  */
 AVBufferRef *qp_table_buf;
+
+/**
+ * timebase of the corresponding packet.
+ * Code outside libavcodec should access this field using:
+ * av_frame_get_pkt_timebase(frame)
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+AVRational pkt_timebase;
 } AVFrame;
 
 /**
@@ -541,6 +550,8 @@ int64_t av_frame_get_best_effort_timestamp(const AVFrame 
*frame);
 voidav_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
 int64_t av_frame_get_pkt_duration (const AVFrame *frame);
 voidav_frame_set_pkt_duration (AVFrame *frame, int64_t val);
+AVRational av_frame_get_pkt_timebase  (const AVFrame *frame);
+voidav_frame_set_pkt_timebase (AVFrame *frame, AVRational val);
 int64_t av_frame_get_pkt_pos  (const AVFrame *frame);
 voidav_frame_set_pkt_pos  (AVFrame *frame, int64_t val);
 int64_t av_frame_get_channel_layout   (const AVFrame *frame);
-- 
2.0.1.442.g7fe6834

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


Re: [FFmpeg-devel] [PATCH] libavu: add pkt_timebase to AVFrame.

2014-07-18 Thread Nicolas George
Le decadi 30 messidor, an CCXXII, Benoit Fouet a écrit :
> +if (frame && av_frame_get_pkt_timebase(frame).num)
> +avpkt->duration = av_rescale_q(av_frame_get_pkt_duration(frame),
> +   av_frame_get_pkt_timebase(frame),
> +   avctx->time_base);

I suspect this is not a good idea at all: in a lot of cases,
av_frame_get_pkt_duration(frame) contains a random value not correlated to
the actual duration of the packet.

Making use of a field that was previously unused is an API change, and it
must be considered very carefully.

I suspect you can observe the inconsistent behaviour just by using ffmpeg
with a frame rate change, but I am not certain that is as simple as that.
Other applications may break more easily.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] A few filter questions

2014-07-18 Thread Gerion Entrup
Am Donnerstag 17 Juli 2014, 17:24:35 schrieb Clément Bœsch:
> On Thu, Jul 17, 2014 at 04:56:08PM +0200, Gerion Entrup wrote:
> [...]
> 
> > > Also, you still have the string metadata possibility (git grep SET_META
> > > libavfilter).
> > 
> > Hmm, thank you, I will take a look at it. If I see it right, it is used to
> > fill a dictionary per frame with some kind of data?
> 
> Strings only, so you'll have to find a serialization somehow. Maybe simply
> an ascii hex string or something. But yeah, it just allows you to map some
> key → value string couples to the frames passing by in the filter.
> 
> How huge is the information to store per frame?
82 byte per frame for the finesignature
(Could be split again in three parts: An one byte confidence, a 5 byte words 
vector, and a 76 byte framesignature, something like:
struct finesignature{
uint8_t confidence;
uint8_t words[5];
uint8_t framesignature[76]
})
152 byte per 90 frames for the coursesignature
(Note, that there are 2 coursesignatures with an offset of 45 frames:
0-89
45-134
90-179
...)

If I see it right, there are two possibilies:
Write as chars in the output (looks crappy, but needs the same amount of 
memory).
Write as ascii hex in the output (looks nice, but needs twice as much memory).

> 
> [...]
> 
> > > stdout/stderr really isn't a good thing. Using metadata is way better
> > > because you can output them from ffprobe, and parse them according to
> > > various outputs (XML, CSV, JSON, ...).
> > 
> > Sounds good…
> 
> tools/normalize.py make use of such feature if you want examples (that's
> the -of option of ffprobe)
Ok.
> 
> [...]
> 
> > > Am I understanding right your wondering?
> > 
> > No ;), but anyway thanks for your answer. In your 2nd method your filter
> > is a VV->V filter? Am I right, that this filter then also can take only
> > one stream? Said in another way: Can a VV->V filter also behave as a V->V
> > filter?
> Yes, fieldmatch is a (complex) example of this. But typically it's simply
> a filter with dynamic inputs, based on the user input. The simplest
> example would be the split filter. Look at it for an example of dynamic
> allocation of the number of inputs based on the user input (-vf split=4 is
> a V-> filter)
Hmm, interesting code, thank you.
> 
> [...]
> 
> > > Check tools/normalize.py, it's using ebur128 and the metadata system.
> > 
> > Thats what I mean. Someone has to write an external script, which calls
> > ffmpeg/ffprobe two times, parse stdout of the first call and pass it to
> > the
> > filteroptions of the second call. As I see, there is no direct way.
> > Something like:
> > ffmpeg -i foo -f:a volume=mode=autodetect normalized.opus
> 
> We add a discussion several time for real time with that filter. If we do
> a 2-pass, that's simply because it's "more efficient". Typically, doing
> some live normalization can be done easily (we had patches for this):
> ebur128 already attaches some metadata to frames, so a following filter
> such as volume could reuse them, something like -filter_complex
> ebur128=metadata=1,volume=metadata.
> 
> [...]

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


Re: [FFmpeg-devel] [PATCH] libavu: add pkt_timebase to AVFrame.

2014-07-18 Thread Hendrik Leppkes
Am 18.07.2014 12:04 schrieb "Benoit Fouet" :
>
> In order to easily correlate pkt_duration to its real duration, add the
> packet time base information to the frame structure.
>
> Fixes issue #3052

The code in avcodec doesn't know the timebase, unless the user tells it.

And if the user wants to tell it, there already is an avctx field for it
(pkt_timebase), no need to store it in the frame since its not going to
change in every frame.

As such, I'm not sure what this new field would solve.

> ---
>  libavcodec/utils.c |  6 ++
>  libavutil/frame.c  |  3 +++
>  libavutil/frame.h  | 11 +++
>  3 files changed, 20 insertions(+)
>
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 9fa8e16..2fe4aba 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -751,6 +751,7 @@ int ff_init_buffer_info(AVCodecContext *avctx,
AVFrame *frame)
>  frame->pkt_pts = pkt->pts;
>  av_frame_set_pkt_pos (frame, pkt->pos);
>  av_frame_set_pkt_duration(frame, pkt->duration);
> +av_frame_set_pkt_timebase(frame, avctx->time_base);
>  av_frame_set_pkt_size(frame, pkt->size);
>
>  /* copy the replaygain data to the output frame */
> @@ -776,6 +777,7 @@ int ff_init_buffer_info(AVCodecContext *avctx,
AVFrame *frame)
>  frame->pkt_pts = AV_NOPTS_VALUE;
>  av_frame_set_pkt_pos (frame, -1);
>  av_frame_set_pkt_duration(frame, 0);
> +av_frame_set_pkt_timebase(frame, (AVRational){ 0, });
>  av_frame_set_pkt_size(frame, -1);
>  }
>  frame->reordered_opaque = avctx->reordered_opaque;
> @@ -2063,6 +2065,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  avpkt->size = 0;
>  else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY))
>  avpkt->pts = avpkt->dts = frame->pts;
> +if (frame && av_frame_get_pkt_timebase(frame).num)
> +avpkt->duration =
av_rescale_q(av_frame_get_pkt_duration(frame),
> +
av_frame_get_pkt_timebase(frame),
> +   avctx->time_base);
>
>  if (needs_realloc && avpkt->data) {
>  ret = av_buffer_realloc(&avpkt->buf, avpkt->size +
FF_INPUT_BUFFER_PADDING_SIZE);
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index fdfbc46..be60776 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -29,6 +29,7 @@
>
>  MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
>  MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
> +MAKE_ACCESSORS(AVFrame, frame, AVRational, pkt_timebase)
>  MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
>  MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout)
>  MAKE_ACCESSORS(AVFrame, frame, int, channels)
> @@ -98,6 +99,7 @@ static void get_frame_defaults(AVFrame *frame)
>  frame->pkt_pts   = AV_NOPTS_VALUE;
>  av_frame_set_best_effort_timestamp(frame, AV_NOPTS_VALUE);
>  av_frame_set_pkt_duration (frame, 0);
> +av_frame_set_pkt_timebase (frame, (AVRational){ 0, });
>  av_frame_set_pkt_pos  (frame, -1);
>  av_frame_set_pkt_size (frame, -1);
>  frame->key_frame   = 1;
> @@ -475,6 +477,7 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame
*src)
>  dst->pkt_pos= src->pkt_pos;
>  dst->pkt_size   = src->pkt_size;
>  dst->pkt_duration   = src->pkt_duration;
> +dst->pkt_timebase   = src->pkt_timebase;
>  dst->reordered_opaque   = src->reordered_opaque;
>  dst->quality= src->quality;
>  dst->best_effort_timestamp  = src->best_effort_timestamp;
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index a39c8d0..954b765 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -530,6 +530,15 @@ typedef struct AVFrame {
>   * Not to be accessed directly from outside libavutil
>   */
>  AVBufferRef *qp_table_buf;
> +
> +/**
> + * timebase of the corresponding packet.
> + * Code outside libavcodec should access this field using:
> + * av_frame_get_pkt_timebase(frame)
> + * - encoding: unused
> + * - decoding: Read by user.
> + */
> +AVRational pkt_timebase;
>  } AVFrame;
>
>  /**
> @@ -541,6 +550,8 @@ int64_t av_frame_get_best_effort_timestamp(const
AVFrame *frame);
>  voidav_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
>  int64_t av_frame_get_pkt_duration (const AVFrame *frame);
>  voidav_frame_set_pkt_duration (AVFrame *frame, int64_t val);
> +AVRational av_frame_get_pkt_timebase  (const AVFrame *frame);
> +voidav_frame_set_pkt_timebase (AVFrame *frame, AVRational
val);
>  int64_t av_frame_get_pkt_pos  (const AVFrame *frame);
>  voidav_frame_set_pkt_pos  (AVFrame *frame, int64_t val);
>  int64_t av_frame_get_channel_layout   (const AVFrame *frame);
> --
> 2.0.1.442.g7fe6834
>
> ___
> ffm

[FFmpeg-devel] Filters

2014-07-18 Thread JULIAN GARDNER
How do I fix a filter so that it takes in 1 input but has no output, this is 
part of a project and this part is a detection filter, it does nothing else.

The problem at the moment is that with the current filter, based on drawbox, is 
that it produces an output which i need to the use overlay to dump.

Is there a video filter which has 1 input but 0 outputs

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


Re: [FFmpeg-devel] [PATCH] libavu: add pkt_timebase to AVFrame.

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 12:47:06PM +0200, Hendrik Leppkes wrote:
> Am 18.07.2014 12:04 schrieb "Benoit Fouet" :
> >
> > In order to easily correlate pkt_duration to its real duration, add the
> > packet time base information to the frame structure.
> >
> > Fixes issue #3052
> 
> The code in avcodec doesn't know the timebase, unless the user tells it.

or the user uses libavformat with libavcodec


> 
> And if the user wants to tell it, there already is an avctx field for it
> (pkt_timebase), no need to store it in the frame since its not going to
> change in every frame.
> 
> As such, I'm not sure what this new field would solve.

It would allow interpreting the AVFrame.pkt_duration without the need
to have access to a AVCodecContext.
AVFrames are part of libavutil, AVCodecContext is part of libavcodec


also we have a similar issue with AVPackets which dont store the
timebase used by its time related fields.
Which leads to the issue you describe above
"The code in avcodec doesn't know the timebase, unless the user tells it."
Where a timebase in AVPacket the user wouldnt manually have to deal
with it. libavformats AVPacket would simply contain the timebase
Fixing that with AVPackets is due to API/ABI rather hard though

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

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


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


Re: [FFmpeg-devel] [PATCH 3/4] smacker: remove dead code

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 10:04:05AM +0200, Paul B Mahol wrote:
> On Fri, Jul 18, 2014 at 4:25 AM, Timothy Gu  wrote:
> 
> > Signed-off-by: Timothy Gu 
> > ---
> >  libavcodec/smacker.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
> > index 644beb3..518bdad 100644
> > --- a/libavcodec/smacker.c
> > +++ b/libavcodec/smacker.c
> > @@ -438,7 +438,6 @@ static int decode_frame(AVCodecContext *avctx, void
> > *data, int *got_frame,
> >  bw = avctx->width >> 2;
> >  bh = avctx->height >> 2;
> >  blocks = bw * bh;
> > -out = smk->pic->data[0];
> >  stride = smk->pic->linesize[0];
> >  while(blk < blocks) {
> >  int type, run, mode;
> > @@ -499,7 +498,6 @@ static int decode_frame(AVCodecContext *avctx, void
> > *data, int *got_frame,
> >  out += stride;
> >  out[0] = out[1] = pix & 0xFF;
> >  out[2] = out[3] = pix >> 8;
> > -out += stride;
> 
> 
> 
>  break;
> >  case 2:
> >  for(i = 0; i < 2; i++) {
> > --
> > 1.9.1
> >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 
> lgtm

applied

thanks

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

There will always be a question for which you do not know the correct answer.


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


Re: [FFmpeg-devel] Filters

2014-07-18 Thread Clément Bœsch
On Fri, Jul 18, 2014 at 12:08:41PM +0100, JULIAN GARDNER wrote:
> How do I fix a filter so that it takes in 1 input but has no output, this is 
> part of a project and this part is a detection filter, it does nothing else.
> 
> The problem at the moment is that with the current filter, based on drawbox, 
> is that it produces an output which i need to the use overlay to dump.
> 
> Is there a video filter which has 1 input but 0 outputs

Just make a passthrough filtering (ff_filter_frame(in)), and do not map
its output

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH] ffmpeg_filter: refuse to configure input without a decoder.

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 10:43:22AM +0200, Nicolas George wrote:
> The decoder is necessary in order to filter frames.
> This makes the error message clearer in this case:
> currently, it will usually fail because the pixel or sample
> format is not defined and is converted into "(null)"
> (non-portable).
> 
> Signed-off-by: Nicolas George 
> ---
>  ffmpeg_filter.c | 6 ++
>  1 file changed, 6 insertions(+)

LGTM

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus


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


Re: [FFmpeg-devel] Filters

2014-07-18 Thread JULIAN GARDNER
>
> From: Clément Bœsch 
>To: FFmpeg development discussions and patches  
>Sent: Friday, 18 July 2014, 13:38
>Subject: Re: [FFmpeg-devel] Filters
> 
>
>On Fri, Jul 18, 2014 at 12:08:41PM +0100, JULIAN GARDNER wrote:
>> How do I fix a filter so that it takes in 1 input but has no output, this is 
>> part of a project and this part is a detection filter, it does nothing else.
>> 
>> The problem at the moment is that with the current filter, based on drawbox, 
>> is that it produces an output which i need to the use overlay to dump.
>> 
>> Is there a video filter which has 1 input but 0 outputs
>
>Just make a passthrough filtering (ff_filter_frame(in)), and do not map
>its output
>


Can you elaborate a bit more as I have this code as my base code


static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{
DrawBoxContext *s = inlink->dst->priv;
int plane, x, y, xb = s->x, yb = s->y;
unsigned char *row[4];

    // Detect Stationary Object
    

    // Here I would like to dump the frame as it is no longer needed

return ff_filter_frame(inlink->dst->outputs[0], frame);
}



AVFILTER_DEFINE_CLASS(detection);

static const AVFilterPad detection_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.config_props = config_input,
.filter_frame = filter_frame,    },
{ NULL }
};

static const AVFilterPad detection_outputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
},
{ NULL }
};

AVFilter ff_vf_detection = {
.name = "detection",
.description = NULL_IF_CONFIG_SMALL("detects Stationary Object."),
.priv_size = sizeof(DetectionContext),
.priv_class = &detect_class,
.init = init,
.query_formats = query_formats,
.inputs = detect_inputs,
.outputs = detect_outputs,
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
};
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Filters

2014-07-18 Thread Clément Bœsch
On Fri, Jul 18, 2014 at 12:56:17PM +0100, JULIAN GARDNER wrote:
> >
> > From: Clément Bœsch 
> >To: FFmpeg development discussions and patches  
> >Sent: Friday, 18 July 2014, 13:38
> >Subject: Re: [FFmpeg-devel] Filters
> > 
> >
> >On Fri, Jul 18, 2014 at 12:08:41PM +0100, JULIAN GARDNER wrote:
> >> How do I fix a filter so that it takes in 1 input but has no output, this 
> >> is part of a project and this part is a detection filter, it does nothing 
> >> else.
> >> 
> >> The problem at the moment is that with the current filter, based on 
> >> drawbox, is that it produces an output which i need to the use overlay to 
> >> dump.
> >> 
> >> Is there a video filter which has 1 input but 0 outputs
> >
> >Just make a passthrough filtering (ff_filter_frame(in)), and do not map
> >its output
> >
> 
> 
> Can you elaborate a bit more as I have this code as my base code
> 
> 
> static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
> {
> DrawBoxContext *s = inlink->dst->priv;
> int plane, x, y, xb = s->x, yb = s->y;
> unsigned char *row[4];
> 
>     // Detect Stationary Object
>     
> 
>     // Here I would like to dump the frame as it is no longer needed
> 
> return ff_filter_frame(inlink->dst->outputs[0], frame);
> }
> 

You do exactly that and that's all. Then ffmpeg -i foo -vf bar -f null -

There are a lot of detection only filters. volumedetect, signalstats,
blackdetect, ... just copy their behaviour

[...]

-- 
Clément B.


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


Re: [FFmpeg-devel] Filters

2014-07-18 Thread JULIAN GARDNER




- Original Message -
> From: Clément Bœsch 
> To: FFmpeg development discussions and patches 
> Cc: 
> Sent: Friday, 18 July 2014, 14:01
> Subject: Re: [FFmpeg-devel] Filters
> 
> On Fri, Jul 18, 2014 at 12:56:17PM +0100, JULIAN GARDNER wrote:
>>  >
>>  > From: Clément Bœsch 
>>  >To: FFmpeg development discussions and patches 
>  
>>  >Sent: Friday, 18 July 2014, 13:38
>>  >Subject: Re: [FFmpeg-devel] Filters
>>  > 
>>  >
>>  >On Fri, Jul 18, 2014 at 12:08:41PM +0100, JULIAN GARDNER wrote:
>>  >> How do I fix a filter so that it takes in 1 input but has no 
> output, this is part of a project and this part is a detection filter, it 
> does 
> nothing else.
>>  >> 
>>  >> The problem at the moment is that with the current filter, based 
> on drawbox, is that it produces an output which i need to the use overlay to 
> dump.
>>  >> 
>>  >> Is there a video filter which has 1 input but 0 outputs
>>  >
>>  >Just make a passthrough filtering (ff_filter_frame(in)), and do not map
>>  >its output
>>  >
>> 
>> 
>>  Can you elaborate a bit more as I have this code as my base code
>> 
>> 
>>  static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
>>  {
>>  DrawBoxContext *s = inlink->dst->priv;
>>  int plane, x, y, xb = s->x, yb = s->y;
>>  unsigned char *row[4];
>> 
>>      // Detect Stationary Object
>>      
>> 
>>      // Here I would like to dump the frame as it is no longer needed
>> 
>>  return ff_filter_frame(inlink->dst->outputs[0], frame);
>>  }
>> 
> 
> You do exactly that and that's all. Then ffmpeg -i foo -vf bar -f null -
> 
> There are a lot of detection only filters. volumedetect, signalstats,
> blackdetect, ... just copy their behaviour
> 

Yes but this is my problem, an example command line I need at the moment

fmpeg -i .ts -vcodec libx264 -b:v 1000k -acodec libfaac -async 1 -vf
 'split [mark], detection [dontneed];delay=5, markregion 
[vid];[dontneed][vid] overlay' -y -f mpegts processed.ts

What I would like

fmpeg -i .ts -vcodec libx264 -b:v 1000k -acodec libfaac -async 1 -vf
 'split [mark], detection; delay=5, markregion' -y -f mpegts processed.ts

I am working on the delay filter at the moment, as i need 5 frames to detect 
the block, but i need to mark all frames, including the 4 previous frames. I am 
trying to get rid of the overlay as the input source could be HD.

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


Re: [FFmpeg-devel] [PATCH] lavfi/drawtext: add alias "expr_int_format" to expansion function "eif"

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 07:53:48AM +0200, Stefano Sabatini wrote:
> On date Friday 2014-07-18 01:00:40 +0300, Andrey Utkin encoded:
> > ---
> >  doc/filters.texi  | 2 +-
> >  libavfilter/vf_drawtext.c | 3 ++-
> >  2 files changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index 8cde277..a7919a3 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -3916,7 +3916,7 @@ example the text size is not known when evaluating 
> > the expression, so
> >  the constants @var{text_w} and @var{text_h} will have an undefined
> >  value.
> >  
> > -@item eif
> > +@item expr_int_format, eif
> >  Evaluate the expression's value and output as formatted integer.
> >  
> >  First argument is expression to be evaluated, same as for @var{expr} 
> > function.
> > diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
> > index c744d93..b7a295f 100644
> > --- a/libavfilter/vf_drawtext.c
> > +++ b/libavfilter/vf_drawtext.c
> > @@ -949,7 +949,7 @@ static int func_eval_expr_int_format(AVFilterContext 
> > *ctx, AVBPrint *bp,
> >  if (argc == 3) {
> >  ret = sscanf(argv[2], "%u", &positions);
> >  if (ret != 1) {
> > -av_log(ctx, AV_LOG_ERROR, "eif(): Invalid number of positions"
> > +av_log(ctx, AV_LOG_ERROR, "expr_int_format(): Invalid number 
> > of positions"
> >  " to print: '%s'\n", argv[2]);
> >  return AVERROR(EINVAL);
> >  }
> > @@ -982,6 +982,7 @@ static const struct drawtext_function {
> >  } functions[] = {
> >  { "expr",  1, 1, 0,   func_eval_expr },
> >  { "e", 1, 1, 0,   func_eval_expr },
> > +{ "expr_int_format", 2, 3, 0, func_eval_expr_int_format },
> >  { "eif",   2, 3, 0,   func_eval_expr_int_format },
> >  { "pict_type", 0, 0, 0,   func_pict_type },
> >  { "pts",   0, 2, 0,   func_pts  },
> 
> LGTM.

applied

thanks

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

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


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


Re: [FFmpeg-devel] avformat/hlsenc: pull request for single file mode

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 10:40:03AM +0200, Nicolas Martyanoff wrote:
> The FFmpeg developer info page said it was fine to use github instead of
> mailing patches, but if you prefer, I can mail them.

pull requests are more intended for code after it has been reviewed
by someone who knows the code well enough to be able to review it.

In practice steps can be merged, so for example, if the person
who will merge a pull request is also the maintainer then he might
review it and merge instead of asking the ML to be used for review.
Or for example if the pull request is submitted by someone who knows
the code well, id assume he reviewed the submitted pull request
already himself.

But in the end, these are details, what is important is that code
gets submitted one way or another, reviewed one way or another and
pushed to git.

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


Re: [FFmpeg-devel] Filters

2014-07-18 Thread Clément Bœsch
On Fri, Jul 18, 2014 at 01:14:25PM +0100, JULIAN GARDNER wrote:
[...]
> > You do exactly that and that's all. Then ffmpeg -i foo -vf bar -f null -
> > 
> > There are a lot of detection only filters. volumedetect, signalstats,
> > blackdetect, ... just copy their behaviour
> > 
> 
> Yes but this is my problem, an example command line I need at the moment
> 
> fmpeg -i .ts -vcodec libx264 -b:v 1000k -acodec libfaac -async 1 -vf
>  'split [mark], detection [dontneed];delay=5, markregion 
> [vid];[dontneed][vid] overlay' -y -f mpegts processed.ts
> 
> What I would like
> 
> fmpeg -i .ts -vcodec libx264 -b:v 1000k -acodec libfaac -async 1 -vf
>  'split [mark], detection; delay=5, markregion' -y -f mpegts processed.ts
> 

Use -filter_complex and map only the output of markregion. Or maybe
just explicit [out0] after markregion with your -vf version, that might
work, I don't remember the details, but since I'm missing detection, delay
and markregion filter I have no idea how to test.

[...]

-- 
Clément B.


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


Re: [FFmpeg-devel] [PATCH] Introduce avio_dump_contents() and use it in lavd/lavfi.c

2014-07-18 Thread Michael Niedermayer
On Thu, Jul 17, 2014 at 11:37:03PM +0300, Andrey Utkin wrote:
> This is a replacement for previously proposed API
> av_bprint_fd_contents().
> Side-effect: lavfi input device now accepts any URL as "graph_file"
> option value.
> ---
>  libavdevice/lavfi.c   | 30 +++---
>  libavformat/avio.h|  8 
>  libavformat/aviobuf.c | 16 
>  3 files changed, 39 insertions(+), 15 deletions(-)

needs minor bump for avformat and APIChanges update
also should be split in 2 patches, one for adding the API and one
for extending what graph_file can be used with


[...]
> @@ -500,4 +501,11 @@ int avio_pause(AVIOContext *h, int pause);
>  int64_t avio_seek_time(AVIOContext *h, int stream_index,
> int64_t timestamp, int flags);
>  
> +/**
> + * Read contents of h into print buffer up to EOF.
> + *
> + * @return 0 for success, error code otherwise
> + */
> +int avio_dump_contents(AVIOContext *h, AVBPrint *pb);

not sure this is a good name, i think bprint should be in there
somewhere, maybe nicolas has an idea/suggestion

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

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway


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


Re: [FFmpeg-devel] [PATCH 1/7] avformat/hlsenc: correctly compute target duration

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 10:57:41AM +0200, Nicolas Martyanoff wrote:
> With HLS, the duration of all segments must be lower or equal to the target
> duration. Therefore floor(duration + 0.5) yields incorrect results.
> 
> For example, for duration = 1.35, floor(duration + 0.5) yields 1.0, but the
> correct result is 2.0.
> ---
>  libavformat/hlsenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

this has already been applied by Anssi


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.


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


Re: [FFmpeg-devel] [PATCH] lavf/segment: do not allow to create segments with no key-frames

2014-07-18 Thread Michael Niedermayer
On Thu, Jul 17, 2014 at 08:39:16PM +0200, Stefano Sabatini wrote:
> Fix trac ticket #3749.
> ---
>  libavformat/segment.c | 16 +---
>  1 file changed, 9 insertions(+), 7 deletions(-)

probably ok

[...]
-- 
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: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] oss_audio: check all ioctl() return codes

2014-07-18 Thread Michael Niedermayer
On Thu, Jul 17, 2014 at 05:59:43PM -0700, Timothy Gu wrote:
> Also uses a macro to simplify.
> 
> Signed-off-by: Timothy Gu 
> ---
> 
> Found with clang's static analyzer.
> 
> ---
>  libavdevice/oss_audio.c | 23 +++
>  1 file changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
> index 734e565..3c5065c 100644
> --- a/libavdevice/oss_audio.c
> +++ b/libavdevice/oss_audio.c
> @@ -87,8 +87,15 @@ static int audio_open(AVFormatContext *s1, int is_output, 
> const char *audio_devi
>  
>  s->frame_size = AUDIO_BLOCK_SIZE;
>  
> +#define CHECK_IOCTL_ERROR(event) 
>  \
> +if (err < 0) {   
>  \
> +av_log(s1, AV_LOG_ERROR, #event ": %s\n", strerror(errno)); \
> +goto fail;   
>  \
> +}
> +

>  /* select format : favour native format */
>  err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp);
> +CHECK_IOCTL_ERROR(SNDCTL_DSP_GETFMTS)
>  
>  #if HAVE_BIGENDIAN

i think failure of SNDCTL_DSP_GETFMTS, does not need to lead to
failure of audio_open()
simply trying SNDCTL_DSP_SETFMT with some format in case of
SNDCTL_DSP_GETFMTS fails is better

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

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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


[FFmpeg-devel] [PATCH] [RFC] hevc: report more precise progress

2014-07-18 Thread Christophe Gisquet
Hi,

HEAD currently does note pass "make fate-hevc THREADS=6" because of a
missing output frame in POC_A. Except for this sequence, the patch
passes for THREADS={2,3,4,6,7} on a 6-cores system.

This is more of an RFC because the value used in reporting surprises
me and my understanding leads to the attached patch.

Another point irrelevant to this patch is the "+9" in
hevc_await_progress. While qpel may access 4 lines more (warranting a
+4 or +5), I don't understand the rationale for +9.

-- 
Christophe
From 02ea44ba0918ffc08045374355057e69767f9973 Mon Sep 17 00:00:00 2001
From: Christophe Gisquet 
Date: Fri, 18 Jul 2014 16:44:43 +0200
Subject: [PATCH] hevc: report more precise progress

After a CTB has been filtered, only the bottom and rightmost parts may still
be modified by filtering of other CTBs later on, for up to 4 pixels.

Therefore, report progress up to those 4 bottom pixels. Up to 20% speedup for
a lowdelay-P sequence using 6 cores.
---
 libavcodec/hevc_filter.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c
index 0d3e238..a724e78 100644
--- a/libavcodec/hevc_filter.c
+++ b/libavcodec/hevc_filter.c
@@ -687,17 +687,17 @@ void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size)
 if (y && x_end) {
 sao_filter_CTB(s, x, y - ctb_size);
 if (s->threads_type & FF_THREAD_FRAME )
-ff_thread_report_progress(&s->ref->tf, y - ctb_size, 0);
+ff_thread_report_progress(&s->ref->tf, y - 4, 0);
 }
 if (x_end && y_end) {
 sao_filter_CTB(s, x , y);
 if (s->threads_type & FF_THREAD_FRAME )
-ff_thread_report_progress(&s->ref->tf, y, 0);
+ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0);
 }
 } else {
 if (y && x >= s->sps->width - ctb_size)
 if (s->threads_type & FF_THREAD_FRAME )
-ff_thread_report_progress(&s->ref->tf, y, 0);
+ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0);
 }
 }
 
-- 
1.9.2.msysgit.0

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


[FFmpeg-devel] [PATCH] fate: Add test for wav Peak Envelope Chunk encoder (levl, chunk).

2014-07-18 Thread Peter B.
Hello.

Georg Lippitsch and I created 2 FATE tests for the EBU Peak Envelope Chunk:
Test 1: Normal WAV file with levl-chunk and audio data.
Test 2: "Peakfile" WAV with levl-chunk, without audio data.

I tried to follow the style of existing lavf-regression tests in FATE as
good as possible.

Regards,
Pb
>From bec0905cc5b896a287d8e0953c9931e41a62972d Mon Sep 17 00:00:00 2001
From: Peter B 
Date: Thu, 17 Jul 2014 18:51:38 +0200
Subject: [PATCH] fate: Add test for wav Peak Envelope Chunk encoder (levl
 chunk).

---
 tests/fate/avformat.mak  |2 ++
 tests/lavf-regression.sh |9 +
 tests/ref/lavf/wav_peak  |3 +++
 tests/ref/lavf/wav_peak_only |2 ++
 4 files changed, 16 insertions(+)
 create mode 100644 tests/ref/lavf/wav_peak
 create mode 100644 tests/ref/lavf/wav_peak_only

diff --git a/tests/fate/avformat.mak b/tests/fate/avformat.mak
index 5f9c8c1..1040afa 100644
--- a/tests/fate/avformat.mak
+++ b/tests/fate/avformat.mak
@@ -45,6 +45,8 @@ FATE_LAVF-$(call ENCDEC2, MPEG2VIDEO, MP2,   MPEGTS) += ts
 FATE_LAVF-$(call ENCDEC,  PCM_U8,VOC)+= voc
 FATE_LAVF-$(call ENCDEC,  PCM_S16LE, VOC)+= voc_s16
 FATE_LAVF-$(call ENCDEC,  PCM_S16LE, WAV)+= wav
+FATE_LAVF-$(call ENCDEC,  PCM_S16LE, WAV)+= wav_peak
+FATE_LAVF-$(call ENCDEC,  PCM_S16LE, WAV)+= wav_peak_only
 FATE_LAVF-$(call ENCMUX,  PCM_S16LE, W64)+= w64
 FATE_LAVF-$(call ENCDEC,  MP2,   WTV)+= wtv
 FATE_LAVF-$(call ENCDEC,  XBM,   IMAGE2) += xbm
diff --git a/tests/lavf-regression.sh b/tests/lavf-regression.sh
index 0efbc9c..7e6ad06 100755
--- a/tests/lavf-regression.sh
+++ b/tests/lavf-regression.sh
@@ -274,6 +274,15 @@ if [ -n "$do_wav" ] ; then
 do_audio_only wav
 fi
 
+if [ -n "$do_wav_peak" ] ; then
+do_audio_only peak.wav "" "-write_peak on"
+fi
+
+if [ -n "$do_wav_peak_only" ] ; then
+file=${outfile}lavf.peak_only.wav
+do_avconv $file $DEC_OPTS -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -t 1 -qscale 10 -write_peak only
+fi
+
 if [ -n "$do_alaw" ] ; then
 do_audio_only al "" "" "-ar 44100"
 fi
diff --git a/tests/ref/lavf/wav_peak b/tests/ref/lavf/wav_peak
new file mode 100644
index 000..aa7e5fc
--- /dev/null
+++ b/tests/ref/lavf/wav_peak
@@ -0,0 +1,3 @@
+35148d1f6e66b0080893851d917ecbf4 *./tests/data/lavf/lavf.peak.wav
+89094 ./tests/data/lavf/lavf.peak.wav
+./tests/data/lavf/lavf.peak.wav CRC=0x3a1da17e
diff --git a/tests/ref/lavf/wav_peak_only b/tests/ref/lavf/wav_peak_only
new file mode 100644
index 000..dccd0e7
--- /dev/null
+++ b/tests/ref/lavf/wav_peak_only
@@ -0,0 +1,2 @@
+b609a363e6d490710ed52231a8d09d3c *./tests/data/lavf/lavf.peak_only.wav
+832 ./tests/data/lavf/lavf.peak_only.wav
-- 
1.7.9.5

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


[FFmpeg-devel] [PATCH]Parse dri in rtp jpeg

2014-07-18 Thread Carl Eugen Hoyos
Hi!

Attached completely untested patch is based on the file attached to ticket 
#3780.

Please review, Carl Eugen
diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c
index 80fe295..ccd80ad 100644
--- a/libavformat/rtpdec_jpeg.c
+++ b/libavformat/rtpdec_jpeg.c
@@ -106,7 +106,8 @@ static void jpeg_put_marker(PutByteContext *pbc, int code)
 }
 
 static int jpeg_create_header(uint8_t *buf, int size, uint32_t type, uint32_t 
w,
-  uint32_t h, const uint8_t *qtable, int nb_qtable)
+  uint32_t h, const uint8_t *qtable, int nb_qtable,
+  int dri)
 {
 PutByteContext pbc;
 uint8_t *dht_size_ptr;
@@ -132,6 +133,12 @@ static int jpeg_create_header(uint8_t *buf, int size, 
uint32_t type, uint32_t w,
 bytestream2_put_byte(&pbc, 0);
 bytestream2_put_byte(&pbc, 0);
 
+if (dri) {
+jpeg_put_marker(&pbc, DRI);
+bytestream2_put_be16(&pbc, 4);
+bytestream2_put_be16(&pbc, dri);
+}
+
 /* DQT */
 jpeg_put_marker(&pbc, DQT);
 bytestream2_put_be16(&pbc, 2 + nb_qtable * (1 + 64));
@@ -226,7 +233,7 @@ static int jpeg_parse_packet(AVFormatContext *ctx, 
PayloadContext *jpeg,
 const uint8_t *qtables = NULL;
 uint16_t qtable_len;
 uint32_t off;
-int ret;
+int ret, dri = 0;
 
 if (len < 8) {
 av_log(ctx, AV_LOG_ERROR, "Too short RTP/JPEG packet.\n");
@@ -242,6 +249,16 @@ static int jpeg_parse_packet(AVFormatContext *ctx, 
PayloadContext *jpeg,
 buf += 8;
 len -= 8;
 
+if (type & 0x40) {
+if (len < 4) {
+av_log(ctx, AV_LOG_ERROR, "Too short RTP/JPEG packet.\n");
+return AVERROR_INVALIDDATA;
+}
+dri = AV_RB16(buf);
+buf += 4;
+len -= 4;
+type &= ~0x40;
+}
 /* Parse the restart marker header. */
 if (type > 63) {
 av_log(ctx, AV_LOG_ERROR,
@@ -332,7 +349,7 @@ static int jpeg_parse_packet(AVFormatContext *ctx, 
PayloadContext *jpeg,
  * interchange format. */
 jpeg->hdr_size = jpeg_create_header(hdr, sizeof(hdr), type, width,
 height, qtables,
-qtable_len / 64);
+qtable_len / 64, dri);
 
 /* Copy JPEG header to frame buffer. */
 avio_write(jpeg->frame, hdr, jpeg->hdr_size);
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Introduce avio_dump_contents() and use it in lavd/lavfi.c

2014-07-18 Thread Andrey Utkin
Thanks for comments, going to resubmit on Monday.

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


Re: [FFmpeg-devel] [PATCH] fate: Add test for wav Peak Envelope Chunk encoder (levl, chunk).

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 06:10:42PM +0200, Peter B. wrote:
> Hello.
> 
> Georg Lippitsch and I created 2 FATE tests for the EBU Peak Envelope Chunk:
> Test 1: Normal WAV file with levl-chunk and audio data.
> Test 2: "Peakfile" WAV with levl-chunk, without audio data.
> 
> I tried to follow the style of existing lavf-regression tests in FATE as
> good as possible.
> 
> Regards,
> Pb

>  fate/avformat.mak  |2 ++
>  lavf-regression.sh |9 +
>  ref/lavf/wav_peak  |3 +++
>  ref/lavf/wav_peak_only |2 ++
>  4 files changed, 16 insertions(+)
> b9bef0d2e8f7992dcf0814b351571cd750dbee75  
> ffmpeg-fate-Add-test-for-wav-Peak-Envelope-Chunk-encoder-le.patch
> From bec0905cc5b896a287d8e0953c9931e41a62972d Mon Sep 17 00:00:00 2001
> From: Peter B 
> Date: Thu, 17 Jul 2014 18:51:38 +0200
> Subject: [PATCH] fate: Add test for wav Peak Envelope Chunk encoder (levl
>  chunk).
> 
> ---
>  tests/fate/avformat.mak  |2 ++
>  tests/lavf-regression.sh |9 +
>  tests/ref/lavf/wav_peak  |3 +++
>  tests/ref/lavf/wav_peak_only |2 ++
>  4 files changed, 16 insertions(+)
>  create mode 100644 tests/ref/lavf/wav_peak
>  create mode 100644 tests/ref/lavf/wav_peak_only

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH]Parse dri in rtp jpeg

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 06:46:07PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached completely untested patch is based on the file attached to ticket 
> #3780.
> 
> Please review, Carl Eugen

i suspect this is correct, but have no idea on how to test
if no way to test is found, then iam in favor for applying

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

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


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


[FFmpeg-devel] dmMediaConverter

2014-07-18 Thread Dalacu Marius
Hi, i am the developer of dmMediaConverter, a simple FFmpeg frontend.
I am writing here in hope that my program will appear on FFmpeg-Based Projects 
(https://www.ffmpeg.org/projects.html).
In case you like the app and i am not infringe any rules, thank you,
Best regards,
Marius Dalacu. 
 
http://dmsimpleapps.blogspot.ro/2014/04/dmmediaconverter.html
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] [RFC] hevc: report more precise progress

2014-07-18 Thread Christophe Gisquet
014-07-18 17:41 GMT+02:00 Christophe Gisquet :
> This is more of an RFC

Only a part can apply, Michaël should have a patch with the correct part.

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


Re: [FFmpeg-devel] Filters

2014-07-18 Thread JULIAN GARDNER







>
> From: Clément Bœsch 
>To: FFmpeg development discussions and patches  
>Sent: Friday, 18 July 2014, 14:55
>Subject: Re: [FFmpeg-devel] Filters
> 
>
>On Fri, Jul 18, 2014 at 01:14:25PM +0100, JULIAN GARDNER wrote:
>[...]
>> > You do exactly that and that's all. Then ffmpeg -i foo -vf bar -f null -
>> > 
>> > There are a lot of detection only filters. volumedetect, signalstats,
>> > blackdetect, ... just copy their behaviour
>> > 
>> 
>> Yes but this is my problem, an example command line I need at the moment
>> 
>> fmpeg -i .ts -vcodec libx264 -b:v 1000k -acodec libfaac -async 1 -vf
>>  'split [mark], detection [dontneed];delay=5, markregion 
>> [vid];[dontneed][vid] overlay' -y -f mpegts processed.ts
>> 
>> What I would like
>> 
>> fmpeg -i .ts -vcodec libx264 -b:v 1000k -acodec libfaac -async 1 -vf
>>  'split [mark], detection; delay=5, markregion' -y -f mpegts processed.ts
>> 
>
>Use -filter_complex and map only the output of markregion. Or maybe
>just explicit [out0] after markregion with your -vf version, that might
>work, I don't remember the details, but since I'm missing detection, delay
>and markregion filter I have no idea how to test.
>
>[...]
>
>-- 
>Clément B.
>
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


fmpeg -i .ts -vcodec libx264 -b:v 1000k -acodec libfaac -async 1 -vf 'split 
[mark], drawbox=10:10:100:100:color=green [dontneed];[mark] 
drawbox=100:100:100;100:color=red [vid];[dontneed][vid] overlay' -y -f mpegts 
processed.ts

If you can get rid of the overlay and end up with a video with a RED box on 
screen you have cracked it, should end up with this and your changes

fmpeg -i .ts -vcodec libx264 -b:v 1000k -acodec libfaac -async 1 -vf
 'split [mark], drawbox=10:10:100:100:color=green;[mark] 
drawbox=100:100:100;100:color=red' -y -f 
mpegts processed.ts

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


Re: [FFmpeg-devel] [PATCH] fate: Add test for wav Peak Envelope Chunk encoder (levl, chunk).

2014-07-18 Thread Peter B.
On 07/18/2014 07:40 PM, Michael Niedermayer wrote:
> applied

Thanks!

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


[FFmpeg-devel] [PATCH] oss_audio: use a macro to simplify ioctl() error checking

2014-07-18 Thread Timothy Gu
Also add a note about SNDCTL_DSP_GETFMTS which may fail even if OSS is
available.

Signed-off-by: Timothy Gu 
---
 libavdevice/oss_audio.c | 27 ++-
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
index 9a3cdcf..fa338d6 100644
--- a/libavdevice/oss_audio.c
+++ b/libavdevice/oss_audio.c
@@ -87,7 +87,16 @@ static int audio_open(AVFormatContext *s1, int is_output, 
const char *audio_devi
 
 s->frame_size = AUDIO_BLOCK_SIZE;
 
-/* select format : favour native format */
+#define CHECK_IOCTL_ERROR(event)  \
+if (err < 0) {\
+av_log(s1, AV_LOG_ERROR, #event ": %s\n", strerror(errno)); \
+goto fail;\
+}
+
+/* select format : favour native format
+ * We don't CHECK_IOCTL_ERROR here because even if failed OSS still may be
+ * usable. If OSS is not usable the SNDCTL_DSP_SETFMTS later is going to
+ * fail anyway. `err =` kept to eliminate compiler warning. */
 err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp);
 
 #if HAVE_BIGENDIAN
@@ -121,24 +130,15 @@ static int audio_open(AVFormatContext *s1, int is_output, 
const char *audio_devi
 return AVERROR(EIO);
 }
 err=ioctl(audio_fd, SNDCTL_DSP_SETFMT, &tmp);
-if (err < 0) {
-av_log(s1, AV_LOG_ERROR, "SNDCTL_DSP_SETFMT: %s\n", strerror(errno));
-goto fail;
-}
+CHECK_IOCTL_ERROR(SNDCTL_DSP_SETFMTS)
 
 tmp = (s->channels == 2);
 err = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp);
-if (err < 0) {
-av_log(s1, AV_LOG_ERROR, "SNDCTL_DSP_STEREO: %s\n", strerror(errno));
-goto fail;
-}
+CHECK_IOCTL_ERROR(SNDCTL_DSP_STEREO)
 
 tmp = s->sample_rate;
 err = ioctl(audio_fd, SNDCTL_DSP_SPEED, &tmp);
-if (err < 0) {
-av_log(s1, AV_LOG_ERROR, "SNDCTL_DSP_SPEED: %s\n", strerror(errno));
-goto fail;
-}
+CHECK_IOCTL_ERROR(SNDCTL_DSP_SPEED)
 s->sample_rate = tmp; /* store real sample rate */
 s->fd = audio_fd;
 
@@ -146,6 +146,7 @@ static int audio_open(AVFormatContext *s1, int is_output, 
const char *audio_devi
  fail:
 close(audio_fd);
 return AVERROR(EIO);
+#undef CHECK_IOCTL_ERROR
 }
 
 static int audio_close(AudioData *s)
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH] oss_audio: use a macro to simplify ioctl() error checking

2014-07-18 Thread Michael Niedermayer
On Fri, Jul 18, 2014 at 02:56:16PM -0700, Timothy Gu wrote:
> Also add a note about SNDCTL_DSP_GETFMTS which may fail even if OSS is
> available.
> 
> Signed-off-by: Timothy Gu 
> ---
>  libavdevice/oss_audio.c | 27 ++-
>  1 file changed, 14 insertions(+), 13 deletions(-)

applied

thanks

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

No great genius has ever existed without some touch of madness. -- Aristotle


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