Re: [FFmpeg-devel] [PATCH v10 3/6] avformat/flvenc: support mux av1 in enhanced flv

2023-06-01 Thread Tristan Matthews
On Mon, May 15, 2023 at 4:43 AM Steven Liu  wrote:
>
> Signed-off-by: Steven Liu 
> ---
>  libavformat/Makefile |  2 +-
>  libavformat/flvenc.c | 22 ++
>  2 files changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 1ef3d15467..c868e1626c 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -214,7 +214,7 @@ OBJS-$(CONFIG_FLAC_MUXER)+= flacenc.o 
> flacenc_header.o \
>  OBJS-$(CONFIG_FLIC_DEMUXER)  += flic.o
>  OBJS-$(CONFIG_FLV_DEMUXER)   += flvdec.o
>  OBJS-$(CONFIG_LIVE_FLV_DEMUXER)  += flvdec.o
> -OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o
> +OBJS-$(CONFIG_FLV_MUXER) += flvenc.o avc.o hevc.o av1.o
>  OBJS-$(CONFIG_FOURXM_DEMUXER)+= 4xm.o
>  OBJS-$(CONFIG_FRAMECRC_MUXER)+= framecrcenc.o framehash.o
>  OBJS-$(CONFIG_FRAMEHASH_MUXER)   += hashenc.o framehash.o
> diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> index 35e198fa15..c1784b332d 100644
> --- a/libavformat/flvenc.c
> +++ b/libavformat/flvenc.c
> @@ -28,6 +28,7 @@
>  #include "libavcodec/mpeg4audio.h"
>  #include "avio.h"
>  #include "avc.h"
> +#include "av1.h"
>  #include "hevc.h"
>  #include "avformat.h"
>  #include "flv.h"
> @@ -48,6 +49,7 @@ static const AVCodecTag flv_video_codec_ids[] = {
>  { AV_CODEC_ID_VP6A, FLV_CODECID_VP6A },
>  { AV_CODEC_ID_H264, FLV_CODECID_H264 },
>  { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') },
> +{ AV_CODEC_ID_AV1,  MKBETAG('a', 'v', '0', '1') },
>  { AV_CODEC_ID_NONE, 0 }
>  };
>
> @@ -491,7 +493,8 @@ static void flv_write_codec_header(AVFormatContext* s, 
> AVCodecParameters* par, i
>  FLVContext *flv = s->priv_data;
>
>  if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264
> -|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
> AV_CODEC_ID_HEVC) {
> +|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
> AV_CODEC_ID_HEVC
> +|| par->codec_id == AV_CODEC_ID_AV1) {
>  int64_t pos;
>  avio_w8(pb,
>  par->codec_type == AVMEDIA_TYPE_VIDEO ?
> @@ -537,6 +540,9 @@ static void flv_write_codec_header(AVFormatContext* s, 
> AVCodecParameters* par, i
>  if (par->codec_id == AV_CODEC_ID_HEVC) {
>  avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart); // 
> ExVideoTagHeader mode with PacketTypeSequenceStart
>  avio_write(pb, "hvc1", 4);
> +} else if (par->codec_id == AV_CODEC_ID_AV1) {
> +avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeSequenceStart);
> +avio_write(pb, "av01", 4);
>  } else {
>  avio_w8(pb, par->codec_tag | FLV_FRAME_KEY); // flags
>  avio_w8(pb, 0); // AVC sequence header
> @@ -545,6 +551,8 @@ static void flv_write_codec_header(AVFormatContext* s, 
> AVCodecParameters* par, i
>
>  if (par->codec_id == AV_CODEC_ID_HEVC)
>  ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 
> 0);
> +else if (par->codec_id == AV_CODEC_ID_AV1)
> +ff_isom_write_av1c(pb, par->extradata, par->extradata_size, 
> 1);
>  else
>  ff_isom_write_avcc(pb, par->extradata, par->extradata_size);
>  }
> @@ -843,13 +851,15 @@ static int flv_write_packet(AVFormatContext *s, 
> AVPacket *pkt)
>  if (par->codec_id == AV_CODEC_ID_VP6F || par->codec_id == 
> AV_CODEC_ID_VP6A ||
>  par->codec_id == AV_CODEC_ID_VP6  || par->codec_id == 
> AV_CODEC_ID_AAC)
>  flags_size = 2;
> -else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == 
> AV_CODEC_ID_MPEG4 || par->codec_id == AV_CODEC_ID_HEVC)
> +else if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == 
> AV_CODEC_ID_MPEG4 ||
> + par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == 
> AV_CODEC_ID_AV1)
>  flags_size = 5;
>  else
>  flags_size = 1;
>
>  if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264
> -|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
> AV_CODEC_ID_HEVC) {
> +|| par->codec_id == AV_CODEC_ID_MPEG4 || par->codec_id == 
> AV_CODEC_ID_HEVC
> +|| par->codec_id == AV_CODEC_ID_AV1) {
>  size_t side_size;
>  uint8_t *side = av_packet_get_side_data(pkt, 
> AV_PKT_DATA_NEW_EXTRADATA, _size);
>  if (side && side_size > 0 && (side_size != par->extradata_size || 
> memcmp(side, par->extradata, side_size))) {
> @@ -869,7 +879,8 @@ static int flv_write_packet(AVFormatContext *s, AVPacket 
> *pkt)
> "Packets are not in the proper order with respect to DTS\n");
>  return AVERROR(EINVAL);
>  }
> -if (par->codec_id == AV_CODEC_ID_H264 || par->codec_id == 
> AV_CODEC_ID_MPEG4 || par->codec_id == 

Re: [FFmpeg-devel] [PATCH v10 0/6] Support enhanced flv in FFmpeg

2023-06-01 Thread Steven Liu
Tristan Matthews  于2023年6月2日周五 01:58写道:
>
> On Thu, Jun 1, 2023 at 2:08 AM Steven Liu  wrote:
> >
> > Tristan Matthews  于2023年6月1日周四 13:03写道:
> > >
> > > > you can publish hevc, av1 or vp9 codec stream to Youtube over rtmp.
> > >
> > > Were you able to push av1 or vp9 to Youtube with this patchset alone?
> > I've tested push them after after this patchset, do you mean you get
> > some problems after this patchset?
>
> Yeah for me at least vp9 and av1 are falling over when I try to push
> to youtube over RTMP, I was under the impression that beyond patching
> the FLV muxer you'd also need to add a `fourCcList` to the connect
> command of the rtmp muxer (see "Extending NetConnection connect
> command" of 
> https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf).
>
> In any case that's not really the scope of this patchset and I don't
> want to derail the discussion, muxing to an flv file works fine. I
> just wanted to clarify what was possible with these changes and I'm
> surprised that you were able to push to youtube live with this given
> the above, as I am not.
I tested publish the two codecs type, av1,vp9 to youtube, and i can
play by youtube player, but i saw the stream info always is vp9 in
flv.

Thanks
Steven
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/3] avcodec/cbs_av1: Clear obu.metadata on error

