Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v3 2/2] lavf: add prores bitstream demuxer and muxer
@ 2023-07-26  9:28 hung kuishing
  2023-07-26 12:54 ` Derek Buitenhuis
  0 siblings, 1 reply; 7+ messages in thread
From: hung kuishing @ 2023-07-26  9:28 UTC (permalink / raw)
  To: ffmpeg-devel

Signed-off-by: clarkh <hungkuishing@outlook.com>
---
 libavformat/Makefile     |  2 ++
 libavformat/allformats.c |  2 ++
 libavformat/proresdec.c  | 66 ++++++++++++++++++++++++++++++++++++++++
 libavformat/rawenc.c     | 13 ++++++++
 4 files changed, 83 insertions(+)
 create mode 100644 libavformat/proresdec.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index bd78c206b9..16def0765b 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -480,6 +480,8 @@ OBJS-$(CONFIG_PDV_DEMUXER)               += pdvdec.o
 OBJS-$(CONFIG_PJS_DEMUXER)               += pjsdec.o subtitles.o
 OBJS-$(CONFIG_PMP_DEMUXER)               += pmpdec.o
 OBJS-$(CONFIG_PP_BNK_DEMUXER)            += pp_bnk.o
+OBJS-$(CONFIG_PRORES_DEMUXER)            += proresdec.o rawdec.o
+OBJS-$(CONFIG_PRORES_MUXER)              += rawenc.o
 OBJS-$(CONFIG_PVA_DEMUXER)               += pva.o
 OBJS-$(CONFIG_PVF_DEMUXER)               += pvfdec.o pcm.o
 OBJS-$(CONFIG_QCP_DEMUXER)               += qcp.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 6324952bd2..0b762034ca 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -378,6 +378,8 @@ extern const AVInputFormat  ff_pdv_demuxer;
 extern const AVInputFormat  ff_pjs_demuxer;
 extern const AVInputFormat  ff_pmp_demuxer;
 extern const AVInputFormat  ff_pp_bnk_demuxer;
+extern const AVInputFormat  ff_prores_demuxer;
+extern const FFOutputFormat ff_prores_muxer;
 extern const FFOutputFormat ff_psp_muxer;
 extern const AVInputFormat  ff_pva_demuxer;
 extern const AVInputFormat  ff_pvf_demuxer;
diff --git a/libavformat/proresdec.c b/libavformat/proresdec.c
new file mode 100644
index 0000000000..67f25b79ec
--- /dev/null
+++ b/libavformat/proresdec.c
@@ -0,0 +1,66 @@
+/*
+ * ProRes bitstream probe
+ * Copyright (c) 2023 clarkh <hungkuishing@outlook.com>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "libavcodec/proresdata.h"
+#include "avformat.h"
+#include "rawdec.h"
+
+#define FRAME_FIXED_HEADER_SIZE 20
+
+static int prores_check_frame_header(const uint8_t *buf, const int data_size)
+{
+    int hdr_size, width, height;
+    int version, alpha_info;
+
+    hdr_size = AV_RB16(buf);
+    if (hdr_size < FRAME_FIXED_HEADER_SIZE)
+        return AVERROR_INVALIDDATA;
+
+    version = buf[3];
+    if (version > 1)
+        return AVERROR_INVALIDDATA;
+
+    width  = AV_RB16(buf + 8);
+    height = AV_RB16(buf + 10);
+    if (!width || !height)
+        return AVERROR_INVALIDDATA;
+
+    alpha_info = buf[17] & 0x0f;
+    if (alpha_info > 2)
+        return AVERROR_INVALIDDATA;
+
+    return 0;
+}
+
+static int prores_probe(const AVProbeData *p)
+{
+    // 8: frame_size(4B) + frame_identifier(4B)
+    if (p->buf_size < (8 + FRAME_FIXED_HEADER_SIZE) || AV_RB32(p->buf + 4) != FRAME_ID)
+        return 0;
+
+    if (prores_check_frame_header(p->buf + 8, p->buf_size - 8) < 0)
+        return 0;
+
+    return AVPROBE_SCORE_MAX;
+}
+
+FF_DEF_RAWVIDEO_DEMUXER(prores, "raw ProRes", prores_probe, "prores", AV_CODEC_ID_PRORES)
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index f916db13a2..28ca47ae70 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -538,6 +538,19 @@ const FFOutputFormat ff_obu_muxer = {
 };
 #endif
 
+#if CONFIG_PRORES_MUXER
+const FFOutputFormat ff_prores_muxer = {
+    .p.name            = "prores",
+    .p.long_name       = NULL_IF_CONFIG_SMALL("raw prores video"),
+    .p.extensions      = "prores",
+    .p.audio_codec     = AV_CODEC_ID_NONE,
+    .p.video_codec     = AV_CODEC_ID_PRORES,
+    .init              = force_one_stream,
+    .write_packet      = ff_raw_write_packet,
+    .p.flags           = AVFMT_NOTIMESTAMPS,
+};
+#endif
+
 #if CONFIG_RAWVIDEO_MUXER
 const FFOutputFormat ff_rawvideo_muxer = {
     .p.name            = "rawvideo",
-- 
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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3 2/2] lavf: add prores bitstream demuxer and muxer
  2023-07-26  9:28 [FFmpeg-devel] [PATCH v3 2/2] lavf: add prores bitstream demuxer and muxer hung kuishing
@ 2023-07-26 12:54 ` Derek Buitenhuis
  2023-07-26 14:59   ` hung kuishing
  2023-07-26 17:08   ` Kieran Kunhya
  0 siblings, 2 replies; 7+ messages in thread
