a
This commit is contained in:
parent
12ebd54c61
commit
76b26189af
55
audio.php
Normal file
55
audio.php
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
use swf2ass\ass\ASSEventTime;
|
||||
|
||||
require_once __DIR__ . "/vendor/autoload.php";
|
||||
|
||||
$width = 512;
|
||||
$height = 512;
|
||||
$ar = $width / $height;
|
||||
$frameRate = 30;
|
||||
$frameDurationMs = (1 / $frameRate) * 1000;
|
||||
|
||||
echo <<<ASSHEADER
|
||||
[Script Info]
|
||||
; Script generated by swf2ass
|
||||
; https://git.gammaspectra.live/WeebDataHoarder/swf2ass
|
||||
ScriptType: v4.00+
|
||||
WrapStyle: 0
|
||||
ScaledBorderAndShadow: yes
|
||||
YCbCr Matrix: PC.709
|
||||
PlayResX: {$width}
|
||||
PlayResY: {$height}
|
||||
|
||||
[Aegisub Project Garbage]
|
||||
Last Style Storage: f
|
||||
Video File: ?dummy:{$frameRate}:10000:{$width}:{$height}:160:160:160:c
|
||||
Video AR Value: {$ar}
|
||||
|
||||
[V4+ Styles]
|
||||
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
||||
Style: f,Arial,20,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,0,0,7,0,0,0,1
|
||||
|
||||
[Events]
|
||||
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
|
||||
|
||||
ASSHEADER;
|
||||
|
||||
|
||||
|
||||
$frameDuration = 1;
|
||||
for($frame = 0; $frame < 6523; $frame += $frameDuration){
|
||||
$line = new \swf2ass\ass\ASSLine();
|
||||
$line->layer = [$frame];
|
||||
$line->objectId = 0;
|
||||
$line->start = $frame;
|
||||
$line->end = $frame + $frameDuration - 1;
|
||||
$line->name = "{$line->start}->{$line->end}";
|
||||
$line->style = "f";
|
||||
$assEventTime = new ASSEventTime($line->start, $line->end - $line->start + 1, $frameDurationMs);
|
||||
$l = trim(file_get_contents("/tmp/tmp6_pqjbve/" . str_pad("$frame.ass", 10, "0", STR_PAD_LEFT)));
|
||||
$l = str_replace("pos(0,0)", "pos(0,416)", $l);
|
||||
$l = $line->encode($frameDurationMs) . "{\\blur0.5}" . $l;
|
||||
|
||||
echo $l . "\n";
|
||||
}
|
24
swf2json.php
Normal file
24
swf2json.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . "/vendor/autoload.php";
|
||||
|
||||
$swfContent = file_get_contents($argv[1]);
|
||||
|
||||
$swf = new \swf\SWF($swfContent);
|
||||
$swfContent = null;
|
||||
unset($swfContent);
|
||||
|
||||
|
||||
if ($swf->header["signature"]) {
|
||||
$json = [
|
||||
"header" => $swf->header,
|
||||
"tags" => []
|
||||
];
|
||||
foreach ($swf->tags as $tag) {
|
||||
$json["tags"][] = $swf->parseTag($tag);
|
||||
}
|
||||
|
||||
echo json_encode($json, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PARTIAL_OUTPUT_ON_ERROR | JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in a new issue