www in docker support

This commit is contained in:
MaddoScientisto 2026-04-22 18:41:37 +02:00
commit c227fce036
2145 changed files with 399596 additions and 58 deletions

View file

@ -0,0 +1,44 @@
package org.jcodec.movtool;
import java.io.File;
import org.jcodec.common.model.Rational;
import org.jcodec.common.model.Size;
import org.jcodec.containers.mp4.BoxUtil;
import org.jcodec.containers.mp4.boxes.Box;
import org.jcodec.containers.mp4.boxes.MovieBox;
import org.jcodec.containers.mp4.boxes.MovieFragmentBox;
import org.jcodec.containers.mp4.boxes.NodeBox;
import org.jcodec.containers.mp4.boxes.SampleDescriptionBox;
import org.jcodec.containers.mp4.boxes.TrakBox;
import org.jcodec.containers.mp4.boxes.VideoSampleEntry;
public class SetPAR {
public static void main1(String[] args) throws Exception {
if (args.length < 2) {
System.out.println("Syntax: setpasp <movie> <num:den>");
System.exit(-1);
}
final Rational newPAR = Rational.parse(args[1]);
new InplaceMP4Editor().modify(new File(args[0]), new MP4Edit() {
public void apply(MovieBox mov) {
TrakBox vt = mov.getVideoTrack();
vt.setPAR(newPAR);
Box box = NodeBox.<SampleDescriptionBox>findFirstPath(vt, SampleDescriptionBox.class, Box.path("mdia.minf.stbl.stsd")).getBoxes()
.get(0);
if (box != null && box instanceof VideoSampleEntry) {
VideoSampleEntry vs = (VideoSampleEntry)box;
int codedWidth = vs.getWidth();
int codedHeight = vs.getHeight();
int displayWidth = codedWidth * newPAR.getNum() / newPAR.getDen();
vt.getTrackHeader().setWidth((float)displayWidth);
if (BoxUtil.containsBox(vt, "tapt"))
vt.setAperture(new Size(codedWidth, codedHeight), new Size(displayWidth, codedHeight));
}
}
public void applyToFragment(MovieBox mov, MovieFragmentBox[] fragmentBox) {
throw new RuntimeException("Unsupported");
}
});
}
}