Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 6/6 v2] avformat/movenc: add support for Immersive Audio Model and Formats in ISOBMFF
Date: Mon, 5 Feb 2024 18:06:59 +0100
Message-ID: <AS8P250MB074446201A754FF954E21AB58F472@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <761f6924-d8a3-490c-8e49-1237c0b5372b@gmail.com>

James Almer:
> On 2/5/2024 1:18 PM, Andreas Rheinhardt wrote:
>> James Almer:
>>> On 2/5/2024 12:28 PM, Andreas Rheinhardt wrote:
>>>> James Almer:
>>>>> On 2/5/2024 12:12 PM, Andreas Rheinhardt wrote:
>>>>>> James Almer:
>>>>>>> On 2/3/2024 11:50 AM, Andreas Rheinhardt wrote:
>>>>>>>>> diff --git a/libavformat/movenc.h b/libavformat/movenc.h
>>>>>>>>> index 60363198c9..fee3e759e0 100644
>>>>>>>>> --- a/libavformat/movenc.h
>>>>>>>>> +++ b/libavformat/movenc.h
>>>>>>>>> @@ -25,7 +25,9 @@
>>>>>>>>>      #define AVFORMAT_MOVENC_H
>>>>>>>>>        #include "avformat.h"
>>>>>>>>> +#include "iamf.h"
>>>>>>>>>      #include "movenccenc.h"
>>>>>>>>> +#include "libavcodec/bsf.h"
>>>>>>>>
>>>>>>>> There is no need to include these here, as you don't need complete
>>>>>>>> types. This has the added benefit of forcing you to actually
>>>>>>>> include
>>>>>>>> the
>>>>>>>> files where you are using them (namely in movenc.c, where you
>>>>>>>> forgot to
>>>>>>>> include bsf.h).
>>>>>>>
>>>>>>> Ok, fixed locally.
>>>>>>>
>>>>>>> Will push the set soon.
>>>>>>
>>>>>> It seems you have not noticed my objection to the first version of
>>>>>> your set.
>>>>>>
>>>>>> - Andreas
>>>>>
>>>>> Can you link to it?
>>>>
>>>> Sorry, it was v2:
>>>> https://ffmpeg.org/pipermail/ffmpeg-devel/2024-February/320722.html
>>>>
>>>> - Andreas
>>>
>>> I removed the codec list from the split bsf like you asked, and
>>> explained what the bsfs do in the documentation.
>>
>> For those few codecs where different framings are common and supported
>> by us, the muxers convert the given framing to the needs of the output
>> format; decoders also support the various framings. This of course only
>> works if they can decide which packetization the input uses; it is
>> possible for the cases we support.
>>
>> If you allow that packets can contain OBU encapsulated data for
>> arbitrary codec ids (even if only intended for a few of them), then this
>> packetization would become officially allowed and we would have to adapt
>> our muxers and decoders accordingly. Which is just not possible, because
>> there is just no information available to base this decision on.
> 
> So you want me to state that these bsfs should not be used at all by
> library users, and that they are meant exclusively to be inserted by the
> mov muxer and demuxer?
> 

Actually, I don't think that this should be done in a BSF at all. For
the reasons outlined above.

>>
>> There is a second complication with iamf_frame_split_bsf: Up until now,
>> BSFs only passed the stream index value through. But with this BSF the
>> output may have multiple ids even when the input only had one. I am
>> pretty sure that this will surprise and break many users. I don't know
>> whether ffmpeg is among them (if a user inserts the BSF manually).
> 
> This would be addressed by forbidding (or declaring unsupported) the
> usage of the filters by external callers.
> 

So a BSF for only one caller (lavf)?

>>
>> In fact, for this BSF the stream_index that the output packet gets is
>> determined by the offset as well as the packet data alone. The only way
>> for the demuxer to know these numbers is if it has already parsed the
>> packet data before and added streams according to this. Looking at 3/6
> 
> I think you mean 4/6.
> 
>> it seems that this is indeed what's happening (which is wasteful). But
> 
> Packets are not being parsed, only the descriptors in the relevant mp4
> sample entry.
> 

And it happens twice, which is wasteful.

>> only partially: The iamf_descriptors data is checked and streams are
>> created according to it, but the data read via av_append_packet() is not
>> checked at all. What guarantees that it can't contain
>> IAMF_OBU_IA_AUDIO_ELEMENT elements (which trigger adding new ids and
>> therefore lead to an increment in the potential output stream_index)?
>> Also notice that your 3/6 uses the pkt's stream_index coming out of the
>> BSF without any check.
> 
> Again 4/6. And i can add a check for stream_index.
> 

I think we should never come in a scenario where this can happen.

> I could make the split filter only parse descriptors once, and passing
> them to it immediately after av_bfs_init(), so if packets have
> descriptors, an error will be returned (The spec disallows descriptors
> in samples).
> There's also the bsf's input codecpar extradata. I could use that instead.

If one were to use a BSF for this, then sending the descriptor via
extradata would be the way to go.

- 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".

  reply	other threads:[~2024-02-05 17:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31 17:26 [FFmpeg-devel] [PATCH 1/6 v3] avcodec: add an Immersive Audio Model and Formats frame split bsf James Almer
2024-01-31 17:26 ` [FFmpeg-devel] [PATCH 2/6 v3] avformat/demux: support inserting bitstream filters in demuxing scenarios James Almer
2024-01-31 17:26 ` [FFmpeg-devel] [PATCH 3/6 v3] avformat/mov: make MOVStreamContext refcounted James Almer
2024-01-31 17:26 ` [FFmpeg-devel] [PATCH 4/6 v3] avformat/mov: add support for Immersive Audio Model and Formats in ISOBMFF James Almer
2024-01-31 17:26 ` [FFmpeg-devel] [PATCH 5/6 v2] avcodec: add an Immersive Audio Model and Formats frame merge bsf James Almer
2024-01-31 17:26 ` [FFmpeg-devel] [PATCH 6/6 v2] avformat/movenc: add support for Immersive Audio Model and Formats in ISOBMFF James Almer
2024-02-03 14:50   ` Andreas Rheinhardt
2024-02-05 15:08     ` James Almer
2024-02-05 15:12       ` Andreas Rheinhardt
2024-02-05 15:12         ` James Almer
2024-02-05 15:28           ` Andreas Rheinhardt
2024-02-05 15:28             ` James Almer
2024-02-05 16:18               ` Andreas Rheinhardt
2024-02-05 16:51                 ` James Almer
2024-02-05 17:06                   ` Andreas Rheinhardt [this message]
2024-02-05 17:25                     ` James Almer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB074446201A754FF954E21AB58F472@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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