From: Derek Buitenhuis @ 2023-07-26 12:54 UTC (permalink / raw)
  To: ffmpeg-devel

On 7/26/2023 10:28 AM, hung kuishing wrote:
> Signed-off-by: clarkh <hungkuishing@outlook.com>
> ---
>  libavformat/Makefile     |  2 ++
>  libavformat/allformats.c |  2 ++
>  libavformat/proresdec.c  | 66 ++++++++++++++++++++++++++++++++++++++++
>  libavformat/rawenc.c     | 13 ++++++++
>  4 files changed, 83 insertions(+)
>  create mode 100644 libavformat/proresdec.c

At this point I am giving this a strong NAK.

Both my initial comment[1] and subsequent comment[2] about the first one being ignore,
have been ignored. It is a simple question.

- Derek

[1] http://ffmpeg.org/pipermail/ffmpeg-devel/2023-July/312552.html
[2] http://ffmpeg.org/pipermail/ffmpeg-devel/2023-July/312635.html
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3 2/2] lavf: add prores bitstream demuxer and muxer
  2023-07-26 12:54 ` Derek Buitenhuis
@ 2023-07-26 14:59   ` hung kuishing
  2023-07-26 17:10     ` Andreas Rheinhardt
  2023-07-26 17:08   ` Kieran Kunhya
  1 sibling, 1 reply; 7+ messages in thread
From: hung kuishing @ 2023-07-26 14:59 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Derek Buitenhuis
> Sent: Wednesday, July 26, 2023 8:55 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v3 2/2] lavf: add prores bitstream
> demuxer and muxer
> 
> On 7/26/2023 10:28 AM, hung kuishing wrote:
> > Signed-off-by: clarkh <hungkuishing@outlook.com>
> > ---
> >  libavformat/Makefile     |  2 ++
> >  libavformat/allformats.c |  2 ++
> >  libavformat/proresdec.c  | 66
> ++++++++++++++++++++++++++++++++++++++++
> >  libavformat/rawenc.c     | 13 ++++++++
> >  4 files changed, 83 insertions(+)
> >  create mode 100644 libavformat/proresdec.c
> 
> At this point I am giving this a strong NAK.
> 
> Both my initial comment[1] and subsequent comment[2] about the
> first one being ignore, have been ignored. It is a simple question.

Sorry for not replying to your question in time!
This patch originated from a need in my work to wrap the ProRes bitstream generated by ffmpeg into another mov wrapper. 
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3 2/2] lavf: add prores bitstream demuxer and muxer
  2023-07-26 12:54 ` Derek Buitenhuis
  2023-07-26 14:59   ` hung kuishing
@ 2023-07-26 17:08   ` Kieran Kunhya
  1 sibling, 0 replies; 7+ messages in thread
From: Kieran Kunhya @ 2023-07-26 17:08 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Wed, 26 Jul 2023 at 13:55, Derek Buitenhuis <derek.buitenhuis@gmail.com>
wrote:

> On 7/26/2023 10:28 AM, hung kuishing wrote:
> > Signed-off-by: clarkh <hungkuishing@outlook.com>
> > ---
> >  libavformat/Makefile     |  2 ++
> >  libavformat/allformats.c |  2 ++
> >  libavformat/proresdec.c  | 66 ++++++++++++++++++++++++++++++++++++++++
> >  libavformat/rawenc.c     | 13 ++++++++
> >  4 files changed, 83 insertions(+)
> >  create mode 100644 libavformat/proresdec.c
>
> At this point I am giving this a strong NAK.
>
> Both my initial comment[1] and subsequent comment[2] about the first one
> being ignore,
> have been ignored. It is a simple question.
>

I agree we should not be perpetuating custom formats such as raw ProRes.

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

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3 2/2] lavf: add prores bitstream demuxer and muxer
  2023-07-26 14:59   ` hung kuishing
@ 2023-07-26 17:10     ` Andreas Rheinhardt
  2023-07-27  8:16       ` hung kuishing
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Rheinhardt @ 2023-07-26 17:10 UTC (permalink / raw)
  To: ffmpeg-devel