2023-06-01 Thread James Almer

On 6/1/2023 9:28 PM, Andreas Rheinhardt wrote:

1. Before 97f4263, the current_obu was reset (and the packet effectively
discarded) upon errors from ff_cbs_read_packet(); yet this is no longer
true and it seems that the contents of current_obu will be processed in
the next call to av1_receive_frame(). This change seems to have been
unintentional.


I guess I assumed that ff_cbs_read_packet() failing would clear the 
CodedBitstreamFragment before returning, but if that's not the case then 
ff_cbs_fragment_reset() should be called.


Would something like


diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 5cc5d87c64..d1a0f6eaa2 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -1461,6 +1461,7 @@ static int av1_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
 ret = ff_cbs_read_packet(s->cbc, >current_obu, s->pkt);
 if (ret < 0) {
 av_packet_unref(s->pkt);
+ff_cbs_fragment_reset(>current_obu);
 av_log(avctx, AV_LOG_ERROR, "Failed to read packet.\n");
 return ret;
 }


Be enough?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/3] avcodec/cbs_av1: Clear obu.metadata on error

2023-06-01 Thread Andreas Rheinhardt
Michael Niedermayer:
> On error pointers can be left NULL while code later assumes these not to be 
> NULL
> 
> Fixes: NULL pointer dereference
> Fixes: 
> 59359/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-6726080594313216
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/cbs_av1.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
> index 8788fee099..7f3f4da2f5 100644
> --- a/libavcodec/cbs_av1.c
> +++ b/libavcodec/cbs_av1.c
> @@ -1013,8 +1013,10 @@ static int cbs_av1_read_unit(CodedBitstreamContext 
> *ctx,
>  case AV1_OBU_METADATA:
>  {
>  err = cbs_av1_read_metadata_obu(ctx, , >obu.metadata);
> -if (err < 0)
> +if (err < 0) {
> +memset(>obu.metadata, 0, sizeof(obu->obu.metadata));
>  return err;
> +}
>  }
>  break;
>  case AV1_OBU_PADDING:

1. Before 97f4263, the current_obu was reset (and the packet effectively
discarded) upon errors from ff_cbs_read_packet(); yet this is no longer
true and it seems that the contents of current_obu will be processed in
the next call to av1_receive_frame(). This change seems to have been
unintentional.
2. The commit message is weird: You claim that it is bad that a pointer
is NULL; and then you go on and zero it again. It would be better to
claim that the metadata is in an inconsistent state.
3. There is a possibility for inconsistency in cbs_av1_syntax_template,
namely if the allocation fails, metadata OBU nevertheless claims to have
a payload_size > 0; payload_size should only be set after the allocation
succeeded. But this does not seem to be the issue in this testcase.
Presumably there are not enough bits left for the itu_t_t35_country_code
or its extension? In this case, cbs_av1 did not even make an error.
4. Your fix is dangerous: In case the code were changed so that an error
can happen after a successful allocation, your memset would lead to
leaks. (The most likely possibility is the addition of a new type of
metadata; another way would be for the code to be changed to avoid
reading the metadata twice by reallocating (and overallocating) the
buffer as needed.)

- Andreas

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] metadata (.m4a): tag 'tmpo' is not handled

