Re: [FFmpeg-devel] [PATCH] avformat/flvenc: add flv live stream flag

2016-09-29 Thread Steven Liu
2016-09-30 0:53 GMT+08:00 Michael Niedermayer :

> On Thu, Sep 29, 2016 at 09:25:35PM +0800, Steven Liu wrote:
> > patch update
> >
> > merge 1/2 and 2/2 into one patch
>
> >  doc/muxers.texi  |5 +
> >  libavformat/flvenc.c |   50 +-
> 
> >  2 files changed, 34 insertions(+), 21 deletions(-)
> > f2c4c83d362faf1819b3aa72fc5608603f824dc1  0001-avformat-flvenc-add-flv-
> live-stream-flag.patch
> > From 7f5ff0d89c19e1683f91befb77ba4a7bf7b66252 Mon Sep 17 00:00:00 2001
> > From: Steven Liu 
> > Date: Thu, 29 Sep 2016 21:20:34 +0800
> > Subject: [PATCH] avformat/flvenc: add flv live stream flag
> >
> > If the flv format is used for live stream on publish
> > ffmpeg should not update dutration and filesize at the end.
> > because the live stream is sent metadata at first step.
> >
> > Reviewed-by: Carl Eugen Hoyos 
> > Signed-off-by: Steven Liu 
> > ---
> >  doc/muxers.texi  |  5 +
> >  libavformat/flvenc.c | 50 +-
> 
> >  2 files changed, 34 insertions(+), 21 deletions(-)
> >
> > diff --git a/doc/muxers.texi b/doc/muxers.texi
> > index 27d1038..aa20656 100644
> > --- a/doc/muxers.texi
> > +++ b/doc/muxers.texi
> > @@ -148,6 +148,11 @@ Place AAC sequence header based on audio stream
> data.
> >  @item no_sequence_end
> >  Disable sequence end tag.
> >  @end table
> > +
> > +@item live_stream
> > +Disable the duration and filesize update in the flv metadata.
> > +@end table
> > +
> >  @end table
> >
> >  @anchor{framecrc}
> > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> > index 99903f5..cd9ca84 100644
> > --- a/libavformat/flvenc.c
> > +++ b/libavformat/flvenc.c
> > @@ -64,6 +64,7 @@ static const AVCodecTag flv_audio_codec_ids[] = {
> >  typedef enum {
> >  FLV_AAC_SEQ_HEADER_DETECT = (1 << 0),
> >  FLV_NO_SEQUENCE_END = (1 << 1),
> > +FLV_LIVE_STREAM = (1 << 2),
> >  } FLVFlags;
> >
> >  typedef struct FLVContext {
> > @@ -234,17 +235,18 @@ static void write_metadata(AVFormatContext *s,
> unsigned int ts)
> >  metadata_count_pos = avio_tell(pb);
> >  metadata_count = 4 * !!flv->video_par +
> >   5 * !!flv->audio_par +
> > - 1 * !!flv->data_par  +
> > - 2; // +2 for duration and file size
> > + 1 * !!flv->data_par;
> >
> >  avio_wb32(pb, metadata_count);
> >
> > -put_amf_string(pb, "duration");
> > -flv->duration_offset = avio_tell(pb);
> > -
> > -// fill in the guessed duration, it'll be corrected later if
> incorrect
> > -put_amf_double(pb, s->duration / AV_TIME_BASE);
> > +if (!(flv->flags & FLV_LIVE_STREAM)) {
> > +put_amf_string(pb, "duration");
> > +flv->duration_offset = avio_tell(pb);
> >
> > +// fill in the guessed duration, it'll be corrected later if
> incorrect
> > +put_amf_double(pb, s->duration / AV_TIME_BASE);
> > +metadata_count++;
> > +}
> >  if (flv->video_par) {
> >  put_amf_string(pb, "width");
> >  put_amf_double(pb, flv->video_par->width);
> > @@ -319,10 +321,12 @@ static void write_metadata(AVFormatContext *s,
> unsigned int ts)
> >  metadata_count++;
> >  }
> >
> > -put_amf_string(pb, "filesize");
> > -flv->filesize_offset = avio_tell(pb);
> > -put_amf_double(pb, 0); // delayed write
> > -
> > +if (!(flv->flags & FLV_LIVE_STREAM)) {
> > +put_amf_string(pb, "filesize");
> > +flv->filesize_offset = avio_tell(pb);
> > +put_amf_double(pb, 0); // delayed write
> > +metadata_count++
> > +}
> >  put_amf_string(pb, "");
> >  avio_w8(pb, AMF_END_OF_OBJECT);
> >
> > @@ -543,16 +547,19 @@ static int flv_write_trailer(AVFormatContext *s)
> >
> >  file_size = avio_tell(pb);
> >
> > -/* update information */
> > -if (avio_seek(pb, flv->duration_offset, SEEK_SET) < 0)
> > -av_log(s, AV_LOG_WARNING, "Failed to update header with correct
> duration.\n");
> > -else
> > -put_amf_double(pb, flv->duration / (double)1000);
> > -if (avio_seek(pb, flv->filesize_offset, SEEK_SET) < 0)
> > -av_log(s, AV_LOG_WARNING, "Failed to update header with correct
> filesize.\n");
> > -else
> > -put_amf_double(pb, file_size);
> > -
> > +if (!(flv->flags & FLV_LIVE_STREAM)) {
> > +/* update information */
> > +if (avio_seek(pb, flv->duration_offset, SEEK_SET) < 0) {
> > +av_log(s, AV_LOG_WARNING, "Failed to update header with
> correct duration.\n");
> > +} else {
> > +put_amf_double(pb, flv->duration / (double)1000);
> > +}
> > +if (avio_seek(pb, flv->filesize_offset, SEEK_SET) < 0) {
> > +av_log(s, AV_LOG_WARNING, "Failed to update header with
> correct filesize.\n");
> > +} else {
> > +

Re: [FFmpeg-devel] [PATCH] lavc: remove libfaac wrapper

2016-09-29 Thread Michael Niedermayer
On Thu, Sep 29, 2016 at 08:12:14PM -0300, James Almer wrote:
> On 9/29/2016 7:21 PM, Michael Niedermayer wrote:
> > On Thu, Sep 29, 2016 at 09:54:42PM +0100, Josh de Kock wrote:

[...]

> 
> > if libfaac support is droped, muxers wont be tested against it anymore
> > most likely. It could be done with command line faac and remuxing but
> > that special case makes it so unwieldy that i doubt anyone will do it
> > 
> > also quite some testcases in trac tickets used libfaac as it was
> > default at the time,
> > regression testing future changes against these tickets may be
> > unreliable without libfaac
> 
> Bugs in libfaac or the lavc wrapper wouldn't happen anymore because the
> wrapper just wont exist anymore. And if some issue can't be reproduced
> with aacenc or libfdk-aac, then it wouldn't be an issue to begin with.

I never talked about bugs in libfaac or bugs in the libfaac wraper,
in fact i dont remember any bugs there. What i meant are
bugs that use testcases which as part of the testcase used libfaac
(libfaac being one of the few options that were available in the past
 for aac encoding results in it having beenfrequently used)

Many bugs are sensitve to changes, for example a bug in a muxer
is not unlikely to depend on some of the packet sizes, durations,
timestamps, exact initial padding value, ...
the closer one can match all that the more likely testing a testcase
in a old ticket with a modern ffmpeg actually does a useful test.

droping the encoder that was used in such old tickets makes testing
the old testcases less meaningfull.

Its as if your muxer shows a issue with mpeg1 video and mp3 and you
drop these encoders. the muxer might still show the issue with h264
and flac but then it quite possibly wont or it possibly wont with the
sample and command line referenced in the ticket

or if you want to you could also say that fewer encoders being
available limits the broadness/coverage of tests of the muxers and core
and each encoder (not specific to aac encoders) does likely have its
peculiarities.

or you could see it as in I and carl test old tickets for regression
these old tickets used libfaac. libfaacs removial will make such
regression tests less meaningfull as the bugs are less likely to
reproduce with a different encoder.

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


Re: [FFmpeg-devel] [RFC]Changelog: Compress slightly

2016-09-29 Thread James Almer
On 9/29/2016 7:08 PM, Carl Eugen Hoyos wrote:
> Hi!
> 
> I consider the Changelog more readable with attached patch.
> 
> I wonder if the ogv line should be dropped...

No, the alias muxer reports a different mimetype than when .ogv is mapped to
the Ogg Muxer and has different defaults (VP8 when libtheora isn't installed).
It's worth mentioning.

> 
> Please comment, Carl Eugen
> 
> 
> 0001-Changelog-Compress-slightly-to-improve-readability.patch
> 
> 
> From 01b62bd9f7da4c991144dfa4039f168d20612f06 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Fri, 30 Sep 2016 00:06:12 +0200
> Subject: [PATCH] Changelog: Compress slightly to improve readability.
> 
> ---
>  Changelog |   12 
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/Changelog b/Changelog
> index d7f5dc9..ce186fc 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -8,10 +8,9 @@ version :
>  - Alias muxer for Ogg Video (.ogv)
>  - VP8 in Ogg muxing
>  - curves filter doesn't automatically insert points at x=0 and x=1 anymore
> -- 16-bit support in curves filter
> -- 16-bit support in selectivecolor filter
> +- 16-bit support in curves filter and selectivecolor filter
>  - OpenH264 decoder wrapper
> -- MediaCodec hwaccel
> +- MediaCodec H.264 and HEVC hwaccel
>  - True Audio (TTA) muxer
>  - crystalizer audio filter
>  - acrusher audio filter
> @@ -28,12 +27,9 @@ version :
>  - gblur filter
>  - avgblur filter
>  - sobel and prewitt filter
> -- MediaCodec HEVC decoding

This release added MediaCodec h264 and hevc hwaccels as mentioned above, but
also a hevc decoder, so removing this line is wrong.

> -- TrueHD encoder
> -- Meridian Lossless Packing (MLP) encoder
> +- Meridian Lossless Packing (MLP) / TrueHD encoder
>  - Non-Local Means (nlmeans) denoising filter
> -- sdl2 output device
> -- sdl2 support for ffplay
> +- sdl2 output device and ffplay support
>  - sdl1 output device and sdl1 support removed
>  - extended mov edit list support
>  

LGTM otherwise.

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


Re: [FFmpeg-devel] [PATCH] lavc: remove libfaac wrapper

2016-09-29 Thread James Almer
On 9/29/2016 7:21 PM, Michael Niedermayer wrote:
> On Thu, Sep 29, 2016 at 09:54:42PM +0100, Josh de Kock wrote:
>> There is really no need for two aac wrappers, we already have
>> libfdk-aac which is better. Not to mention that faac doesn't
>> even support HEv1, or HEv2. It's also under a license which is
>> unusable for distribution, so it would only be useful to people
>> who will compile their own ffmpeg, only use it themselves (which
>> at that point should just use fdk-aac).
>>
>> Signed-off-by: Josh de Kock 
>> ---
>>  Changelog  |   1 +
>>  LICENSE.md |   2 -
>>  configure  |   6 --
>>  doc/encoders.texi  | 105 -
>>  doc/ffserver.conf  |   2 +-
>>  doc/general.texi   |   2 +-
>>  doc/muxers.texi|   4 +-
>>  doc/platform.texi  |   2 +-
>>  libavcodec/Makefile|   1 -
>>  libavcodec/allcodecs.c |   1 -
>>  libavcodec/libfaac.c   | 248 
>> -
>>  11 files changed, 6 insertions(+), 368 deletions(-)
>>  delete mode 100644 libavcodec/libfaac.c
> 
> dont remember if it was specific to libfaac but some issues in the
> mov edit list patches about initial padding and trailing padding
> where found using libfaac as encoder.

Both libfdk-aac and the internal encoder also seems to set inital_padding,
so this is not really a reason to keep an inferior encoder around.
Nothing really set trailing_padding right now, at least until and if the
mp3lame commits make it to the tree.

> if libfaac support is droped, muxers wont be tested against it anymore
> most likely. It could be done with command line faac and remuxing but
> that special case makes it so unwieldy that i doubt anyone will do it
> 
> also quite some testcases in trac tickets used libfaac as it was
> default at the time,
> regression testing future changes against these tickets may be
> unreliable without libfaac

Bugs in libfaac or the lavc wrapper wouldn't happen anymore because the
wrapper just wont exist anymore. And if some issue can't be reproduced
with aacenc or libfdk-aac, then it wouldn't be an issue to begin with.

We dropped libdcadec and libutvideo for being duplicate of internal
functionality, libquvi for being unmaintained and no longer functional,
and we dropped libaacplus and libvo-aac for sucking in both quality and
license and having better alternatives also in both regards. The same
applies to libfaac.
Lets not waste more time bikeshedding about it. Nodody should be using
this thing when aacenc and libfdk-aac exist.

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


Re: [FFmpeg-devel] [PATCH] lavc: remove libfaac wrapper

2016-09-29 Thread Lou Logan
On Fri, 30 Sep 2016 01:17:47 +0200, Carl Eugen Hoyos wrote:

> The two last sentences seem to contradict each other, no?

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


Re: [FFmpeg-devel] [PATCH] lavc: remove libfaac wrapper

2016-09-29 Thread Carl Eugen Hoyos
2016-09-30 1:15 GMT+02:00 Lou Logan :
> On Fri, 30 Sep 2016 00:33:54 +0200, wm4 wrote:
>
>> I highly doubt anyone will bother with installing and compiling with
>> libfaac at all.
>
> Agreed.
>
> From my observations encountering a user with a modern ffmpeg
> actually encoding with libfaac is a very rare occurance. Compared
> to other encoders it is virtually unused.
>
> The impression I get is those that do are likely copying random,
> ancient commands.

The two last sentences seem to contradict each other, no?

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


Re: [FFmpeg-devel] [PATCH] lavc: remove libfaac wrapper

2016-09-29 Thread Lou Logan
On Fri, 30 Sep 2016 00:33:54 +0200, wm4 wrote:

> I highly doubt anyone will bother with installing and compiling with
> libfaac at all.

Agreed.

From my observations encountering a user with a modern ffmpeg actually
encoding with libfaac is a very rare occurance. Compared to other
encoders it is virtually unused.

The impression I get is those that do are likely copying random,
ancient commands.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc: remove libfaac wrapper

2016-09-29 Thread Josh de Kock

On 30/09/2016 00:11, Carl Eugen Hoyos wrote:

2016-09-30 0:51 GMT+02:00 wm4 :

On Fri, 30 Sep 2016 00:42:11 +0200
Carl Eugen Hoyos  wrote:


2016-09-30 0:33 GMT+02:00 wm4 :

On Fri, 30 Sep 2016 00:21:56 +0200
Michael Niedermayer  wrote:



Also this argument is highly shady


Am I correct that it is just a language error that makes you
attack another developer personally?


No.


Then what do you suggest?



Can we not resort to personal arguments? please.

Is it possible to confirm that there are no other encoders which could 
produce the same issue in movenc as libfaac? Also, related to libfaac 
would be irrelevant if it were dropped.


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


Re: [FFmpeg-devel] [PATCH] lavc: remove libfaac wrapper

2016-09-29 Thread Carl Eugen Hoyos
2016-09-30 0:51 GMT+02:00 wm4 :
> On Fri, 30 Sep 2016 00:42:11 +0200
> Carl Eugen Hoyos  wrote:
>
>> 2016-09-30 0:33 GMT+02:00 wm4 :
>> > On Fri, 30 Sep 2016 00:21:56 +0200
>> > Michael Niedermayer  wrote:
>>
>> > Also this argument is highly shady
>>
>> Am I correct that it is just a language error that makes you
>> attack another developer personally?
>
> No.

Then what do you suggest?

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


Re: [FFmpeg-devel] [PATCH] lavc: remove libfaac wrapper

2016-09-29 Thread wm4
On Fri, 30 Sep 2016 00:42:11 +0200
Carl Eugen Hoyos  wrote:

> 2016-09-30 0:33 GMT+02:00 wm4 :
> > On Fri, 30 Sep 2016 00:21:56 +0200
> > Michael Niedermayer  wrote:  
> 
> > Also this argument is highly shady  
> 
> Am I correct that it is just a language error that makes you
> attack another developer personally?

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


Re: [FFmpeg-devel] [PATCH] lavc: remove libfaac wrapper

2016-09-29 Thread Josh de Kock

On 29/09/2016 23:42, Carl Eugen Hoyos wrote:

2016-09-30 0:33 GMT+02:00 wm4 :

On Fri, 30 Sep 2016 00:21:56 +0200
Michael Niedermayer  wrote:



Also this argument is highly shady


Am I correct that it is just a language error that makes you
attack another developer personally?


wm4 didn't attack anyone, they just said that the argument was ambiguous 
and may benefit from further explanation.


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


[FFmpeg-devel] [PATCH] lavf/segment: provide a virtual AVIOContext representing all the segments

2016-09-29 Thread Rodger Combs
This allows the use of muxers like matroska, which attempt to seek even
when an AVIOContext doesn't set `seekable`, without concern for a rouge
seek leading the muxer to overwrite the wrong data in a later segment.
---
 doc/muxers.texi   |  17 
 libavformat/segment.c | 276 +-
 libavformat/version.h |   2 +-
 3 files changed, 223 insertions(+), 72 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 2c937c7..fd2136e 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1390,6 +1390,23 @@ argument must be a time duration specification, and 
defaults to 0.
 If enabled, write an empty segment if there are no packets during the period a
 segment would usually span. Otherwise, the segment will be filled with the next
 packet written. Defaults to @code{0}.
+
+@item individual_header_trailer @var{1|0}
+Write each segment as an individual distinct file in the underlying format.
+When this is set to @code{0}, the segments are treated as a single continuous
+stream. When set to @code{1} (the default), each individual segment receives
+a header and trailer, so they can be played independently.
+
+@item segment_header_filename @var{name}
+Write the global header to a separate file. Requires
+@var{individual_header_trailer} to be @code{0}. If not set, the global header
+will be written to the first file along with actual segment data.
+
+@item segment_seekback @var{1|0}
+Allow the muxer to seek back and overwrite data from previous segments. 
Requires
+@var{individual_header_trailer} to be @code{0}. If set to @code{0} (the 
default),
+the underlying muxer will be unable to seek back into previous segments, so 
they
+can be relied upon not to change once written.
 @end table
 
 @subsection Examples
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 33a5cf0..4858e9c 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -51,8 +51,10 @@ typedef struct SegmentListEntry {
 int64_t start_pts;
 int64_t offset_pts;
 char *filename;
+char *full_filename;
 struct SegmentListEntry *next;
 int64_t last_duration;
+size_t start_offset;
 } SegmentListEntry;
 
 typedef enum {
@@ -125,7 +127,13 @@ typedef struct SegmentContext {
 
 SegmentListEntry cur_entry;
 SegmentListEntry *segment_list_entries;
+SegmentListEntry *segment_list_entries_all;
 SegmentListEntry *segment_list_entries_end;
+SegmentListEntry *segment_list_entry_writing;
+int seekback;  ///< allow seeking back to previous segments
+AVIOContext *cur_pb;   ///< current segment put-byte context
+size_t write_offset;
+size_t max_offset;
 } SegmentContext;
 
 static void print_csv_escaped_str(AVIOContext *ctx, const char *str)
@@ -144,6 +152,123 @@ static void print_csv_escaped_str(AVIOContext *ctx, const 
char *str)
 avio_w8(ctx, '"');
 }
 
+static int64_t virtual_seek(void *priv, int64_t target, int whence)
+{
+AVFormatContext *s = priv;
+SegmentContext *seg = s->priv_data;
+SegmentListEntry *it, *current = NULL;
+int64_t offset = target;
+int64_t ret;
+
+if (whence != SEEK_SET)
+return AVERROR(EINVAL);
+if (offset < 0)
+return AVERROR(EINVAL);
+
+if (offset >= seg->max_offset) {
+ff_format_io_close(s, >cur_pb);
+seg->write_offset = offset;
+return offset;
+}
+
+if (seg->cur_entry.start_offset <= offset) {
+current = >cur_entry;
+} else {
+for (it = seg->segment_list_entries_all; it; it = it->next) {
+if (it->start_offset <= offset)
+current = it;
+else if (it->start_offset > offset)
+break;
+}
+}
+
+offset -= current->start_offset;
+
+if (current != seg->segment_list_entry_writing) {
+int is_seekback = (current != >cur_entry) && 
seg->segment_list_entries;
+char *new_filename;
+AVIOContext *new_ctx = NULL;
+AVDictionary *options = NULL;
+
+if (!seg->seekback && is_seekback)
+return AVERROR(EINVAL);
+
+new_filename = current->full_filename;
+
+if (new_filename) {
+if (is_seekback)
+av_dict_set_int(, "truncate", 0, 0);
+if ((ret = s->io_open(s, _ctx, new_filename, AVIO_FLAG_WRITE, 
)) < 0) {
+av_log(s, AV_LOG_ERROR, "Failed to seek into segment '%s'\n", 
new_filename);
+return ret;
+}
+}
+
+ff_format_io_close(s, >cur_pb);
+seg->cur_pb = new_ctx;
+seg->segment_list_entry_writing = current;
+}
+
+if (seg->cur_pb)
+if ((ret = avio_seek(seg->cur_pb, offset, SEEK_SET)) < 0)
+return ret;
+
+seg->write_offset = offset;
+
+return target;
+}
+
+static int virtual_write(void *priv, uint8_t *buf, int buf_size)
+{
+AVFormatContext *s = priv;
+SegmentContext *seg = s->priv_data;
+int ret = 0;
+int written = 0;
+

Re: [FFmpeg-devel] [PATCH] lavc: remove libfaac wrapper

2016-09-29 Thread Carl Eugen Hoyos
2016-09-30 0:33 GMT+02:00 wm4 :
> On Fri, 30 Sep 2016 00:21:56 +0200
> Michael Niedermayer  wrote:

> Also this argument is highly shady

Am I correct that it is just a language error that makes you
attack another developer personally?

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


[FFmpeg-devel] Improved SAMI support

2016-09-29 Thread Jehan Pagès
Hello!

So I posted a patch about SAMI support
(https://trac.ffmpeg.org/ticket/3118), but I was told it would be
ignored on the bug tracker, therefore to use the dev mailing list. So
patch attached, and a small description:

SAMI subtitles can have several languages (as explained in the spec:
https://msdn.microsoft.com/en-us/library/ms971327.aspx). But currently
this is not supported by ffmpeg. What ffmpeg does is simply using
subtitles for all language, and when 2 subtitles uses the same
timestamp (which obviously happen for most text in the file since they
are made for the same video), the one later defined in the file will
override the first definition.
Example:

> Some text in Korean (for instance)
> […]
> The same text but in English.

Result: the Korean text will never be displayed.
Also you can end up with mix of languages (versions of a subtitle in
another lang may have additional timestamps which don't get
overriden). As a consequence, I have to edit nearly every SMI file
which comes into my hand and delete all text from the language I don't
want myself. And that's extremely annoying.

My attached patch is a first step. It will only take into account
subtitles set for the default language (which means, the first defined
in the SAMI file, cf. the spec), or without a language (therefore a
subtitle can be common to all langs). Of course, the perfect version
should extract 1 subtitle track per lang in the file. This first patch
does not (maybe another one later!). But that's still a huge
improvement from the current code since usually all the SMI files I
find, the default language is indeed the one I need (since they were
done for this purpose). I have used this patch for the last 2 days,
and that's already a huge relief for me. :-)

Could this be integrated into ffmpeg?
Thanks!

Jehan

-- 
ZeMarmot open animation film
http://film.zemarmot.net
Patreon: https://patreon.com/zemarmot
Tipeee: https://www.tipeee.com/zemarmot
From 0cd4d92b98ecbf364891038b851740291cf75219 Mon Sep 17 00:00:00 2001
From: Jehan 
Date: Wed, 28 Sep 2016 03:28:52 +0200
Subject: [PATCH] avformat: basic language support in SAMI subtitles.

Different languages are not yet extracted as separate subtitle tracks.
This first basic version simply uses the default language and ignore any
others. The spec says: "If the user (or author) has not explicitly
selected a language, the first Class (language) definition will be used
by default."
See: https://msdn.microsoft.com/en-us/library/ms971327.aspx
---
 libavformat/realtextdec.c |  14 ++--
 libavformat/samidec.c | 167 ++
 libavformat/subtitles.c   |  22 +-
 libavformat/subtitles.h   |   5 +-
 4 files changed, 187 insertions(+), 21 deletions(-)

diff --git a/libavformat/realtextdec.c b/libavformat/realtextdec.c
index 618d4f7..c0b0e44 100644
--- a/libavformat/realtextdec.c
+++ b/libavformat/realtextdec.c
@@ -85,10 +85,12 @@ static int realtext_read_header(AVFormatContext *s)
 
 if (!av_strncasecmp(buf.str, "codecpar->extradata = av_strdup(buf.str);
 if (!st->codecpar->extradata) {
 res = AVERROR(ENOMEM);
@@ -105,12 +107,16 @@ static int realtext_read_header(AVFormatContext *s)
 goto end;
 }
 if (!merge) {
-const char *begin = ff_smil_get_attr_ptr(buf.str, "begin");
-const char *end   = ff_smil_get_attr_ptr(buf.str, "end");
+char *begin = ff_smil_get_attr_ptr(buf.str, "begin");
+char *end   = ff_smil_get_attr_ptr(buf.str, "end");
 
 sub->pos  = pos;
 sub->pts  = begin ? read_ts(begin) : 0;
 sub->duration = end ? (read_ts(end) - sub->pts) : duration;
+if (begin)
+av_free(begin);
+if (end)
+av_free(end);
 }
 }
 av_bprint_clear();
diff --git a/libavformat/samidec.c b/libavformat/samidec.c
index 7ea1bdf..3bd16ea 100644
--- a/libavformat/samidec.c
+++ b/libavformat/samidec.c
@@ -26,6 +26,7 @@
 
 #include "avformat.h"
 #include "internal.h"
+#include "regex.h"
 #include "subtitles.h"
 #include "libavcodec/internal.h"
 #include "libavutil/avstring.h"
@@ -34,6 +35,10 @@
 
 typedef struct {
 FFDemuxSubtitlesQueue q;
+char **lang_names;
+char **lang_codes;
+char **lang_ids;
+intn_langs;
 } SAMIContext;
 
 static int sami_probe(AVProbeData *p)
@@ -51,11 +56,19 @@ static int sami_read_header(AVFormatContext *s)
 SAMIContext *sami = s->priv_data;
 AVStream *st = 

Re: [FFmpeg-devel] [PATCH] lavc: remove libfaac wrapper

2016-09-29 Thread wm4
On Fri, 30 Sep 2016 00:21:56 +0200
Michael Niedermayer  wrote:

> On Thu, Sep 29, 2016 at 09:54:42PM +0100, Josh de Kock wrote:
> > There is really no need for two aac wrappers, we already have
> > libfdk-aac which is better. Not to mention that faac doesn't
> > even support HEv1, or HEv2. It's also under a license which is
> > unusable for distribution, so it would only be useful to people
> > who will compile their own ffmpeg, only use it themselves (which
> > at that point should just use fdk-aac).
> > 
> > Signed-off-by: Josh de Kock 
> > ---
> >  Changelog  |   1 +
> >  LICENSE.md |   2 -
> >  configure  |   6 --
> >  doc/encoders.texi  | 105 -
> >  doc/ffserver.conf  |   2 +-
> >  doc/general.texi   |   2 +-
> >  doc/muxers.texi|   4 +-
> >  doc/platform.texi  |   2 +-
> >  libavcodec/Makefile|   1 -
> >  libavcodec/allcodecs.c |   1 -
> >  libavcodec/libfaac.c   | 248 
> > -
> >  11 files changed, 6 insertions(+), 368 deletions(-)
> >  delete mode 100644 libavcodec/libfaac.c  
> 
> dont remember if it was specific to libfaac but some issues in the
> mov edit list patches about initial padding and trailing padding
> where found using libfaac as encoder.

Just because it was useful in one situation doesn't mean we have to
keep it forever. Also this argument is highly shady and unspecific. Why
couldn't this done with another encoder? What are the details on this?

> if libfaac support is droped, muxers wont be tested against it anymore
> most likely. It could be done with command line faac and remuxing but
> that special case makes it so unwieldy that i doubt anyone will do it

I highly doubt anyone will bother with installing and compiling with
libfaac at all.

> also quite some testcases in trac tickets used libfaac as it was
> default at the time,
> regression testing future changes against these tickets may be
> unreliable without libfaac

Well good thing that we don't have to fix libfaac bugs anymore once
this is removed.

What is the real reason you want to keep this? Last time you argued
libfaac was needed for audio encoding on phones, even though absolutely
nobody is going to put ffmpeg+libfaac into an "app" because of license
problems.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] ffmpeg: use new decode API

2016-09-29 Thread wm4
On Thu, 29 Sep 2016 23:35:49 +0200
Michael Niedermayer  wrote:

> On Thu, Sep 29, 2016 at 08:25:18PM +0200, wm4 wrote:
> > This is a bit messy, mainly due to timestamp handling.
> > 
> > decode_video() relied on the fact that it could set dts on a flush/drain
> > packet. This is not possible with the old API, and won't be. (I think
> > doing this was very questionable with the old API. Flush packets should
> > not contain any information; they just cause a FIFO to be emptied.) This
> > is replaced with checking the best_effort_timestamp for AV_NOPTS_VALUE,
> > and using the suggested DTS in the drain case.
> > 
> > The fate-cavs test still fails due to dropping the last frame. This
> > happens because the timestamp of the last frame goes backwards
> > (ffprobe -show_frames shows the same thing). I suspect that this
> > "worked" due to the best effort timestamp logic picking the DTS
> > over the decreasing PTS. Since this logic is in libavcodec (where
> > it probably shouldn't be), this can't be easily fixed. The timestamps
> > of the cavs samples are weird anyway, so I chose not to fix it.
> > 
> > Another strange thing is the timestamp handling in the video path of
> > process_input_packet (after the decode_video() call). It looks like
> > the code to increase next_dts and next_pts should be run every time
> > a frame is decoded - but it's needed even if output is skipped.
> > ---
> >  ffmpeg.c| 178 
> > +---
> >  ffmpeg.h|   3 +
> >  tests/ref/fate/cavs |   1 -
> >  3 files changed, 129 insertions(+), 53 deletions(-)  
> 
> with this and patch 1/3
> the following infinite loops
> ./ffmpeg  -f openal -i ''  -t 0.1 file.wav
> 

Give me a way to reproduce without OpenAL or anything libavdevice. I
feel like I suffered enough already for this shit.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc: remove libfaac wrapper

2016-09-29 Thread Michael Niedermayer
On Thu, Sep 29, 2016 at 09:54:42PM +0100, Josh de Kock wrote:
> There is really no need for two aac wrappers, we already have
> libfdk-aac which is better. Not to mention that faac doesn't
> even support HEv1, or HEv2. It's also under a license which is
> unusable for distribution, so it would only be useful to people
> who will compile their own ffmpeg, only use it themselves (which
> at that point should just use fdk-aac).
> 
> Signed-off-by: Josh de Kock 
> ---
>  Changelog  |   1 +
>  LICENSE.md |   2 -
>  configure  |   6 --
>  doc/encoders.texi  | 105 -
>  doc/ffserver.conf  |   2 +-
>  doc/general.texi   |   2 +-
>  doc/muxers.texi|   4 +-
>  doc/platform.texi  |   2 +-
>  libavcodec/Makefile|   1 -
>  libavcodec/allcodecs.c |   1 -
>  libavcodec/libfaac.c   | 248 
> -
>  11 files changed, 6 insertions(+), 368 deletions(-)
>  delete mode 100644 libavcodec/libfaac.c

dont remember if it was specific to libfaac but some issues in the
mov edit list patches about initial padding and trailing padding
where found using libfaac as encoder.
if libfaac support is droped, muxers wont be tested against it anymore
most likely. It could be done with command line faac and remuxing but
that special case makes it so unwieldy that i doubt anyone will do it

also quite some testcases in trac tickets used libfaac as it was
default at the time,
regression testing future changes against these tickets may be
unreliable without libfaac

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

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


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


[FFmpeg-devel] [RFC]Changelog: Compress slightly

2016-09-29 Thread Carl Eugen Hoyos
Hi!

I consider the Changelog more readable with attached patch.

I wonder if the ogv line should be dropped...

Please comment, Carl Eugen
From 01b62bd9f7da4c991144dfa4039f168d20612f06 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Fri, 30 Sep 2016 00:06:12 +0200
Subject: [PATCH] Changelog: Compress slightly to improve readability.

---
 Changelog |   12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/Changelog b/Changelog
index d7f5dc9..ce186fc 100644
--- a/Changelog
+++ b/Changelog
@@ -8,10 +8,9 @@ version :
 - Alias muxer for Ogg Video (.ogv)
 - VP8 in Ogg muxing
 - curves filter doesn't automatically insert points at x=0 and x=1 anymore
-- 16-bit support in curves filter
-- 16-bit support in selectivecolor filter
+- 16-bit support in curves filter and selectivecolor filter
 - OpenH264 decoder wrapper
-- MediaCodec hwaccel
+- MediaCodec H.264 and HEVC hwaccel
 - True Audio (TTA) muxer
 - crystalizer audio filter
 - acrusher audio filter
@@ -28,12 +27,9 @@ version :
 - gblur filter
 - avgblur filter
 - sobel and prewitt filter
-- MediaCodec HEVC decoding
-- TrueHD encoder
-- Meridian Lossless Packing (MLP) encoder
+- Meridian Lossless Packing (MLP) / TrueHD encoder
 - Non-Local Means (nlmeans) denoising filter
-- sdl2 output device
-- sdl2 support for ffplay
+- sdl2 output device and ffplay support
 - sdl1 output device and sdl1 support removed
 - extended mov edit list support
 
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH 2/3] ffmpeg: use new decode API

2016-09-29 Thread Michael Niedermayer
On Thu, Sep 29, 2016 at 08:25:18PM +0200, wm4 wrote:
> This is a bit messy, mainly due to timestamp handling.
> 
> decode_video() relied on the fact that it could set dts on a flush/drain
> packet. This is not possible with the old API, and won't be. (I think
> doing this was very questionable with the old API. Flush packets should
> not contain any information; they just cause a FIFO to be emptied.) This
> is replaced with checking the best_effort_timestamp for AV_NOPTS_VALUE,
> and using the suggested DTS in the drain case.
> 
> The fate-cavs test still fails due to dropping the last frame. This
> happens because the timestamp of the last frame goes backwards
> (ffprobe -show_frames shows the same thing). I suspect that this
> "worked" due to the best effort timestamp logic picking the DTS
> over the decreasing PTS. Since this logic is in libavcodec (where
> it probably shouldn't be), this can't be easily fixed. The timestamps
> of the cavs samples are weird anyway, so I chose not to fix it.
> 
> Another strange thing is the timestamp handling in the video path of
> process_input_packet (after the decode_video() call). It looks like
> the code to increase next_dts and next_pts should be run every time
> a frame is decoded - but it's needed even if output is skipped.
> ---
>  ffmpeg.c| 178 
> +---
>  ffmpeg.h|   3 +
>  tests/ref/fate/cavs |   1 -
>  3 files changed, 129 insertions(+), 53 deletions(-)

with this and patch 1/3
the following infinite loops
./ffmpeg  -f openal -i ''  -t 0.1 file.wav

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

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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


[FFmpeg-devel] [PATCH] lavc: remove libfaac wrapper

2016-09-29 Thread Josh de Kock
There is really no need for two aac wrappers, we already have
libfdk-aac which is better. Not to mention that faac doesn't
even support HEv1, or HEv2. It's also under a license which is
unusable for distribution, so it would only be useful to people
who will compile their own ffmpeg, only use it themselves (which
at that point should just use fdk-aac).

Signed-off-by: Josh de Kock 
---
 Changelog  |   1 +
 LICENSE.md |   2 -
 configure  |   6 --
 doc/encoders.texi  | 105 -
 doc/ffserver.conf  |   2 +-
 doc/general.texi   |   2 +-
 doc/muxers.texi|   4 +-
 doc/platform.texi  |   2 +-
 libavcodec/Makefile|   1 -
 libavcodec/allcodecs.c |   1 -
 libavcodec/libfaac.c   | 248 -
 11 files changed, 6 insertions(+), 368 deletions(-)
 delete mode 100644 libavcodec/libfaac.c

diff --git a/Changelog b/Changelog
index d7f5dc9..2c2f32d 100644
--- a/Changelog
+++ b/Changelog
@@ -36,6 +36,7 @@ version :
 - sdl2 support for ffplay
 - sdl1 output device and sdl1 support removed
 - extended mov edit list support
+- libfaac encoder removed
 
 
 version 3.1:
diff --git a/LICENSE.md b/LICENSE.md
index d08c747..a384fa0 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -115,8 +115,6 @@ The Fraunhofer FDK AAC and OpenSSL libraries are under 
licenses which are
 incompatible with the GPLv2 and v3. To the best of our knowledge, they are
 compatible with the LGPL.
 
-The FAAC library is incompatible with all versions of GPL and LGPL.
-
 The NVENC library, while its header file is licensed under the compatible MIT
 license, requires a proprietary binary blob at run time, and is deemed to be
 incompatible with the GPL. We are not certain if it is compatible with the
diff --git a/configure b/configure
index 899057d..4313b7d 100755
--- a/configure
+++ b/configure
@@ -225,7 +225,6 @@ External library support:
and libraw1394 [no]
   --enable-libebur128  enable libebur128 for EBU R128 measurement,
needed for loudnorm filter [no]
-  --enable-libfaac enable AAC encoding via libfaac [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
   --enable-libfliteenable flite (voice synthesis) support via libflite 
[no]
   --enable-libfontconfig   enable libfontconfig, useful for drawtext filter 
[no]
@@ -1487,7 +1486,6 @@ EXTERNAL_LIBRARY_LIST="
 libcelt
 libdc1394
 libebur128
-libfaac
 libfdk_aac
 libflite
 libfontconfig
@@ -2772,8 +2770,6 @@ pcm_mulaw_at_encoder_select="audio_frame_queue"
 chromaprint_muxer_deps="chromaprint"
 h264_videotoolbox_encoder_deps="videotoolbox_encoder pthreads"
 libcelt_decoder_deps="libcelt"
-libfaac_encoder_deps="libfaac"
-libfaac_encoder_select="audio_frame_queue"
 libfdk_aac_decoder_deps="libfdk_aac"
 libfdk_aac_encoder_deps="libfdk_aac"
 libfdk_aac_encoder_select="audio_frame_queue"
@@ -5071,7 +5067,6 @@ die_license_disabled gpl x11grab
 
 die_license_disabled nonfree cuda
 die_license_disabled nonfree cuvid
-die_license_disabled nonfree libfaac
 die_license_disabled nonfree libnpp
 enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
 enabled gpl && die_license_disabled_gpl nonfree openssl
@@ -5681,7 +5676,6 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
die "ERROR: libcelt must be installed and 
version must be >= 0.11.0."; }
 enabled libcaca   && require_pkg_config caca caca.h caca_create_canvas
 enabled libebur128&& require ebur128 ebur128.h 
ebur128_relative_threshold -lebur128
-enabled libfaac   && require2 libfaac "stdint.h faac.h" 
faacEncGetVersion -lfaac
 enabled libfdk_aac&& { use_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" 
aacEncOpen ||
{ require libfdk_aac fdk-aac/aacenc_lib.h 
aacEncOpen -lfdk-aac &&
  warn "using libfdk without pkg-config"; } }
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 73ebd9c..1f4044e 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -612,111 +612,6 @@ and slightly improves compression.
 
 @end table
 
-@anchor{libfaac}
-@section libfaac
-
-libfaac AAC (Advanced Audio Coding) encoder wrapper.
-
-This encoder is of much lower quality and is more unstable than any other AAC
-encoders, so it's highly recommended to instead use other encoders, like
-@ref{aacenc,,the native FFmpeg AAC encoder}.
-
-This encoder also requires the presence of the libfaac headers and library
-during configuration. You need to explicitly configure the build with
-@code{--enable-libfaac --enable-nonfree}.
-
-@subsection Options
-
-The following shared FFmpeg codec options are recognized.
-
-The following options are supported by the libfaac wrapper. The
-@command{faac}-equivalent of the options are listed in parentheses.
-
-@table @option
-@item b 

Re: [FFmpeg-devel] [PATCH] lavf: add ffprobe demuxer

2016-09-29 Thread Nicolas George
L'octidi 8 vendémiaire, an CCXXV, wm4 a écrit :
> This seems like a rather special use case. Why does it have a demuxer,
> and can't be in your own C code using libavcodec/libavformat?

Of course, it can. It just takes more effort overall. You do not believe
that Stefano and I both started working on a similar project on a whim, do
you? We did it because we felt it would gain time in the long run. Once the
demuxer is there, it is ready for all uses.

I very often have samples triggering bugs that I want to tweak to see what
is causing the bug exactly: timestamps, order of packets, even the payload.
Editing them with a powerful text editor or a perl one-liner beats anything
in terms of efficiency to do so.

> In addition, I think using the ffprobe "format" is an overcomplication,
> and will justify adding even more stuff to the demuxer, until it's a
> similarily complex mess like the ffm demuxer/muxer.

This looks like a "slippery slope" fallacy.

Since it is clearly useful almost only for developers doing debugging, I
would not mind having no probe function or even disabled by default, making
it a non-issue security-wise. Beyond that, I have yet to see an actual
argument against it.

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 2/2] avformat/tee: Add FATE tests for tee

2016-09-29 Thread Michael Niedermayer
On Thu, Sep 29, 2016 at 12:49:37AM +0200, sebechlebsky...@gmail.com wrote:
> From: Jan Sebechlebsky 
> 
> This commit also adds new diff option for fate tests allowing do compare
> multiple tuples of files.
> 
> Signed-off-by: Jan Sebechlebsky 
> ---
>  tests/Makefile|  1 +
>  tests/fate-run.sh |  7 
>  tests/fate/tee-muxer.mak  | 22 ++
>  tests/ref/fate/tee-muxer-h264 |  2 +
>  tests/ref/fate/tee-muxer-h264-audio   | 30 +
>  tests/ref/fate/tee-muxer-h264-copy| 47 +
>  tests/ref/fate/tee-muxer-ignorefail   | 79 
> +++
>  tests/ref/fate/tee-muxer-tstsrc   |  2 +
>  tests/ref/fate/tee-muxer-tstsrc-audio | 49 ++
>  9 files changed, 239 insertions(+)
>  create mode 100644 tests/fate/tee-muxer.mak
>  create mode 100644 tests/ref/fate/tee-muxer-h264
>  create mode 100644 tests/ref/fate/tee-muxer-h264-audio
>  create mode 100644 tests/ref/fate/tee-muxer-h264-copy
>  create mode 100644 tests/ref/fate/tee-muxer-ignorefail
>  create mode 100644 tests/ref/fate/tee-muxer-tstsrc
>  create mode 100644 tests/ref/fate/tee-muxer-tstsrc-audio

this does not seem to work when building out of tree

make distclean ; ../configure --samples=... && make fate-tee-muxer-tstsrc 
fate-tee-muxer-ignorefail fate-tee-muxer-h264 -j12
...

diff: tests/data/fate/tee-muxer-h264-copy: No such file or directory
Test tee-muxer-h264 failed. Look at tests/data/fate/tee-muxer-h264.err for 
details.
make: *** [fate-tee-muxer-h264] Error 2
make: *** Waiting for unfinished jobs
diff: tests/data/fate/tee-muxer-tstsrc-copy: No such file or directory

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

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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: add ffprobe demuxer

2016-09-29 Thread Josh de Kock



On 29/09/2016 00:21, Stefano Sabatini wrote:

On date Monday 2016-09-26 18:55:47 +0200, wm4 encoded:

On Sun, 25 Sep 2016 19:32:37 +0200
Stefano Sabatini  wrote:

[...]

My use case: I need to build a data stream with scripting/manual
editing. Since I don't want to have to rely on a binary format (which
is not ideal for that use case) I needed a format simple enough to be
written and analysed without special tools, but with a simple text
editor.


I still don't get it. Your description makes me think of something like
EDL, but that doesn't seem to have anything to do with it.


EDL as "Edit Decision List"? No I don't think this is related at
all.

Suppose you want to inject a data stream, you have the data and you
know where to insert it given its PTS. With this muxer you can
handcraft a textual file in the ffprobe_default format and use ffmpeg
to inject the new data stream.





What's a "data stream"?


A stream consisting of generic data, that is a stream with type
AV_MEDIA_TYPE_DATA.


Inject into what?


Interleave the stream with other media streams (audio, video,
etc.). This can be done via remuxing (no need for transcoding).


And why?


Data stream could be used to insert custom information for
post-processing (e.g. they might contain advertising information).



Are you sure this cannot be done from outside of libav*? It really seems 
like something which wouldn't actually be very useful for anyone else. 
It's also just another hack in for a non-standardised, exclusive format. 
Lavf is really not a good fit for this and it should be done outside of 
libav*.


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


Re: [FFmpeg-devel] [PATCH] lavf: add ffprobe demuxer

2016-09-29 Thread wm4
On Thu, 29 Sep 2016 01:21:01 +0200
Stefano Sabatini  wrote:

> On date Monday 2016-09-26 18:55:47 +0200, wm4 encoded:
> > On Sun, 25 Sep 2016 19:32:37 +0200
> > Stefano Sabatini  wrote:  
> [...]
> > > > > My use case: I need to build a data stream with scripting/manual
> > > > > editing. Since I don't want to have to rely on a binary format (which
> > > > > is not ideal for that use case) I needed a format simple enough to be
> > > > > written and analysed without special tools, but with a simple text
> > > > > editor.
> > > > 
> > > > I still don't get it. Your description makes me think of something like
> > > > EDL, but that doesn't seem to have anything to do with it.
> > > 
> > > EDL as "Edit Decision List"? No I don't think this is related at
> > > all.
> > > 
> > > Suppose you want to inject a data stream, you have the data and you
> > > know where to insert it given its PTS. With this muxer you can
> > > handcraft a textual file in the ffprobe_default format and use ffmpeg
> > > to inject the new data stream.  
> >   
> 
> > What's a "data stream"?  
> 
> A stream consisting of generic data, that is a stream with type
> AV_MEDIA_TYPE_DATA.
> 
> > Inject into what?  
> 
> Interleave the stream with other media streams (audio, video,
> etc.). This can be done via remuxing (no need for transcoding).
> 
> > And why?  
> 
> Data stream could be used to insert custom information for
> post-processing (e.g. they might contain advertising information).

This seems like a rather special use case. Why does it have a demuxer,
and can't be in your own C code using libavcodec/libavformat?

In addition, I think using the ffprobe "format" is an overcomplication,
and will justify adding even more stuff to the demuxer, until it's a
similarily complex mess like the ffm demuxer/muxer.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavf/mov: Read display aspect ratio from ares atom also for dnxhd.

2016-09-29 Thread Michael Niedermayer
On Thu, Sep 29, 2016 at 03:57:12PM +0200, Carl Eugen Hoyos wrote:
> ffmpeg | branch: master | Carl Eugen Hoyos  | Thu Sep 29 
> 15:29:03 2016 +0200| [fcce25ee5d2f3fbe4848dee4c3d11b195d2d8126] | committer: 
> Carl Eugen Hoyos
> 
> lavf/mov: Read display aspect ratio from ares atom also for dnxhd.
> 
> Fixes aspect ratio of sample in ticket #2125.
> Fixes aspect ratio of sample in ticket #5325.
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fcce25ee5d2f3fbe4848dee4c3d11b195d2d8126

This changes the aspect for:
4876/DNxHD100_cid1260_example_cut.mov

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

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


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


[FFmpeg-devel] [PATCH 3/3] ffmpeg: use new encode API

2016-09-29 Thread wm4
---
 ffmpeg.c | 71 +---
 1 file changed, 46 insertions(+), 25 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index e7ac5c9..9de8507 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -830,7 +830,7 @@ static void do_audio_out(AVFormatContext *s, OutputStream 
*ost,
 {
 AVCodecContext *enc = ost->enc_ctx;
 AVPacket pkt;
-int got_packet = 0;
+int ret;
 
 av_init_packet();
 pkt.data = NULL;
@@ -854,13 +854,19 @@ static void do_audio_out(AVFormatContext *s, OutputStream 
*ost,
enc->time_base.num, enc->time_base.den);
 }
 
-if (avcodec_encode_audio2(enc, , frame, _packet) < 0) {
-av_log(NULL, AV_LOG_FATAL, "Audio encoding failed 
(avcodec_encode_audio2)\n");
-exit_program(1);
-}
-update_benchmark("encode_audio %d.%d", ost->file_index, ost->index);
+ret = avcodec_send_frame(enc, frame);
+if (ret < 0)
+goto error;
+
+while (1) {
+ret = avcodec_receive_packet(enc, );
+if (ret == AVERROR(EAGAIN))
+break;
+if (ret < 0)
+goto error;
+
+update_benchmark("encode_audio %d.%d", ost->file_index, ost->index);
 
-if (got_packet) {
 av_packet_rescale_ts(, enc->time_base, ost->st->time_base);
 
 if (debug_ts) {
@@ -872,6 +878,11 @@ static void do_audio_out(AVFormatContext *s, OutputStream 
*ost,
 
 output_packet(s, , ost);
 }
+
+return;
+error:
+av_log(NULL, AV_LOG_FATAL, "Audio encoding failed\n");
+exit_program(1);
 }
 
 static void do_subtitle_out(AVFormatContext *s,
@@ -1139,7 +1150,7 @@ static void do_video_out(AVFormatContext *s,
 } else
 #endif
 {
-int got_packet, forced_keyframe = 0;
+int forced_keyframe = 0;
 double pts_time;
 
 if (enc->flags & (AV_CODEC_FLAG_INTERLACED_DCT | 
AV_CODEC_FLAG_INTERLACED_ME) &&
@@ -1206,14 +1217,18 @@ static void do_video_out(AVFormatContext *s,
 
 ost->frames_encoded++;
 
-ret = avcodec_encode_video2(enc, , in_picture, _packet);
-update_benchmark("encode_video %d.%d", ost->file_index, ost->index);
-if (ret < 0) {
-av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n");
-exit_program(1);
-}
+ret = avcodec_send_frame(enc, in_picture);
+if (ret < 0)
+goto error;
+
+while (1) {
+ret = avcodec_receive_packet(enc, );
+update_benchmark("encode_video %d.%d", ost->file_index, 
ost->index);
+if (ret == AVERROR(EAGAIN))
+break;
+if (ret < 0)
+goto error;
 
-if (got_packet) {
 if (debug_ts) {
 av_log(NULL, AV_LOG_INFO, "encoder -> type:video "
"pkt_pts:%s pkt_pts_time:%s pkt_dts:%s 
pkt_dts_time:%s\n",
@@ -1261,6 +1276,11 @@ static void do_video_out(AVFormatContext *s,
 av_frame_ref(ost->last_frame, next_picture);
 else
 av_frame_free(>last_frame);
+
+return;
+error:
+av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n");
+exit_program(1);
 }
 
 static double psnr(double d)
@@ -1749,35 +1769,36 @@ static void flush_encoders(void)
 continue;
 #endif
 
+if (enc->codec_type != AVMEDIA_TYPE_VIDEO && enc->codec_type != 
AVMEDIA_TYPE_AUDIO)
+continue;
+
+avcodec_send_frame(enc, NULL);
+
 for (;;) {
-int (*encode)(AVCodecContext*, AVPacket*, const AVFrame*, int*) = 
NULL;
-const char *desc;
+const char *desc = NULL;
 
 switch (enc->codec_type) {
 case AVMEDIA_TYPE_AUDIO:
-encode = avcodec_encode_audio2;
 desc   = "audio";
 break;
 case AVMEDIA_TYPE_VIDEO:
-encode = avcodec_encode_video2;
 desc   = "video";
 break;
 default:
-stop_encoding = 1;
+av_assert0(0);
 }
 
-if (encode) {
+if (1) {
 AVPacket pkt;
 int pkt_size;
-int got_packet;
 av_init_packet();
 pkt.data = NULL;
 pkt.size = 0;
 
 update_benchmark(NULL);
-ret = encode(enc, , NULL, _packet);
+ret = avcodec_receive_packet(enc, );
 update_benchmark("flush_%s %d.%d", desc, ost->file_index, 
ost->index);
-if (ret < 0) {
+if (ret < 0 && ret != AVERROR_EOF) {
 av_log(NULL, AV_LOG_FATAL, "%s encoding failed: %s\n",
desc,
av_err2str(ret));
@@ -1786,7 +1807,7 @@ static void flush_encoders(void)
 if (ost->logfile && enc->stats_out) {
 fprintf(ost->logfile, "%s", enc->stats_out);
 }
-if 

[FFmpeg-devel] [PATCH 2/3] ffmpeg: use new decode API

2016-09-29 Thread wm4
This is a bit messy, mainly due to timestamp handling.

decode_video() relied on the fact that it could set dts on a flush/drain
packet. This is not possible with the old API, and won't be. (I think
doing this was very questionable with the old API. Flush packets should
not contain any information; they just cause a FIFO to be emptied.) This
is replaced with checking the best_effort_timestamp for AV_NOPTS_VALUE,
and using the suggested DTS in the drain case.

The fate-cavs test still fails due to dropping the last frame. This
happens because the timestamp of the last frame goes backwards
(ffprobe -show_frames shows the same thing). I suspect that this
"worked" due to the best effort timestamp logic picking the DTS
over the decreasing PTS. Since this logic is in libavcodec (where
it probably shouldn't be), this can't be easily fixed. The timestamps
of the cavs samples are weird anyway, so I chose not to fix it.

Another strange thing is the timestamp handling in the video path of
process_input_packet (after the decode_video() call). It looks like
the code to increase next_dts and next_pts should be run every time
a frame is decoded - but it's needed even if output is skipped.
---
 ffmpeg.c| 178 +---
 ffmpeg.h|   3 +
 tests/ref/fate/cavs |   1 -
 3 files changed, 129 insertions(+), 53 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index f03a594..e7ac5c9 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -550,6 +550,7 @@ static void ffmpeg_cleanup(int ret)
 av_frame_free(>sub2video.frame);
 av_freep(>filters);
 av_freep(>hwaccel_device);
+av_freep(>dts_buffer);
 
 avcodec_free_context(>dec_ctx);
 
@@ -1976,6 +1977,33 @@ static void check_decode_result(InputStream *ist, int 
*got_output, int ret)
 }
 }
 
+// This does not quite work like avcodec_decode_audio4/avcodec_decode_video2.
+// There is the following difference: if you got a frame, you must call
+// it again with pkt=NULL. pkt==NULL is treated differently from pkt.size==0
+// (pkt==NULL means get more output, pkt.size==0 is a flush/drain packet)
+static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, 
AVPacket *pkt)
+{
+int ret;
+
+*got_frame = 0;
+
+if (pkt) {
+ret = avcodec_send_packet(avctx, pkt);
+// In particular, we don't expect AVERROR(EAGAIN), because we read all
+// decoded frames with avcodec_receive_frame() until done.
+if (ret < 0 && ret != AVERROR_EOF)
+return ret;
+}
+
+ret = avcodec_receive_frame(avctx, frame);
+if (ret < 0 && ret != AVERROR(EAGAIN))
+return ret;
+if (ret >= 0)
+*got_frame = 1;
+
+return 0;
+}
+
 static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
 {
 AVFrame *decoded_frame, *f;
@@ -1990,7 +2018,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, 
int *got_output)
 decoded_frame = ist->decoded_frame;
 
 update_benchmark(NULL);
-ret = avcodec_decode_audio4(avctx, decoded_frame, got_output, pkt);
+ret = decode(avctx, decoded_frame, got_output, pkt);
 update_benchmark("decode_audio %d.%d", ist->file_index, ist->st->index);
 
 if (ret >= 0 && avctx->sample_rate <= 0) {
@@ -1998,7 +2026,8 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, 
int *got_output)
 ret = AVERROR_INVALIDDATA;
 }
 
-check_decode_result(ist, got_output, ret);
+if (ret != AVERROR_EOF)
+check_decode_result(ist, got_output, ret);
 
 if (!*got_output || ret < 0)
 return ret;
@@ -2066,14 +2095,13 @@ static int decode_audio(InputStream *ist, AVPacket 
*pkt, int *got_output)
 } else if (decoded_frame->pkt_pts != AV_NOPTS_VALUE) {
 decoded_frame->pts = decoded_frame->pkt_pts;
 decoded_frame_tb   = ist->st->time_base;
-} else if (pkt->pts != AV_NOPTS_VALUE) {
+} else if (pkt && pkt->pts != AV_NOPTS_VALUE) {
 decoded_frame->pts = pkt->pts;
 decoded_frame_tb   = ist->st->time_base;
 }else {
 decoded_frame->pts = ist->dts;
 decoded_frame_tb   = AV_TIME_BASE_Q;
 }
-pkt->pts   = AV_NOPTS_VALUE;
 if (decoded_frame->pts != AV_NOPTS_VALUE)
 decoded_frame->pts = av_rescale_delta(decoded_frame_tb, 
decoded_frame->pts,
   (AVRational){1, 
avctx->sample_rate}, decoded_frame->nb_samples, 
>filter_in_rescale_delta_last,
@@ -2101,23 +2129,45 @@ static int decode_audio(InputStream *ist, AVPacket 
*pkt, int *got_output)
 return err < 0 ? err : ret;
 }
 
-static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output)
+static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int 
eof)
 {
 AVFrame *decoded_frame, *f;
 int i, ret = 0, err = 0, resample_changed;
 int64_t best_effort_timestamp;
+int64_t dts = AV_NOPTS_VALUE;
 AVRational *frame_sample_aspect;
+AVPacket avpkt;
+

[FFmpeg-devel] [PATCH 1/3] ffmpeg: move subframe warning to libavcodec

2016-09-29 Thread wm4
With the new decode API, doing this in ffmpeg.c is impractical. There
was resistance against removing the warning, so put it into libavcodec.

Not bothering with reducing the warning to verbose log level for
subsequent wanrings. The warning should be rare, and only happen when
developing new codecs for the old API.

Includes a change suggested by Michael Niedermayer.
---
 ffmpeg.c  | 7 ---
 ffmpeg.h  | 1 -
 libavcodec/internal.h | 1 +
 libavcodec/utils.c| 6 ++
 4 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index d0f247e..f03a594 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2357,13 +2357,6 @@ static int process_input_packet(InputStream *ist, const 
AVPacket *pkt, int no_eo
 ist->pts = ist->next_pts;
 ist->dts = ist->next_dts;
 
-if (avpkt.size && avpkt.size != pkt->size &&
-!(ist->dec->capabilities & AV_CODEC_CAP_SUBFRAMES)) {
-av_log(NULL, ist->showed_multi_packet_warning ? AV_LOG_VERBOSE : 
AV_LOG_WARNING,
-   "Multiple frames in a packet from stream %d\n", 
pkt->stream_index);
-ist->showed_multi_packet_warning = 1;
-}
-
 switch (ist->dec_ctx->codec_type) {
 case AVMEDIA_TYPE_AUDIO:
 ret = decode_audio(ist, , _output);
diff --git a/ffmpeg.h b/ffmpeg.h
index 0d01d2b..3ba62a1 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -287,7 +287,6 @@ typedef struct InputStream {
 
 double ts_scale;
 int saw_first_ts;
-int showed_multi_packet_warning;
 AVDictionary *decoder_opts;
 AVRational framerate;   /* framerate forced with -r */
 int top_field_first;
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 000fe26..35b9630 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -173,6 +173,7 @@ typedef struct AVCodecInternal {
 int buffer_pkt_valid; // encoding: packet without data can be valid
 AVFrame *buffer_frame;
 int draining_done;
+int showed_multi_packet_warning;
 } AVCodecInternal;
 
 struct AVCodecDefault {
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index b0345b6..22ac9a0 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2448,6 +2448,12 @@ fail:
 
 av_assert0(ret <= avpkt->size);
 
+if (!avci->showed_multi_packet_warning &&
+ret >= 0 && ret != avpkt->size && !(avctx->codec->capabilities & 
AV_CODEC_CAP_SUBFRAMES)) {
+av_log(avctx, AV_LOG_WARNING, "Multiple frames in a packet.\n");
+avci->showed_multi_packet_warning = 1;
+}
+
 return ret;
 }
 
-- 
2.9.3

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


Re: [FFmpeg-devel] [PATCH] avformat/flvenc: add flv live stream flag

2016-09-29 Thread Michael Niedermayer
On Thu, Sep 29, 2016 at 09:25:35PM +0800, Steven Liu wrote:
> patch update
> 
> merge 1/2 and 2/2 into one patch

>  doc/muxers.texi  |5 +
>  libavformat/flvenc.c |   50 
> +-
>  2 files changed, 34 insertions(+), 21 deletions(-)
> f2c4c83d362faf1819b3aa72fc5608603f824dc1  
> 0001-avformat-flvenc-add-flv-live-stream-flag.patch
> From 7f5ff0d89c19e1683f91befb77ba4a7bf7b66252 Mon Sep 17 00:00:00 2001
> From: Steven Liu 
> Date: Thu, 29 Sep 2016 21:20:34 +0800
> Subject: [PATCH] avformat/flvenc: add flv live stream flag
> 
> If the flv format is used for live stream on publish
> ffmpeg should not update dutration and filesize at the end.
> because the live stream is sent metadata at first step.
> 
> Reviewed-by: Carl Eugen Hoyos 
> Signed-off-by: Steven Liu 
> ---
>  doc/muxers.texi  |  5 +
>  libavformat/flvenc.c | 50 +-
>  2 files changed, 34 insertions(+), 21 deletions(-)
> 
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 27d1038..aa20656 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -148,6 +148,11 @@ Place AAC sequence header based on audio stream data.
>  @item no_sequence_end
>  Disable sequence end tag.
>  @end table
> +
> +@item live_stream
> +Disable the duration and filesize update in the flv metadata.
> +@end table
> +
>  @end table
>  
>  @anchor{framecrc}
> diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> index 99903f5..cd9ca84 100644
> --- a/libavformat/flvenc.c
> +++ b/libavformat/flvenc.c
> @@ -64,6 +64,7 @@ static const AVCodecTag flv_audio_codec_ids[] = {
>  typedef enum {
>  FLV_AAC_SEQ_HEADER_DETECT = (1 << 0),
>  FLV_NO_SEQUENCE_END = (1 << 1),
> +FLV_LIVE_STREAM = (1 << 2),
>  } FLVFlags;
>  
>  typedef struct FLVContext {
> @@ -234,17 +235,18 @@ static void write_metadata(AVFormatContext *s, unsigned 
> int ts)
>  metadata_count_pos = avio_tell(pb);
>  metadata_count = 4 * !!flv->video_par +
>   5 * !!flv->audio_par +
> - 1 * !!flv->data_par  +
> - 2; // +2 for duration and file size
> + 1 * !!flv->data_par;
>  
>  avio_wb32(pb, metadata_count);
>  
> -put_amf_string(pb, "duration");
> -flv->duration_offset = avio_tell(pb);
> -
> -// fill in the guessed duration, it'll be corrected later if incorrect
> -put_amf_double(pb, s->duration / AV_TIME_BASE);
> +if (!(flv->flags & FLV_LIVE_STREAM)) {
> +put_amf_string(pb, "duration");
> +flv->duration_offset = avio_tell(pb);
>  
> +// fill in the guessed duration, it'll be corrected later if 
> incorrect
> +put_amf_double(pb, s->duration / AV_TIME_BASE);
> +metadata_count++;
> +}
>  if (flv->video_par) {
>  put_amf_string(pb, "width");
>  put_amf_double(pb, flv->video_par->width);
> @@ -319,10 +321,12 @@ static void write_metadata(AVFormatContext *s, unsigned 
> int ts)
>  metadata_count++;
>  }
>  
> -put_amf_string(pb, "filesize");
> -flv->filesize_offset = avio_tell(pb);
> -put_amf_double(pb, 0); // delayed write
> -
> +if (!(flv->flags & FLV_LIVE_STREAM)) {
> +put_amf_string(pb, "filesize");
> +flv->filesize_offset = avio_tell(pb);
> +put_amf_double(pb, 0); // delayed write
> +metadata_count++
> +}
>  put_amf_string(pb, "");
>  avio_w8(pb, AMF_END_OF_OBJECT);
>  
> @@ -543,16 +547,19 @@ static int flv_write_trailer(AVFormatContext *s)
>  
>  file_size = avio_tell(pb);
>  
> -/* update information */
> -if (avio_seek(pb, flv->duration_offset, SEEK_SET) < 0)
> -av_log(s, AV_LOG_WARNING, "Failed to update header with correct 
> duration.\n");
> -else
> -put_amf_double(pb, flv->duration / (double)1000);
> -if (avio_seek(pb, flv->filesize_offset, SEEK_SET) < 0)
> -av_log(s, AV_LOG_WARNING, "Failed to update header with correct 
> filesize.\n");
> -else
> -put_amf_double(pb, file_size);
> -
> +if (!(flv->flags & FLV_LIVE_STREAM)) {
> +/* update information */
> +if (avio_seek(pb, flv->duration_offset, SEEK_SET) < 0) {
> +av_log(s, AV_LOG_WARNING, "Failed to update header with correct 
> duration.\n");
> +} else {
> +put_amf_double(pb, flv->duration / (double)1000);
> +}
> +if (avio_seek(pb, flv->filesize_offset, SEEK_SET) < 0) {
> +av_log(s, AV_LOG_WARNING, "Failed to update header with correct 
> filesize.\n");
> +} else {
> +put_amf_double(pb, file_size);
> +}
> +}
>  avio_seek(pb, file_size, SEEK_SET);
>  return 0;
>  }

> @@ -729,6 +736,7 @@ static const AVOption options[] = {
>  { "flvflags", "FLV muxer flags", offsetof(FLVContext, flags), 
> AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, 

[FFmpeg-devel] [PATCH]lavf/aiffdec: Default to full rate qcelp as QT does.

2016-09-29 Thread Carl Eugen Hoyos
Hi!

Attached patch allows playback of some qcelp aiff files, 
just as QT plays them.

Please comment, Carl Eugen
From 66829d7a98aa87ff685a728d01b41be697c8de8a Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Thu, 29 Sep 2016 17:36:38 +0200
Subject: [PATCH] lavf/aiffdec: Default to full rate qcelp as QT does.

---
 libavformat/aiffdec.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 9bff565..cd916f9 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -337,7 +337,10 @@ static int aiff_read_header(AVFormatContext *s)
 }
 
 got_sound:
-if (!st->codecpar->block_align) {
+if (!st->codecpar->block_align && st->codecpar->codec_id == 
AV_CODEC_ID_QCELP) {
+av_log(s, AV_LOG_WARNING, "qcelp without wave chunk, assuming full 
rate\n");
+st->codecpar->block_align = 35;
+} else if (!st->codecpar->block_align) {
 av_log(s, AV_LOG_ERROR, "could not find COMM tag or invalid 
block_align value\n");
 return -1;
 }
-- 
1.7.10.4

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


[FFmpeg-devel] [PATCH]lavf/aiffenc: Write extradata also for qcelp.

2016-09-29 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes ticket #4009.

Please comment, Carl Eugen
From 6dd591f72775785dfd8e3109aa0933c0017dc843 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Thu, 29 Sep 2016 17:31:16 +0200
Subject: [PATCH] lavf/aiffenc: Write extradata also for qcelp.

Fixes ticket #4009.
---
 libavformat/aiffenc.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index d876997..74b778b 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -185,7 +185,8 @@ static int aiff_write_header(AVFormatContext *s)
 avio_wb16(pb, 0);
 }
 
-if (par->codec_tag == MKTAG('Q','D','M','2') && par->extradata_size) {
+if (  (par->codec_tag == MKTAG('Q','D','M','2')
+|| par->codec_tag == MKTAG('Q','c','l','p')) && par->extradata_size) {
 ffio_wfourcc(pb, "wave");
 avio_wb32(pb, par->extradata_size);
 avio_write(pb, par->extradata, par->extradata_size);
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/tee: Copy interrupt callback and flags to slave

2016-09-29 Thread Jan Sebechlebsky

On 09/29/2016 09:03 AM, Nicolas George wrote:


L'octidi 8 vendémiaire, an CCXXV, sebechlebsky...@gmail.com a écrit :

From: Jan Sebechlebsky 

Copy interrupt callback to slave format context to allow
user to interrupt IO. Copy format flags as well.

Signed-off-by: Jan Sebechlebsky 
---
  libavformat/tee.c | 2 ++
  1 file changed, 2 insertions(+)

LGTM, thanks.

Regards,


Applied

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


[FFmpeg-devel] [PATCH]lavf/matroskaenc: Always write V_QUICKTIME extradata.

2016-09-29 Thread Carl Eugen Hoyos
Hi!

Attached patch should fix ticket #5872.

Please comment, Carl Eugen
From 46e8d6919abdeb3d6153878fc815de9202b7eec1 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Thu, 29 Sep 2016 16:23:14 +0200
Subject: [PATCH] lavf/matroskaenc: Always write V_QUICKTIME extradata.

Fixes ticket #5872.
---
 libavformat/matroskaenc.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 3eeb09b..f2896a5 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -683,9 +683,8 @@ static int mkv_write_codecprivate(AVFormatContext *s, 
AVIOContext *pb,
 if (!par->codec_tag)
 par->codec_tag = ff_codec_get_tag(ff_codec_movvideo_tags,
 par->codec_id);
-if (par->extradata_size) {
 if (   ff_codec_get_id(ff_codec_movvideo_tags, par->codec_tag) 
== par->codec_id
-&& ff_codec_get_id(ff_codec_movvideo_tags, 
AV_RL32(par->extradata + 4)) != par->codec_id
+&& (!par->extradata_size || 
ff_codec_get_id(ff_codec_movvideo_tags, AV_RL32(par->extradata + 4)) != 
par->codec_id)
 ) {
 int i;
 avio_wb32(dyn_cp, 0x5a + par->extradata_size);
@@ -694,7 +693,6 @@ static int mkv_write_codecprivate(AVFormatContext *s, 
AVIOContext *pb,
 avio_w8(dyn_cp, 0);
 }
 avio_write(dyn_cp, par->extradata, par->extradata_size);
-}
 } else {
 if (!ff_codec_get_tag(ff_codec_bmp_tags, par->codec_id))
 av_log(s, AV_LOG_WARNING, "codec %s is not supported by this 
format\n",
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH]lavf/movenc: Put correct display aspect ratio in ARES atom

2016-09-29 Thread Carl Eugen Hoyos
2016-09-19 13:28 GMT+02:00 Carl Eugen Hoyos :

> We read a display aspect ratio from ARES atom because of several
> user-provided samples, I believe it makes sense to also write the
> width value into the ares atom depending on the aspect ratio.

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


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-29 Thread Carl Eugen Hoyos
2016-09-23 1:08 GMT+02:00 Paul B Mahol :

>> Log message changed locally to "lavf/mov: Read display
>> aspect ratio from ares atom also for dnxhd."
>
> LGTM

Patch applied.

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


[FFmpeg-devel] [PATCH] avformat/flvenc: add flv live stream flag

2016-09-29 Thread Steven Liu
patch update

merge 1/2 and 2/2 into one patch


0001-avformat-flvenc-add-flv-live-stream-flag.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/4] lavc/libmp3lame: set trailing_padding after flushing encoder

2016-09-29 Thread Carl Eugen Hoyos
2016-09-28 20:21 GMT+02:00 Jon Toohill :
> On Tue, Sep 27, 2016 at 1:04 AM, Carl Eugen Hoyos 
> wrote:
>
>> 2016-09-26 19:13 GMT+02:00 Jon Toohill > >:
>>
>> > +avctx->trailing_padding = FFMAX(lame_get_encoder_padding(s->gfp)
>> - 528 - 1, 0);
>>
>> Can you confirm that this function exists in lame 3.98.3?
>>
>
> I downloaded the source tarball for lame 3.98 and found it exists there. Is
> that sufficient?

Definitely, I just wanted to make sure.

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


Re: [FFmpeg-devel] [PATCH 2/2] doc/muxers: add flvenc living_stream flag doc

2016-09-29 Thread Carl Eugen Hoyos
Why is this a separate patch?

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/flvenc: add flv living stream flag

2016-09-29 Thread Carl Eugen Hoyos
2016-09-29 11:56 GMT+02:00 Steven Liu :

 > +FLV_LIVING_STREAM = (1 << 2),

Should this be FLV_LIVE_STREAM?

> -if (avio_seek(pb, flv->duration_offset, SEEK_SET) < 0)
> -av_log(s, AV_LOG_WARNING, "Failed to update header with correct 
> duration.\n");
> -else
> -put_amf_double(pb, flv->duration / (double)1000);
> -if (avio_seek(pb, flv->filesize_offset, SEEK_SET) < 0)
> -av_log(s, AV_LOG_WARNING, "Failed to update header with correct 
> filesize.\n");
> -else
> -put_amf_double(pb, file_size);

If you reindent these lines, please add a few braces.

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/flvenc: add flv living stream flag

2016-09-29 Thread Steven Liu
2016-09-29 11:20 GMT+08:00 Steven Liu :

>
> patch update


0001-avformat-flvenc-add-flv-living-stream-flag.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] movenc: Add support for writing language codes into ISML manifests

2016-09-29 Thread Josh de Kock

On 26/09/2016 23:10, Jan Ekström wrote:

Streaming servers appear to ignore all other language metadata.

Signed-off-by: Jan Ekström 
---
 libavformat/movenc.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index d5ed1dd..28edb18 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3611,6 +3611,9 @@ static int mov_write_isml_manifest(AVIOContext *pb, 
MOVMuxContext *mov, AVFormat
 const char *type;
 int track_id = track->track_id;

+AVStream *st = track->st;
+AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", 
NULL,0);
+
 if (track->par->codec_type == AVMEDIA_TYPE_VIDEO) {
 type = "video";
 } else if (track->par->codec_type == AVMEDIA_TYPE_AUDIO) {
@@ -3630,6 +3633,7 @@ static int mov_write_isml_manifest(AVIOContext *pb, 
MOVMuxContext *mov, AVFormat
 (int64_t)manifest_bit_rate);
 param_write_int(pb, "systemBitrate", manifest_bit_rate);
 param_write_int(pb, "trackID", track_id);
+param_write_string(pb, "systemLanguage", lang ? lang->value : "und");
 if (track->par->codec_type == AVMEDIA_TYPE_VIDEO) {
 if (track->par->codec_id == AV_CODEC_ID_H264) {
 uint8_t *ptr;



Thanks, applied.

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/tee: Copy interrupt callback and flags to slave

2016-09-29 Thread Nicolas George
L'octidi 8 vendémiaire, an CCXXV, sebechlebsky...@gmail.com a écrit :
> From: Jan Sebechlebsky 
> 
> Copy interrupt callback to slave format context to allow
> user to interrupt IO. Copy format flags as well.
> 
> Signed-off-by: Jan Sebechlebsky 
> ---
>  libavformat/tee.c | 2 ++
>  1 file changed, 2 insertions(+)

LGTM, thanks.

Regards,

-- 
  Nicolas George


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