diff --git a/doc/ffmpeginfo.txt b/doc/ffmpeginfo.txt
index 2d21748..0058b3b 100644
--- a/doc/ffmpeginfo.txt
+++ b/doc/ffmpeginfo.txt
@@ -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 -i demo.264 -vcodec copy -f mp4 -movflags frag_keyframe+empty_moov fragmented_demo.mp4
+
+
chrome://media-internals/
\ No newline at end of file
diff --git a/doc/video/fragmented_demo.mp4 b/doc/video/fragmented_demo.mp4
new file mode 100644
index 0000000..698bd28
Binary files /dev/null and b/doc/video/fragmented_demo.mp4 differ
diff --git a/src/JT1078.FMp4/Boxs/SampleToGroupBox.cs b/src/JT1078.FMp4/Boxs/SampleToGroupBox.cs
index 2f47f72..1bc501c 100644
--- a/src/JT1078.FMp4/Boxs/SampleToGroupBox.cs
+++ b/src/JT1078.FMp4/Boxs/SampleToGroupBox.cs
@@ -32,7 +32,24 @@ namespace JT1078.FMp4
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
diff --git a/src/JT1078.FMp4/Boxs/SubSampleInformationBox.cs b/src/JT1078.FMp4/Boxs/SubSampleInformationBox.cs
index 942b1f4..47e4814 100644
--- a/src/JT1078.FMp4/Boxs/SubSampleInformationBox.cs
+++ b/src/JT1078.FMp4/Boxs/SubSampleInformationBox.cs
@@ -26,7 +26,39 @@ namespace JT1078.FMp4
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
@@ -39,10 +71,10 @@ namespace JT1078.FMp4
public class InnerSubSampleInformation
{
///
- /// version == 1
+ /// version == 1 uint32
+ /// version != 1 uint16
///
- public uint SubsampleSizeLarge { get; set; }
- public ushort SubsampleSize { get; set; }
+ public uint SubsampleSize { get; set; }
public byte SubsamplePriority { get; set; }
public byte Discardable { get; set; }
public uint Reserved { get; set; }
diff --git a/src/JT1078.FMp4/FMp4Box.cs b/src/JT1078.FMp4/FMp4Box.cs
index 1de854f..b910171 100644
--- a/src/JT1078.FMp4/FMp4Box.cs
+++ b/src/JT1078.FMp4/FMp4Box.cs
@@ -40,7 +40,6 @@ namespace JT1078.FMp4
item.MediaDataBox.ToBuffer(ref writer);
}
}
-
}
}
}
diff --git a/src/JT1078.FMp4/JT1078.FMp4.xml b/src/JT1078.FMp4/JT1078.FMp4.xml
index fad6173..8126534 100644
--- a/src/JT1078.FMp4/JT1078.FMp4.xml
+++ b/src/JT1078.FMp4/JT1078.FMp4.xml
@@ -678,9 +678,10 @@
-
+
- version == 1
+ version == 1 uint32
+ version != 1 uint16
diff --git a/src/JT1078.FMp4/Samples/AVC1SampleEntry.cs b/src/JT1078.FMp4/Samples/AVC1SampleEntry.cs
index e00ec60..f556c4c 100644
--- a/src/JT1078.FMp4/Samples/AVC1SampleEntry.cs
+++ b/src/JT1078.FMp4/Samples/AVC1SampleEntry.cs
@@ -36,6 +36,7 @@ namespace JT1078.FMp4.Samples
}
End(ref writer);
}
- //todo:public MPEG4ExtensionDescriptorsBox MPEG4BitRateBox { get; set; }
+
+ //public MPEG4ExtensionDescriptorsBox MPEG4BitRateBox { get; set; }
}
}