2023-06-01 Thread Brad Lanam
Likewise for MP3 / metadata tag UFID.

On Thu, Jun 1, 2023 at 11:48 AM Brad Lanam 
wrote:

> Versions:
>  Linux: 4.3.6-0+deb11u1
>  Windows: 5.1.2-full_build-www.gyan.dev
>
> The 'tmpo' metadata tag within a .m4a audio file is not recognized by
> ffmpeg and is never processed or output.   Neither the command line
> interface nor the api returns this tag.
>
> References:
> https://picard-docs.musicbrainz.org/en/appendices/tag_mapping.html
> (under BPM)
>
> Apologies if this has already been fixed.
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 3/3] avcodec/mpeg4videodec: more unsigned in amv computation

2023-06-01 Thread Michael Niedermayer
Fixes: signed integer overflow: -2147483648 + -1048576 cannot be represented in 
type 'int'
Fixes: 
59365/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-642654923954585

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

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index d456e5dd11..72c8ad3048 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -861,7 +861,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n)
 for (y = 0; y < 16; y++) {
 int v;
 
-v = mb_v + dy * y;
+v = mb_v + (unsigned)dy * y;
 // FIXME optimize
 for (x = 0; x < 16; x++) {
 sum += v >> shift;
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/3] avcodec/cbs_av1: Clear obu.metadata on error

2023-06-01 Thread Michael Niedermayer
On error pointers can be left NULL while code later assumes these not to be NULL

Fixes: NULL pointer dereference
Fixes: 
59359/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-6726080594313216

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

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index 8788fee099..7f3f4da2f5 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -1013,8 +1013,10 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx,
 case AV1_OBU_METADATA:
 {
 err = cbs_av1_read_metadata_obu(ctx, , >obu.metadata);
-if (err < 0)
+if (err < 0) {
+memset(>obu.metadata, 0, sizeof(obu->obu.metadata));
 return err;
+}
 }
 break;
 case AV1_OBU_PADDING:
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/3] tools/target_dec_fuzzer: adjust threshold for RKA

2023-06-01 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
59349/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RKA_fuzzer-5334280839233536

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 tools/target_dec_fuzzer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 1dbdad50b6..b82efc01b0 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -272,7 +272,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_QTRLE:   maxpixels  /= 16;break;
 case AV_CODEC_ID_PAF_VIDEO:   maxpixels  /= 16;break;
 case AV_CODEC_ID_PRORES:  maxpixels  /= 256;   break;
-case AV_CODEC_ID_RKA: maxsamples /= 256;   break;
+case AV_CODEC_ID_RKA: maxsamples /= 65536; break;
 case AV_CODEC_ID_RSCC:maxpixels  /= 256;   break;
 case AV_CODEC_ID_RASC:maxpixels  /= 16;break;
 case AV_CODEC_ID_SANM:maxpixels  /= 16;break;
-- 
2.17.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avdevice/lavfi: fix crash on unconnected outpads

2023-06-01 Thread Paul B Mahol
On Thu, Jun 1, 2023 at 12:14 PM metamuffin  wrote:

> Nameless outpads would cause an invocation to sscanf with NULL.
> Example: ffmpeg -f lavfi -i 'nullsrc;nullsrc' -
> Changed to throwing an error instead.
>

See:

https://git.videolan.org/?p=ffmpeg.git;a=commit;h=5ce76506de1a7fbaf91af47a925d5ecfe13ae59c

Perhaps needs backporting to first introduction.


