Browse Source

1.添加fmp4所需要的盒子编码器

2.添加fragmented_demo.mp4
tags/v1.1.0
SmallChi(Koike) 4 years ago
parent
commit
2a43d65108
7 changed files with 62 additions and 9 deletions
  1. +3
    -0
      doc/ffmpeginfo.txt
  2. BIN
      doc/video/fragmented_demo.mp4
  3. +18
    -1
      src/JT1078.FMp4/Boxs/SampleToGroupBox.cs
  4. +36
    -4
      src/JT1078.FMp4/Boxs/SubSampleInformationBox.cs
  5. +0
    -1
      src/JT1078.FMp4/FMp4Box.cs
  6. +3
    -2
      src/JT1078.FMp4/JT1078.FMp4.xml
  7. +2
    -1
      src/JT1078.FMp4/Samples/AVC1SampleEntry.cs

+ 3
- 0
doc/ffmpeginfo.txt View File

@@ -4,4 +4,7 @@ ffmpeg -i demo.mp4 -c copy -f flv -vcodec h264 -acodec aac demo_flv.flv


ffmpeg -f dshow -i video="USB2.0 PC CAMERA" -t 60 -c copy -f h264 -vcodec h264 jt1078.264 ffmpeg -f dshow -i video="USB2.0 PC CAMERA" -t 60 -c copy -f h264 -vcodec h264 jt1078.264


ffmpeg -i demo.264 -vcodec copy -f mp4 -movflags frag_keyframe+empty_moov fragmented_demo.mp4


chrome://media-internals/ chrome://media-internals/

BIN
doc/video/fragmented_demo.mp4 View File


+ 18
- 1
src/JT1078.FMp4/Boxs/SampleToGroupBox.cs View File

@@ -32,7 +32,24 @@ namespace JT1078.FMp4


public void ToBuffer(ref FMp4MessagePackWriter writer) public void ToBuffer(ref FMp4MessagePackWriter writer)
{ {
//todo:sbgp
writer.WriteUInt32(GroupingType);
if (Version == 1)
{
writer.WriteUInt32(GroupingTypeParameter);
}
if(SampleToGroupInfos!=null && SampleToGroupInfos.Count > 0)
{
writer.WriteUInt32((uint)SampleToGroupInfos.Count);
foreach(var item in SampleToGroupInfos)
{
writer.WriteUInt32(item.SampleCount);
writer.WriteUInt32(item.GroupDescriptionIndex);
}
}
else
{
writer.WriteUInt32(0);
}
} }


public class SampleToGroupInfo public class SampleToGroupInfo


+ 36
- 4
src/JT1078.FMp4/Boxs/SubSampleInformationBox.cs View File

@@ -26,7 +26,39 @@ namespace JT1078.FMp4


public void ToBuffer(ref FMp4MessagePackWriter writer) public void ToBuffer(ref FMp4MessagePackWriter writer)
{ {
//todo:subs
if(SubSampleInformations!=null && SubSampleInformations.Count > 0)
{
foreach(var item in SubSampleInformations)
{
writer.WriteUInt32(item.SampleDelta);
if (item.InnerSubSampleInformations != null && item.InnerSubSampleInformations.Count > 0)
{
writer.WriteUInt16((ushort)item.InnerSubSampleInformations.Count);
foreach(var subItem in item.InnerSubSampleInformations)
{
if (Version == 1)
{
writer.WriteUInt32(subItem.SubsampleSize);
}
else
{
writer.WriteUInt16((ushort)subItem.SubsampleSize);
}
writer.WriteByte(subItem.SubsamplePriority);
writer.WriteByte(subItem.Discardable);
writer.WriteUInt32(subItem.Reserved);
}
}
else
{
writer.WriteUInt16(0);
}
}
}
else
{
writer.WriteUInt32((uint)SubSampleInformations.Count);
}
} }


public class SubSampleInformation public class SubSampleInformation
@@ -39,10 +71,10 @@ namespace JT1078.FMp4
public class InnerSubSampleInformation public class InnerSubSampleInformation
{ {
/// <summary> /// <summary>
/// version == 1
/// version == 1 uint32
/// version != 1 uint16
/// </summary> /// </summary>
public uint SubsampleSizeLarge { get; set; }
public ushort SubsampleSize { get; set; }
public uint SubsampleSize { get; set; }
public byte SubsamplePriority { get; set; } public byte SubsamplePriority { get; set; }
public byte Discardable { get; set; } public byte Discardable { get; set; }
public uint Reserved { get; set; } public uint Reserved { get; set; }


+ 0
- 1
src/JT1078.FMp4/FMp4Box.cs View File

@@ -40,7 +40,6 @@ namespace JT1078.FMp4
item.MediaDataBox.ToBuffer(ref writer); item.MediaDataBox.ToBuffer(ref writer);
} }
} }

} }
} }
} }

+ 3
- 2
src/JT1078.FMp4/JT1078.FMp4.xml View File

@@ -678,9 +678,10 @@
<param name="version"></param> <param name="version"></param>
<param name="flags"></param> <param name="flags"></param>
</member> </member>
<member name="P:JT1078.FMp4.SubSampleInformationBox.SubSampleInformation.InnerSubSampleInformation.SubsampleSizeLarge">
<member name="P:JT1078.FMp4.SubSampleInformationBox.SubSampleInformation.InnerSubSampleInformation.SubsampleSize">
<summary> <summary>
version == 1
version == 1 uint32
version != 1 uint16
</summary> </summary>
</member> </member>
<member name="P:JT1078.FMp4.SubsegmentIndexBox.SubsegmentIndexInfos"> <member name="P:JT1078.FMp4.SubsegmentIndexBox.SubsegmentIndexInfos">


+ 2
- 1
src/JT1078.FMp4/Samples/AVC1SampleEntry.cs View File

@@ -36,6 +36,7 @@ namespace JT1078.FMp4.Samples
} }
End(ref writer); End(ref writer);
} }
//todo:public MPEG4ExtensionDescriptorsBox MPEG4BitRateBox { get; set; }

//public MPEG4ExtensionDescriptorsBox MPEG4BitRateBox { get; set; }
} }
} }

Loading…
Cancel
Save