Skip to content

Commit

Permalink
KOST-Tools v1.1.0.0 Teil 08
Browse files Browse the repository at this point in the history
===========================
KOST-Val:
- MP4: Analyse mit ffmpeg implementiert
- Valid mit Warning separat ausgeben und darstellen
  • Loading branch information
Chlara committed Dec 12, 2023
1 parent 7b40fcd commit 34a7ac3
Show file tree
Hide file tree
Showing 8 changed files with 334 additions and 81 deletions.
Expand Up @@ -21,6 +21,8 @@
tr.captionm {background-color: #f8dfdf }
tr.captionio {background-color: #afeeaf; font-weight:bold }
tr.captioniom {background-color: #ccffcc }
tr.captionwarn {background-color: #f9cb9c; font-weight:bold }
tr.captionwarnm {background-color: #fce5cd }
tr.captioninfo {background-color: #b2b2c5; font-weight:bold }
tr.captioninfom {background-color: #e7e7ed }
</style>
Expand Down Expand Up @@ -345,9 +347,81 @@
<br/>
</xsl:if>
</xsl:for-each>
<h2>Warning:</h2>
<xsl:for-each select="KOSTValLog/Format/Validation">
<xsl:if test="(Warning) and (Valid)">
<div>
<table width="100%">
<tr class="captionwarn">
<td>
<xsl:value-of select="ValType"/>
<xsl:value-of select="FormatVL"/>
->
<xsl:value-of select="ValFile"/>
</td>
</tr>
</table>
<table width="100%">
<xsl:if test="md5">
<tr class="captionwarnm">
<td width="25%">
Info: MD5
</td>
<td width="75%">
<xsl:value-of select="md5"/>
</td>
</tr>
</xsl:if>
<xsl:if test="sha1">
<tr class="captionwarnm">
<td width="25%">
Info: SHA-1
</td>
<td width="75%">
<xsl:value-of select="sha1"/>
</td>
</tr>
</xsl:if>
<xsl:if test="sha256">
<tr class="captionwarnm">
<td width="25%">
Info: SHA-256
</td>
<td width="75%">
<xsl:value-of select="sha256"/>
</td>
</tr>
</xsl:if>
<xsl:if test="sha512">
<tr class="captionwarnm">
<td width="25%">
Info: SHA-512
</td>
<td width="75%">
<xsl:value-of select="sha512"/>
</td>
</tr>
</xsl:if>
<xsl:for-each select="Error">
<tr class="captionwarnm">
<td width="25%">
<xsl:value-of select="Modul"/>
</td>
<td width="75%">
<xsl:for-each select="Message">
<xsl:value-of select="."/>
<br/>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</table>
</div>
</xsl:if>
</xsl:for-each>
<h2>Valid:</h2>
<xsl:for-each select="KOSTValLog/Format/Validation">
<xsl:if test="Valid">
<xsl:if test="not(Warning) and (Valid)">
<div>
<table width="100%">
<tr class="captionio">
Expand Down
Expand Up @@ -39,12 +39,8 @@ public class ffmpeg
*
* ffprobe -show_format -show_streams -loglevel quiet videofile
*
* @param insensitiveOption
* Option betreffend Gross- und Kleinschreibung
* @param searchString
* gesuchter Text
* @param fileToGrep
* Datei in welcher gesucht werden soll
* @param fileToProbe
* Die zu analysierende Datei
* @param output
* Ausgabe des Resultates
* @param workDir
Expand All @@ -57,21 +53,22 @@ public static String execFfprobe( File fileToProbe, File output,
File workDir, String dirOfJarPath ) throws InterruptedException
{
boolean out = true;
File fffprobeExe = new File( dirOfJarPath + File.separator + ffprobeExe );
File fffprobeExe = new File(
dirOfJarPath + File.separator + ffprobeExe );
// falls das File von einem vorhergehenden Durchlauf bereits existiert,
// loeschen wir es
if ( output.exists() ) {
output.delete();
}

// Doppelleerschlag im Pfad einer Datei bereitet Probleme (leerer Report)
// Video-Datei muss zuvor bei Doppelleerschlag in temp-Verzeichnis kopiert werden
/*
* Doppelleerschlag im Pfad oder im Namen einer Datei bereitet Probleme
* (leerer Report) Video-Datei wird bei Doppelleerschlag in
* temp-Verzeichnis kopiert
*/

// ffprobe -show_format -show_streams -loglevel quiet -o outputfile
// videofile
/* String command = "\"\"" + fffprobeExe.getAbsolutePath() + "\" "
+ " -show_format -show_streams -loglevel quiet \""
+ fileToProbe.getAbsolutePath() + "\"\"";*/
String command = "\"\"" + fffprobeExe.getAbsolutePath() + "\" "
+ "-show_format -show_streams -loglevel quiet -o \""
+ output.getAbsolutePath() + "\" \""
Expand All @@ -95,6 +92,62 @@ public static String execFfprobe( File fileToProbe, File output,
return resultExec;
}

/**
* fuehrt eine Analyse mit ffmpeg via cmd durch und speichert das Ergebnis
* in ein File (Output). Gibt zurueck ob Output existiert oder nicht
*
* ffmpeg.exe -v error "fileToFfmpeg" -f null - 2> output
*
* @param fileToFfmpeg
* Die zu analysierende Datei
* @param output
* Ausgabe des Resultates
* @param workDir
* Temporaeres Verzeichnis
* @param dirOfJarPath
* String mit dem Pfad von wo das Programm gestartet wurde
* @return String ob Report existiert oder nicht ggf Exception
*/
public static String execFfmpeg( File fileToFfmpeg, File output,
File workDir, String dirOfJarPath ) throws InterruptedException
{
boolean out = true;
File fffmpegExe = new File( dirOfJarPath + File.separator + ffmpegExe );
// falls das File von einem vorhergehenden Durchlauf bereits existiert,
// loeschen wir es
if ( output.exists() ) {
output.delete();
}

/*
* Doppelleerschlag im Pfad oder im Namen einer Datei bereitet Probleme
* (leerer Report) Video-Datei wird bei Doppelleerschlag in
* temp-Verzeichnis kopiert
*/

// ffmpeg.exe -v error -i "fileToFfmpeg" -f null - 2> output
String command = "\"\"" + fffmpegExe.getAbsolutePath() + "\" "
+ "-v error -i \"" + fileToFfmpeg.getAbsolutePath()
+ "\" -f null - 2> \"" + output.getAbsolutePath() + "\"\"";

// System.out.println( "command: " + command );

String resultExec = Cmd.execToString( command, out, workDir );
// System.out.println( "resultExec: " + resultExec );

// ffprobe gibt keine Info raus, die replaced oder ignoriert werden muss

if ( resultExec.equals( "OK" ) ) {
if ( output.exists() ) {
// alles io bleibt bei OK
} else {
// Datei nicht angelegt...
resultExec = "NoReport";
}
}
return resultExec;
}

/**
* fuehrt eine Kontrolle aller benoetigten Dateien von ffmpeg/ffplay/ffprobe
* durch und gibt das Ergebnis als String zurueck
Expand Down
Expand Up @@ -125,7 +125,7 @@ public interface MessageConstants
String MESSAGE_XML_MODUL_H_MKV = "val.message.xml.modul.h.mkv";

String MESSAGE_XML_MODUL_A_MP4 = "val.message.xml.modul.a.mp4";
// String MESSAGE_XML_MODUL_B_MP4 = "val.message.xml.modul.b.mp4";
String MESSAGE_XML_MODUL_B_MP4 = "val.message.xml.modul.b.mp4";
// String MESSAGE_XML_MODUL_C_MP4 = "val.message.xml.modul.c.mp4";

String MESSAGE_XML_MODUL_Aa_SIP = "val.message.xml.modul.aa.sip";
Expand Down Expand Up @@ -389,13 +389,16 @@ public interface MessageConstants
String ERROR_XML_A_MKVMP4_CODEC_NOAUDIO_WARNING = "val.error.xml.a.mkvmp4.codec.noaudio.warning";

// Modul B-H Meldungen
String ERROR_XML_B_MKV_ERROR = "val.error.xml.b.mkv.error";
String ERROR_XML_C_MKV_ERROR = "val.error.xml.c.mkv.error";
String ERROR_XML_D_MKV_ERROR = "val.error.xml.d.mkv.error";
String ERROR_XML_E_MKV_ERROR = "val.error.xml.e.mkv.error";
String ERROR_XML_F_MKV_ERROR = "val.error.xml.f.mkv.error";
String ERROR_XML_G_MKV_ERROR = "val.error.xml.g.mkv.error";
String ERROR_XML_H_MKV_ERROR = "val.error.xml.h.mkv.error";
String ERROR_XML_B_MKV_ERROR = "val.error.xml.b.mkv.error";
String ERROR_XML_C_MKV_ERROR = "val.error.xml.c.mkv.error";
String ERROR_XML_D_MKV_ERROR = "val.error.xml.d.mkv.error";
String ERROR_XML_E_MKV_ERROR = "val.error.xml.e.mkv.error";
String ERROR_XML_F_MKV_ERROR = "val.error.xml.f.mkv.error";
String ERROR_XML_G_MKV_ERROR = "val.error.xml.g.mkv.error";
String ERROR_XML_H_MKV_ERROR = "val.error.xml.h.mkv.error";

// Modul B Meldungen
String ERROR_XML_B_MP4_ERROR = "val.error.xml.b.mp4.error";

// *************SIP-Meldungen*************************************************************************
// Modul 1a Meldungen
Expand Down

0 comments on commit 34a7ac3

Please sign in to comment.