> ---
>  libavdevice/lavfi.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
> index 9c1fcf334b..21f33ade0e 100644
> --- a/libavdevice/lavfi.c
> +++ b/libavdevice/lavfi.c
> @@ -174,6 +174,11 @@ av_cold static int lavfi_read_header(AVFormatContext
> *avctx)
>   * create a mapping between them and the streams */
>  for (i = 0, inout = output_links; inout; i++, inout = inout->next) {
>  int stream_idx = 0, suffix = 0, use_subcc = 0;
> +if (!inout->name) {
> +av_log(avctx,  AV_LOG_ERROR,
> +   "Filtergraph has nameless outpads\n");
> +FAIL(AVERROR(EINVAL));
> +}
>  sscanf(inout->name, "out%n%d%n", , _idx, );
>  if (!suffix) {
>  av_log(avctx,  AV_LOG_ERROR,
> --
> 2.40.1
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2] avformat/http: copy only mime type from Content-Type

2023-06-01 Thread Kacper Michajłow
Content-Type can include charset and boundary which is not a part of
mime type and shouldn't be copied as such.

Fixes HLS playback when the Content-Type includes additional fields.

Signed-off-by: Kacper Michajłow 
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 0817aafb5b..fd931c2d8e 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1205,7 +1205,7 @@ static int process_line(URLContext *h, char *line, int 
line_count)
 }
 } else if (!av_strcasecmp(tag, "Content-Type")) {
 av_free(s->mime_type);
-s->mime_type = av_strdup(p);
+s->mime_type = av_get_token((const char **), ";");
 } else if (!av_strcasecmp(tag, "Set-Cookie")) {
 if (parse_cookie(s, p, >cookie_dict))
 av_log(h, AV_LOG_WARNING, "Unable to parse '%s'\n", p);
-- 
2.34.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v10 0/6] Support enhanced flv in FFmpeg

2023-06-01 Thread Tristan Matthews
On Thu, Jun 1, 2023 at 2:08 AM Steven Liu  wrote:
>
> Tristan Matthews  于2023年6月1日周四 13:03写道:
> >
> > > you can publish hevc, av1 or vp9 codec stream to Youtube over rtmp.
> >
> > Were you able to push av1 or vp9 to Youtube with this patchset alone?
> I've tested push them after after this patchset, do you mean you get
> some problems after this patchset?

Yeah for me at least vp9 and av1 are falling over when I try to push
to youtube over RTMP, I was under the impression that beyond patching
the FLV muxer you'd also need to add a `fourCcList` to the connect
command of the rtmp muxer (see "Extending NetConnection connect
command" of 
https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf).

In any case that's not really the scope of this patchset and I don't
want to derail the discussion, muxing to an flv file works fine. I
just wanted to clarify what was possible with these changes and I'm
surprised that you were able to push to youtube live with this given
the above, as I am not.

Best,
-t

>
>
> Thanks
> Steven
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avformat/http: copy only mime type from Content-Type

2023-06-01 Thread Kacper Michajłow
Content-Type can include charset and boundary which is not a part of
mime type and shouldn't be copied as such.

Fixes HLS playback when the Content-Type includes additional fields.

Signed-off-by: Kacper Michajłow 
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 0817aafb5b..378b90c52b 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1205,7 +1205,7 @@ static int process_line(URLContext *h, char *line, int 
line_count)
 }
 } else if (!av_strcasecmp(tag, "Content-Type")) {
 av_free(s->mime_type);
-s->mime_type = av_strdup(p);
+s->mime_type = av_get_token(, ";");
 } else if (!av_strcasecmp(tag, "Set-Cookie")) {
 if (parse_cookie(s, p, >cookie_dict))
 av_log(h, AV_LOG_WARNING, "Unable to parse '%s'\n", p);
-- 
2.34.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] MXF - Add jpeg2000 subdescriptor - Sponsored by INA

2023-06-01 Thread Cédric Le Barz


Le 09/05/2023 à 16:28, Pierre-Anthony Lemieux a écrit :

Couple of follow-up comments.

- "mxf_parse_jpeg2000_frame" could be moved to one of jpeg2000 source
files, to keep J2K parsing code together. Maybe there is a way to
reuse jpeg2000_read_main_headers() at jpeg2000dec.c?

- when defining the J2K descriptor items, please refer to the symbol
name from the SMPTE registers, it make following/debugging the code a
lot easier:

{ 0x8405,
{0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0a,0x04,0x01,0x06,0x03,0x05,0x00,0x0
0,0x00}},
/* Vertical offset from the origin of the reference grid to the left
side of the image area */

becomes

{ 0x8405,
{0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0a,0x04,0x01,0x06,0x03,0x05,0x00,0x0
0,0x00}},
/* YOsiz: vertical offset from the origin of the reference grid to the
left side of the image area */
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org  with subject "unsubscribe".