hung kuishing:
>> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
>> Derek Buitenhuis
>> Sent: Wednesday, July 26, 2023 8:55 PM
>> To: ffmpeg-devel@ffmpeg.org
>> Subject: Re: [FFmpeg-devel] [PATCH v3 2/2] lavf: add prores bitstream
>> demuxer and muxer
>>
>> On 7/26/2023 10:28 AM, hung kuishing wrote:
>>> Signed-off-by: clarkh <hungkuishing@outlook.com>
>>> ---
>>>  libavformat/Makefile     |  2 ++
>>>  libavformat/allformats.c |  2 ++
>>>  libavformat/proresdec.c  | 66
>> ++++++++++++++++++++++++++++++++++++++++
>>>  libavformat/rawenc.c     | 13 ++++++++
>>>  4 files changed, 83 insertions(+)
>>>  create mode 100644 libavformat/proresdec.c
>>
>> At this point I am giving this a strong NAK.
>>
>> Both my initial comment[1] and subsequent comment[2] about the
>> first one being ignore, have been ignored. It is a simple question.
> 
> Sorry for not replying to your question in time!
> This patch originated from a need in my work to wrap the ProRes bitstream generated by ffmpeg into another mov wrapper.

So there are no files in the wild for this? Then there is no point in
this. Or is this something that other mov wrappers (you meant muxers!?)
accept?
(Couldn't you just have used e.g. nut (or even mov itself) to
temporarily store the ProRes data and then pipe this to to the foreign
muxer?)

- 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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3 2/2] lavf: add prores bitstream demuxer and muxer
  2023-07-26 17:10     ` Andreas Rheinhardt
@ 2023-07-27  8:16       ` hung kuishing
  2023-07-27 13:02         ` Derek Buitenhuis
  0 siblings, 1 reply; 7+ messages in thread
From: hung kuishing @ 2023-07-27  8:16 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Andreas Rheinhardt
> Sent: Thursday, July 27, 2023 1:11 AM
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v3 2/2] lavf: add prores bitstream
> demuxer and muxer
> 
> hung kuishing:
> >> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf
> Of
> >> Derek Buitenhuis
> >> Sent: Wednesday, July 26, 2023 8:55 PM
> >> To: ffmpeg-devel@ffmpeg.org
> >> Subject: Re: [FFmpeg-devel] [PATCH v3 2/2] lavf: add prores
> bitstream
> >> demuxer and muxer
> >>
> >> On 7/26/2023 10:28 AM, hung kuishing wrote:
> >>> Signed-off-by: clarkh <hungkuishing@outlook.com>
> >>> ---
> >>>  libavformat/Makefile     |  2 ++
> >>>  libavformat/allformats.c |  2 ++
> >>>  libavformat/proresdec.c  | 66
> >> ++++++++++++++++++++++++++++++++++++++++
> >>>  libavformat/rawenc.c     | 13 ++++++++
> >>>  4 files changed, 83 insertions(+)
> >>>  create mode 100644 libavformat/proresdec.c
> >>
> >> At this point I am giving this a strong NAK.
> >>
> >> Both my initial comment[1] and subsequent comment[2] about the
> first
> >> one being ignore, have been ignored. It is a simple question.
> >
> > Sorry for not replying to your question in time!
> > This patch originated from a need in my work to wrap the ProRes
> bitstream generated by ffmpeg into another mov wrapper.
> 
> So there are no files in the wild for this? Then there is no point in this. Or
> is this something that other mov wrappers (you meant muxers!?)
> accept?
> (Couldn't you just have used e.g. nut (or even mov itself) to temporarily
> store the ProRes data and then pipe this to to the foreign
> muxer?)

Hi, Andreas Rheinhardt:
Let me briefly describe what I needed at that time:
I have another prores encoder and another mov muxer, what I need to do are:
1. use "another mov muxer" to encapsulate prores bitstream generated by ffmpeg.
2. use ffmpeg to encapsulate prores bitstream generated by "another prores encoder" .

I know I can implement them by calling the ffmpeg api,  but how can I implement them by ffmpeg tool? 
So, I developed these patches.



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

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [FFmpeg-devel] [PATCH v3 2/2] lavf: add prores bitstream demuxer and muxer
  2023-07-27  8:16       ` hung kuishing
@ 2023-07-27 13:02         ` Derek Buitenhuis
  0 siblings, 0 replies; 7+ messages in thread
From: Derek Buitenhuis @ 2023-07-27 13:02 UTC (permalink / raw)
  To: ffmpeg-devel

On 7/27/2023 9:16 AM, hung kuishing wrote:
> Let me briefly describe what I needed at that time:
> I have another prores encoder and another mov muxer, what I need to do are:
> 1. use "another mov muxer" to encapsulate prores bitstream generated by ffmpeg.
> 2. use ffmpeg to encapsulate prores bitstream generated by "another prores encoder" .
> 
> I know I can implement them by calling the ffmpeg api,  but how can I implement them by ffmpeg tool? 
> So, I developed these patches.

So this format was created as a weird hack to enable the ffmpeg CLI to be jammed
into such a workflow.

My NAK remains.

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

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-07-27 13:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-26  9:28 [FFmpeg-devel] [PATCH v3 2/2] lavf: add prores bitstream demuxer and muxer hung kuishing
2023-07-26 12:54 ` Derek Buitenhuis
2023-07-26 14:59   ` hung kuishing
2023-07-26 17:10     ` Andreas Rheinhardt
2023-07-27  8:16       ` hung kuishing
2023-07-27 13:02         ` Derek Buitenhuis
2023-07-26 17:08   ` Kieran Kunhya

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git