如何从 MFCreateFMPEG4MediaSink 中提取帧数?

How to extract the frame count from MFCreateFMPEG4MediaSink?

当我写入 100 帧时 MFCreateFMPEG4MediaSink 生成多个 moof+mdats。

我如何知道每个 mdat 中有多少帧而不在生成后解析原子?

是否有我可以为 MFCreateFMPEG4MediaSink 设置的参数,以便强制那么多帧。

感谢

标准 FMPEG4 媒体接收器通常会在每个 moof 盒中打包几帧,例如

    <MovieFragmentBox Size="368" Type="moof" Specification="p12" Container="file" TrackFragments="1">
        <MovieFragmentHeaderBox Size="16" Type="mfhd" Version="0" Flags="0" Specification="p12" Container="moof" FragmentSequenceNumber="1"></MovieFragmentHeaderBox>
        <TrackFragmentBox Size="344" Type="traf" Specification="p12" Container="moof" >
            <TrackFragmentHeaderBox Size="28" Type="tfhd" Version="0" Flags="1" Specification="p12" Container="traf" TrackID="1" BaseDataOffset="1123"></TrackFragmentHeaderBox>
            <TrackRunBox Size="308" Type="trun" Version="1" Flags="3841" Specification="p12" Container="traf" SampleCount="18" DataOffset="0">
                <TrackRunEntry Duration="1000" Size="48020" CTSOffset="0" SamplePadding="0" Sync="1" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="61722" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="48737" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="49846" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="48625" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="34329" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="21388" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="23109" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="20293" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="22243" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="21375" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="22346" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="21611" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="22510" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="21539" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="22698" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="21864" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
                <TrackRunEntry Duration="1000" Size="23394" CTSOffset="0" SamplePadding="0" Sync="0" DegradationPriority="0" IsLeading="0" DependsOn="0" IsDependedOn="0" HasRedundancy="0"/>
            </TrackRunBox>
        </TrackFragmentBox>
    </MovieFragmentBox>
    <MediaDataBox Size="555657" Type="mdat" Specification="p12" Container="file" dataSize="555649"></MediaDataBox>

(摘自 MFCreateFMPEG4MediaSink 生成的文件之一)

没有更改此行为的设置。没有关于所选值的报告。如果需要,您需要解析输出比特流才能找到它。