Attach to this mail, is my new patch for adding jpeg2000 sub-descriptor 
in MXF file  taking into account remarks from FFmpeg community (remarks 
from Pierre-Anthony above as well as this from Tomas), i.e. :


1 - When there is a mismatch in components number, this is now process 
as an error.


2 - When defining and using the J2K descriptor items, I now refer to the 
symbol name from the SMPTE registers (X0siz, XT0siz...)


3 - As suggested, I make use of  jpeg2000_read_main_headers() in 
libavcodec. But, I let the parsing function in mxfenc.c file as all 
other parsing functions are in this file (mxf_parse_mpeg2_frame, 
mxf_parse_h264_frame...). The use of jpeg2000_read_main_headers() in 
mxfenc implies some minor modifications in jpeg2000 files :


* rename of Jpeg2000Tile structure to J2kTile in j2kenc.c (to avoid 
redefinition)


* move some structure declarations from jpeg2000dec.c to jpeg2000.h

* make jpeg2000_read_main_headers() function "public"


Regards,


Cédric
--- Begin Message ---
Signed-off-by: Cedric Le Barz 
---
 ffmpeg/libavcodec/j2kenc.c  |  28 +++---
 ffmpeg/libavcodec/jpeg2000.h|  90 +
 ffmpeg/libavcodec/jpeg2000dec.c |  89 +
 ffmpeg/libavformat/mxf.h|   1 +
 ffmpeg/libavformat/mxfenc.c | 169 +++-
 5 files changed, 273 insertions(+), 104 deletions(-)

