@@ -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/ |
@@ -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 | ||||
@@ -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; } | ||||
@@ -40,7 +40,6 @@ namespace JT1078.FMp4 | |||||
item.MediaDataBox.ToBuffer(ref writer); | item.MediaDataBox.ToBuffer(ref writer); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } |
@@ -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"> | ||||
@@ -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; } | |||||
} | } | ||||
} | } |