Skip to content

Commit

Permalink
Merge pull request #110 from dbirtwellharvard/mpeg2
Browse files Browse the repository at this point in the history
Adding ‘m2v1 to allowed MPRG-2 codec FourCC.
  • Loading branch information
dbirtwellharvard authored Jul 12, 2016
2 parents dcd5a8c + ecadbe2 commit 242c17c
Show file tree
Hide file tree
Showing 4 changed files with 211 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class MediaInfoUtil {
put("dvpp", CODEC_FAMILY_DV);

put("mp2v", "MPEG-2");
put("m2v1", "MPEG-2");

put("avc1", CODEC_FAMILY_H_264);
put("h264", CODEC_FAMILY_H_264);
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8"?>
<fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="1.0.1" timestamp="7/12/16 9:31 AM">
<identification>
<identity format="Quicktime" mimetype="video/quicktime" toolname="FITS" toolversion="1.0.1">
<tool toolname="MediaInfo" toolversion="0.7.75" />
<tool toolname="Droid" toolversion="6.1.5" />
<tool toolname="file utility" toolversion="5.04" />
<externalIdentifier toolname="Droid" toolversion="6.1.5" type="puid">x-fmt/384</externalIdentifier>
</identity>
</identification>
<fileinfo>
<filepath toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">/Users/dab980/git/fits/testfiles/FITS-SAMPLE-44_1_1_4_4_4_6_1_1_2_4_8_1_2_1_1.mov</filepath>
<filename toolname="MediaInfo" toolversion="0.7.75">FITS-SAMPLE-44_1_1_4_4_4_6_1_1_2_4_8_1_2_1_1.mov</filename>
<size toolname="MediaInfo" toolversion="0.7.75">1235897</size>
<md5checksum toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">d7e04890d435bc9a8e967f6b1054bb69</md5checksum>
<fslastmodified toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">1468330022000</fslastmodified>
</fileinfo>
<filestatus />
<metadata>
<video>
<location toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">/Users/dab980/git/fits/testfiles/FITS-SAMPLE-44_1_1_4_4_4_6_1_1_2_4_8_1_2_1_1.mov</location>
<mimeType toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">video/quicktime</mimeType>
<format toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">Quicktime</format>
<formatProfile toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">QuickTime</formatProfile>
<duration toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">4200</duration>
<bitRate toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">2354090</bitRate>
<dateCreated toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">UTC 1904-01-01 00:00:00</dateCreated>
<dateModified toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">UTC 2016-07-12 13:27:02</dateModified>
<track type="video" id="1" toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">
<videoDataEncoding>m2v1</videoDataEncoding>
<codecId>m2v1</codecId>
<codecCC>m2v1</codecCC>
<codecName>m2v1</codecName>
<codecFamily>MPEG-2</codecFamily>
<compression>Unknown</compression>
<byteOrder>Unknown</byteOrder>
<bitDepth>8 bits</bitDepth>
<bitRate>2153111</bitRate>
<duration>4138</duration>
<trackSize>1113554</trackSize>
<width>720 pixels</width>
<height>480 pixels</height>
<frameRate>29.970</frameRate>
<frameRateMode>Constant</frameRateMode>
<frameCount>124</frameCount>
<aspectRatio>4:3</aspectRatio>
<broadcastStandard>NTSC</broadcastStandard>
</track>
<track type="audio" id="2" toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">
<audioDataEncoding>.mp2</audioDataEncoding>
<codecId>.mp2</codecId>
<compression>none</compression>
<bitRate>224000</bitRate>
<bitRateMode>Constant</bitRateMode>
<bitDepth>16 bits</bitDepth>
<duration>4200</duration>
<trackSize>117600</trackSize>
<soundField>Front: L R</soundField>
<samplingRate>48000</samplingRate>
<numSamples>201600</numSamples>
<channels>2</channels>
</track>
<standard>
<ebucore:ebuCoreMain xmlns:ebucore="urn:ebu:metadata-schema:ebuCore_2014">
<ebucore:coreMetadata>
<ebucore:format>
<ebucore:videoFormat>
<ebucore:width unit="pixel">720</ebucore:width>
<ebucore:height unit="pixel">480</ebucore:height>
<ebucore:frameRate factorDenominator="1001" factorNumerator="1000">30</ebucore:frameRate>
<ebucore:aspectRatio typeLabel="display">
<ebucore:factorNumerator>4</ebucore:factorNumerator>
<ebucore:factorDenominator>3</ebucore:factorDenominator>
</ebucore:aspectRatio>
<ebucore:videoEncoding typeLabel="m2v1" />
<ebucore:codec>
<ebucore:codecIdentifier>
<dc:identifier xmlns:dc="http://purl.org/dc/elements/1.1/">m2v1</dc:identifier>
</ebucore:codecIdentifier>
<ebucore:name>m2v1</ebucore:name>
<ebucore:family>MPEG-2</ebucore:family>
</ebucore:codec>
<ebucore:bitRate>2153111</ebucore:bitRate>
<ebucore:videoTrack trackId="1" />
<ebucore:technicalAttributeString typeLabel="frameRateMode">constant</ebucore:technicalAttributeString>
<ebucore:technicalAttributeString typeLabel="byteOrder">unknown</ebucore:technicalAttributeString>
<ebucore:technicalAttributeString typeLabel="compression">unknown</ebucore:technicalAttributeString>
<ebucore:technicalAttributeString typeLabel="broadcastStandard">NTSC</ebucore:technicalAttributeString>
<ebucore:technicalAttributeLong typeLabel="streamSize">1113554</ebucore:technicalAttributeLong>
<ebucore:technicalAttributeLong typeLabel="frameCount">124</ebucore:technicalAttributeLong>
<ebucore:technicalAttributeLong typeLabel="bitDepth">8</ebucore:technicalAttributeLong>
<ebucore:technicalAttributeLong typeLabel="duration">4138</ebucore:technicalAttributeLong>
</ebucore:videoFormat>
<ebucore:audioFormat>
<ebucore:audioEncoding typeLabel=".mp2" />
<ebucore:codec>
<ebucore:codecIdentifier>
<dc:identifier xmlns:dc="http://purl.org/dc/elements/1.1/">.mp2</dc:identifier>
</ebucore:codecIdentifier>
</ebucore:codec>
<ebucore:audioTrackConfiguration typeLabel="Front: L R" />
<ebucore:samplingRate>48000</ebucore:samplingRate>
<ebucore:bitRate>224000</ebucore:bitRate>
<ebucore:bitRateMode>constant</ebucore:bitRateMode>
<ebucore:audioTrack trackId="2" />
<ebucore:channels>2</ebucore:channels>
<ebucore:technicalAttributeString typeLabel="compression">none</ebucore:technicalAttributeString>
<ebucore:technicalAttributeLong typeLabel="streamSize">117600</ebucore:technicalAttributeLong>
<ebucore:technicalAttributeLong typeLabel="sampleCount">201600</ebucore:technicalAttributeLong>
<ebucore:technicalAttributeLong typeLabel="duration">4200</ebucore:technicalAttributeLong>
</ebucore:audioFormat>
<ebucore:audioFormatExtended>
<ebucore:audioChannelFormat>
<ebucore:audioBlockFormat>
<ebucore:position coordinate="x">-100</ebucore:position>
<ebucore:position coordinate="y">0</ebucore:position>
</ebucore:audioBlockFormat>
</ebucore:audioChannelFormat>
<ebucore:audioChannelFormat>
<ebucore:audioBlockFormat>
<ebucore:position coordinate="x">100</ebucore:position>
<ebucore:position coordinate="y">0</ebucore:position>
</ebucore:audioBlockFormat>
</ebucore:audioChannelFormat>
</ebucore:audioFormatExtended>
<ebucore:containerFormat>
<ebucore:comment typeLabel="format">Quicktime</ebucore:comment>
<ebucore:comment typeLabel="formatProfile">QuickTime</ebucore:comment>
</ebucore:containerFormat>
<ebucore:duration>
<ebucore:editUnitNumber factorDenominator="1" factorNumerator="1" editRate="1000">4200</ebucore:editUnitNumber>
</ebucore:duration>
<ebucore:mimeType typeLabel="video/quicktime" />
<ebucore:locator>/Users/dab980/git/fits/testfiles/FITS-SAMPLE-44_1_1_4_4_4_6_1_1_2_4_8_1_2_1_1.mov</ebucore:locator>
<ebucore:technicalAttributeString typeLabel="overallBitRate">2354090</ebucore:technicalAttributeString>
<ebucore:dateModified startTime="13:27:02Z" startDate="2016-07-12" />
</ebucore:format>
</ebucore:coreMetadata>
</ebucore:ebuCoreMain>
</standard>
</video>
</metadata>
<statistics fitsExecutionTime="608">
<tool toolname="MediaInfo" toolversion="0.7.75" executionTime="553" />
<tool toolname="OIS Audio Information" toolversion="0.1" status="did not run" />
<tool toolname="ADL Tool" toolversion="0.1" status="did not run" />
<tool toolname="VTT Tool" toolversion="0.1" status="did not run" />
<tool toolname="Droid" toolversion="6.1.5" executionTime="214" />
<tool toolname="Jhove" toolversion="1.11" status="did not run" />
<tool toolname="file utility" toolversion="5.04" executionTime="563" />
<tool toolname="Exiftool" toolversion="10.00" status="did not run" />
<tool toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="did not run" />
<tool toolname="OIS File Information" toolversion="0.2" executionTime="206" />
<tool toolname="OIS XML Metadata" toolversion="0.2" status="did not run" />
<tool toolname="ffident" toolversion="0.2" executionTime="466" />
<tool toolname="Tika" toolversion="1.10" status="did not run" />
</statistics>
</fits>

Original file line number Diff line number Diff line change
Expand Up @@ -425,4 +425,55 @@ public void testVideoXmlUnitOutput_MXF() throws Exception {
assertXMLIdentical("Differences in XML", diff, true);

}

@Test
public void testVideoXmlUnitCombinedOutput_MPEG2() throws Exception {

File input = new File("testfiles/FITS-SAMPLE-44_1_1_4_4_4_6_1_1_2_4_8_1_2_1_1.mov");
FitsOutput fitsOut = fits.examine(input);
fitsOut.saveToDisk("test-generated-output/testVideoXmlUnitCombinedOutput_MPEG2_Output.xml");

// Output stream for FITS to write to
ByteArrayOutputStream out = new ByteArrayOutputStream();

// Create combined output in the stream passed in
Fits.outputStandardCombinedFormat(fitsOut, out);

// Turn output stream into a String HtmlUnit can use
String actualXmlStr = new String(out.toByteArray(),"UTF-8");

// Read in the expected XML file
Scanner scan = new Scanner(new File(
"testfiles/output/FITS-SAMPLE-44_1_1_4_4_4_6_1_1_2_4_8_1_2_1_1_mov_mpeg2_combined.xml"));
String expectedXmlStr = scan.
useDelimiter("\\Z").next();
scan.close();

// Set up XMLUnit
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setNormalizeWhitespace(true);

Diff diff = new Diff(expectedXmlStr,actualXmlStr);

// Initialize attributes or elements to ignore for difference checking
diff.overrideDifferenceListener(new IgnoreNamedElementsDifferenceListener(IGNORED_XML_ELEMENTS));

DetailedDiff detailedDiff = new DetailedDiff(diff);

// Display any Differences
List<Difference> diffs = detailedDiff.getAllDifferences();
if (!diff.identical()) {
StringBuffer differenceDescription = new StringBuffer();
differenceDescription.append(diffs.size()).append(" differences");

System.out.println(differenceDescription.toString());
for(Difference difference : diffs) {
System.out.println(difference.toString());
}

}

assertXMLIdentical("Differences in XML", diff, true);

}
}

0 comments on commit 242c17c

Please sign in to comment.