diff --git a/ffmpeg/libavcodec/j2kenc.c b/ffmpeg/libavcodec/j2kenc.c
index 6406f90..f5178d7 100644
--- a/ffmpeg/libavcodec/j2kenc.c
+++ b/ffmpeg/libavcodec/j2kenc.c
@@ -106,7 +106,7 @@ static const int dwt_norms[2][4][10] = { // 
[dwt_type][band][rlevel] (multiplied
 typedef struct {
Jpeg2000Component *comp;
double *layer_rates;
-} Jpeg2000Tile;
+} J2kTile;
 
 typedef struct {
 AVClass *class;
@@ -131,7 +131,7 @@ typedef struct {
 Jpeg2000CodingStyle codsty;
 Jpeg2000QuantStyle  qntsty;
 
-Jpeg2000Tile *tile;
+J2kTile *tile;
 int layer_rates[100];
 uint8_t compression_rate_enc; ///< Is compression done using compression 
ratio?
 
@@ -171,7 +171,7 @@ static void dump(Jpeg2000EncoderContext *s, FILE *fd)
 s->width, s->height, s->tile_width, s->tile_height,
 s->numXtiles, s->numYtiles, s->ncomponents);
 for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++){
-Jpeg2000Tile *tile = s->tile + tileno;
+J2kTile *tile = s->tile + tileno;
 nspaces(fd, 2);
 fprintf(fd, "tile %d:\n", tileno);
 for(compno = 0; compno < s->ncomponents; compno++){
@@ -427,7 +427,7 @@ static void compute_rates(Jpeg2000EncoderContext* s)
 int layno, compno;
 for (i = 0; i < s->numYtiles; i++) {
 for (j = 0; j < s->numXtiles; j++) {
-Jpeg2000Tile *tile = >tile[s->numXtiles * i + j];
+J2kTile *tile = >tile[s->numXtiles * i + j];
 for (compno = 0; compno < s->ncomponents; compno++) {
 int tilew = tile->comp[compno].coord[0][1] - 
tile->comp[compno].coord[0][0];
 int tileh = tile->comp[compno].coord[1][1] - 
tile->comp[compno].coord[1][0];
@@ -460,12 +460,12 @@ static int init_tiles(Jpeg2000EncoderContext *s)
 s->numXtiles = ff_jpeg2000_ceildiv(s->width, s->tile_width);
 s->numYtiles = ff_jpeg2000_ceildiv(s->height, s->tile_height);
 
-s->tile = av_calloc(s->numXtiles, s->numYtiles * sizeof(Jpeg2000Tile));
+s->tile = av_calloc(s->numXtiles, s->numYtiles * sizeof(J2kTile));
 if (!s->tile)
 return AVERROR(ENOMEM);
 for (tileno = 0, tiley = 0; tiley < s->numYtiles; tiley++)
 for (tilex = 0; tilex < s->numXtiles; tilex++, tileno++){
-Jpeg2000Tile *tile = s->tile + tileno;
+J2kTile *tile = s->tile + tileno;
 
 tile->comp = av_calloc(s->ncomponents, sizeof(*tile->comp));
 if (!tile->comp)
@@ -509,7 +509,7 @@ static int init_tiles(Jpeg2000EncoderContext *s)
 

[FFmpeg-devel] [PATCH] Fix failure to initialize ddagrab if adapter ID is specified

2023-06-01 Thread Jøger Hansegård
>From dd7208b1edd0d7efcde1a12fd468a180737ad9cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B8ger=20Hanseg=C3=A5rd?= 
Date: Thu, 1 Jun 2023 15:30:48 +0200
Subject: [PATCH] Fix failure to initialize ddagrab if adapter ID is specified

If an adapter ID is specified when initializing hw device for d3d11va,
ddagrab does not work on Windows 11. This prevents capturing screens
connected to a secondary adapter.

Failing command:
ffmpeg -init_hw_device d3d11va:0 -filter_complex 
ddagrab=0,hwdownload,format=bgra -c:v h264_mf output.mkv

The reason is that d3d11va_device_create uses CreateDXGIFactory to
create a DXGIFactory 1.0. This causes init_dxgi_dda's call to
IDXGIOutput5_DuplicateOutput1 to fail because it is only supported on
DXGI 1.1 and higher.

The fix is to always crate DXGI factory using CreateDXGIFactory1 as
proposed in this patch.

Fixes: #10385
---
 libavutil/hwcontext_d3d11va.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index aa50538d64..fa8d5410f2 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -62,7 +62,7 @@ static av_cold void load_functions(void)
 return;

 mD3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE) GetProcAddress(d3dlib, 
"D3D11CreateDevice");
-mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, 
"CreateDXGIFactory");
+mCreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY) GetProcAddress(dxgilib, 
"CreateDXGIFactory1");
 #else
 // In UWP (which lacks LoadLibrary), CreateDXGIFactory isn't available,
 // only CreateDXGIFactory1
--
2.40.1.windows.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 2/9] avcodec: add D3D12VA hardware accelerated H264 decoding

2023-06-01 Thread Wu, Tong1

>
>On Wed, May 31, 2023 at 11:07:15AM +0800, Tong Wu wrote:
>> From: Wu Jianhua 
>>
>> The implementation is based on:
>> https://learn.microsoft.com/en-us/windows/win32/medfound/direct3d-12-
>video-overview
>>
>> With the Direct3D 12 video decoding support, we can render or process
>> the decoded images by the pixel shaders or compute shaders directly
>> without the extra copy overhead, which is beneficial especially if you
>> are trying to render or post-process a 4K or 8K video.
>>
>> The command below is how to enable d3d12va:
>> ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4
>>
>> Signed-off-by: Wu Jianhua 
>> Signed-off-by: Tong Wu 
>> ---
>>  configure   |   2 +
>>  libavcodec/Makefile |   3 +
>>  libavcodec/d3d11va.h|   3 -
>>  libavcodec/d3d12va.c| 552 
>>  libavcodec/d3d12va.h| 184 
>>  libavcodec/d3d12va_h264.c   | 210 ++
>>  libavcodec/dxva2.c  |  24 ++
>>  libavcodec/dxva2.h  |   3 -
>>  libavcodec/dxva2_h264.c |  12 +-
>>  libavcodec/dxva2_internal.h |  69 +++--
>>  libavcodec/h264_slice.c |   4 +
>>  libavcodec/h264dec.c|   3 +
>>  libavcodec/hwaccels.h   |   1 +
>>  libavcodec/hwconfig.h   |   2 +
>>  14 files changed, 1030 insertions(+), 42 deletions(-)
>>  create mode 100644 libavcodec/d3d12va.c
>>  create mode 100644 libavcodec/d3d12va.h
>>  create mode 100644 libavcodec/d3d12va_h264.c
>
>seems to break build on mingw64 here

Thanks, will fix in V3.


> make
>CC libavcodec/dxva2.o
>In file included from src/libavcodec/dxva2.c:33:0:
>src/libavcodec/dxva2.c: In function ‘ff_dxva2_get_surface_index’:
>src/libavcodec/dxva2_internal.h:48:43: error: pasting "." and "surface_count"
>does not give a valid preprocessing token
> #define D3D11VA_VAR(ctx, var) ctx->d3d11va.##var
>   ^
>src/libavcodec/dxva2_internal.h:123:114: note: in expansion of macro
>‘D3D11VA_VAR’
> #define DXVA2_CONTEXT_VAR(avctx, ctx, var) (avctx->pix_fmt ==
>AV_PIX_FMT_D3D12 ? 0 : (ff_dxva2_is_d3d11(avctx) ? D3D11VA_VAR(ctx,
>var) :  DXVA2_VAR(ctx, var)))
>   
>^~~
>src/libavcodec/dxva2_internal.h:127:49: note: in expansion of macro
>‘DXVA2_CONTEXT_VAR’
> #define DXVA_CONTEXT_COUNT(avctx, ctx)  DXVA2_CONTEXT_VAR(avctx,
>ctx, surface_count)
> ^
>src/libavcodec/dxva2.c:791:21: note: in expansion of macro
>‘DXVA_CONTEXT_COUNT’
> for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) {
> ^
>In file included from src/libavcodec/dxva2.c:33:0:
>src/libavcodec/dxva2_internal.h:40:39: error: pasting "." and "surface_count"
>does not give a valid preprocessing token
> #define DXVA2_VAR(ctx, var) ctx->dxva2.##var
>   ^
>src/libavcodec/dxva2_internal.h:123:139: note: in expansion of macro
>‘DXVA2_VAR’
> #define DXVA2_CONTEXT_VAR(avctx, ctx, var) (avctx->pix_fmt ==
>AV_PIX_FMT_D3D12 ? 0 : (ff_dxva2_is_d3d11(avctx) ? D3D11VA_VAR(ctx,
>var) :  DXVA2_VAR(ctx, var)))
>
>^
>src/libavcodec/dxva2_internal.h:127:49: note: in expansion of macro
>‘DXVA2_CONTEXT_VAR’
> #define DXVA_CONTEXT_COUNT(avctx, ctx)  DXVA2_CONTEXT_VAR(avctx,
>ctx, surface_count)
> ^
>src/libavcodec/dxva2.c:791:21: note: in expansion of macro
>‘DXVA_CONTEXT_COUNT’
> for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) {
> ^
>src/ffbuild/common.mak:81: recipe for target 'libavcodec/dxva2.o' failed
>make: *** [libavcodec/dxva2.o] Error 1
>
>[...]
>
>--
>Michael GnuPG fingerprint:
>9FF2128B147EF6730BADF133611EC787040B0FAB
>
>There will always be a question for which you do not know the correct answer.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] lavc/aarch64: new optimization for 8-bit hevc_pel_uni_w_pixels, qpel_uni_w_h, qpel_uni_w_v, qpel_uni_w_hv and qpel_h

2023-06-01 Thread Martin Storsjö

On Sun, 28 May 2023, Logan.Lyu wrote:



在 2023/5/28 12:36, Jean-Baptiste Kempf 写道:

Hello,

The last interaction still has the wrong name in patchset.

Thanks for reminding.  I modified the correct name in git.


Thanks, most of the issues in the patch seem to have been fixed - however 
there's one big breakage here. Also even if this is accepted, we'll have 
to wait for the dependency patches to be merged before these can go in 
though.


For restoring the saved registers on the stack, you currently have this:

ldp x19, x30, [sp]
ldp x26, x27, [sp, #16]
ldp x24, x25, [sp, #32]
ldp x22, x23, [sp, #48]
ldp x20, x21, [sp, #64]
add sp, sp, #80

You can avoid the extra add at the end by reordering them like this:

ldp x26, x27, [sp, #16]
ldp x24, x25, [sp, #32]
ldp x22, x23, [sp, #48]
ldp x20, x21, [sp, #64]
ldp x19, x30, [sp], #80

But the order/layout of the registers doesn't match how they are backed 
up. So when you run checkasm, you'll get these errors:


I8MM:
 - hevc_pel.qpel   [OK]
   put_hevc_qpel_uni_w_hv4_8_i8mm (failed to preserve register)
   put_hevc_qpel_uni_w_hv8_8_i8mm (failed to preserve register)
   put_hevc_qpel_uni_w_hv16_8_i8mm (failed to preserve register)
   put_hevc_qpel_uni_w_hv32_8_i8mm (failed to preserve register)
   put_hevc_qpel_uni_w_hv64_8_i8mm (failed to preserve register)
 - hevc_pel.qpel_uni_w [FAILED]
checkasm: 5 of 1136 tests have failed

It's easiest to make the epilogue a mirror copy of the prologue.

Please rerun checkasm on as system that does support i8mm when posting 
updated patches.


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/4] configure: aarch64: Support assembling the dotprod and i8mm arch extensions

2023-06-01 Thread Martin Storsjö

On Sun, 28 May 2023, Martin Storsjö wrote:

The documentation for .arch_extension hints at it being possible to disable 
support for extensions with it too, but that doesn't seem to be the case in 
practice. If it was, we could add macros to only enable specifically the 
extensions we want around those functions that should use them and nothing 
more. But I guess if that's not actually supported we can't do that.


Actually, yes, this does work, it just uses a different syntax than I 
expected. To disable the extension , one can write the directive 
".arch_extension no".


Is the updated, less complex version of the configure patch more 
tolerable?


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avdevice/lavfi: fix crash on unconnected outpads

2023-06-01 Thread metamuffin
Nameless outpads would cause an invocation to sscanf with NULL.
Example: ffmpeg -f lavfi -i 'nullsrc;nullsrc' -
Changed to throwing an error instead.
---
 libavdevice/lavfi.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index 9c1fcf334b..21f33ade0e 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -174,6 +174,11 @@ av_cold static int lavfi_read_header(AVFormatContext 
*avctx)
  * create a mapping between them and the streams */
 for (i = 0, inout = output_links; inout; i++, inout = inout->next) {
 int stream_idx = 0, suffix = 0, use_subcc = 0;
+if (!inout->name) {
+av_log(avctx,  AV_LOG_ERROR,
+   "Filtergraph has nameless outpads\n");
+FAIL(AVERROR(EINVAL));
+}
 sscanf(inout->name, "out%n%d%n", , _idx, );
 if (!suffix) {
 av_log(avctx,  AV_LOG_ERROR,
-- 
2.40.1

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v10 0/6] Support enhanced flv in FFmpeg

2023-06-01 Thread Jean-Baptiste Kempf
Hello,

On Thu, 1 Jun 2023, at 02:02, Steven Liu wrote:
> Neal Gompa  于2023年5月31日周三 13:47写道:
>>
>> On Mon, May 15, 2023 at 10:41 PM Neal Gompa  wrote:
>> >
>> > On Mon, May 15, 2023 at 4:32 AM Steven Liu  wrote:
>> > >
>> > > Reference file: 
>> > > https://github.com/veovera/enhanced-rtmp/blob/main/enhanced-rtmp-v1.pdf
>> > > The Enhanced flv has been supported by OBS, Simple Realtime Server, 
>> > > mpegts.js.
>> > > you can publish hevc, av1 or vp9 codec stream to Youtube over rtmp.
>> > > The enhanced flv documentation contributors include
>> > > Jean-Baptiste Kempf (FFmpeg, VideoLAN).
>> > > So this should be support by ffmpeg too.
>> > >
>> > > v8:
>> > > Support vp9 codec according to enhanced flv.
>> > > Support PacketTypeCodedFrames type for hevc in flv.
>> > > v9:
>> > > Add dependency codec object files for flvenc in Makefile.
>> > > Move the hevc,av1,vp9 codec out of FF_COMPLIANCE_UNOFFICIAL.
>> > >
>> > > v10:
>> > > modify first patch comment like the others before commit.
>> > > exheader mode should only happened in video stream this patchset.
>> > >
>> > > Steven Liu (6):
>> > >   avformat/flvenc: support mux hevc in enhanced flv
>> > >   avformat/flvdec: support demux hevc in enhanced flv
>> > >   avformat/flvenc: support mux av1 in enhanced flv
>> > >   avformat/flvdec: support demux av1 in enhanced flv
>> > >   avformat/flvenc: support mux vp9 in enhanced flv
>> > >   avformat/flvdec: support demux vp9 in enhanced flv
>> > >
>> > >  libavformat/Makefile |  2 +-
>> > >  libavformat/flv.h| 15 +
>> > >  libavformat/flvdec.c | 73 +++-
>> > >  libavformat/flvenc.c | 58 +--
>> > >  4 files changed, 130 insertions(+), 18 deletions(-)
>> > >
>> >
>> > This version works for me. Thanks for this work!
>> >
>> > Tested-by: Neal Gompa 
>> > Reviewed-by: Neal Gompa 
>> >
>>
>> Is this patch set going to get pushed to master anytime soon?
>
> Hi Neal,
>
> Waiting for j-b check about the Enhanced-FLV status, i cannot sure if
> this patch can be pushed now.

I've just re-asked what is the final status of the spec.

If you cannot wait, use experimental flags.

jb
-- 
Jean-Baptiste Kempf -  President
+33 672 704 734
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v10 0/6] Support enhanced flv in FFmpeg

2023-06-01 Thread Steven Liu
Tristan Matthews  于2023年6月1日周四 13:03写道:
>
> > you can publish hevc, av1 or vp9 codec stream to Youtube over rtmp.
>
> Were you able to push av1 or vp9 to Youtube with this patchset alone?
I've tested push them after after this patchset, do you mean you get
some problems after this patchset?


Thanks
Steven
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".