Commit b97b161f authored by Dr. Michael Petter's avatar Dr. Michael Petter

changed mp4s y-resolution to a power of 2 for h264

parent 0d13c5ce
Pipeline #1828 passed with stage
in 32 seconds
......@@ -105,7 +105,7 @@ import ttt.record.LectureProfileDialog;
import ttt.record.Recording;
public class TTT extends JFrame {
static final String version = "11.04.2019";
static final String version = "03.05.2019";
public static boolean debug = !true;
public static boolean verbose = true;
......@@ -1519,6 +1519,8 @@ public class TTT extends JFrame {
case 'n':
enabledNativeLookAndFeel = false;
break;
case 'd':
setDebug(true);
case 'v':
System.out.println(" Verbose mode enabled!");
setVerbose(true);
......
......@@ -1608,6 +1608,7 @@ public class PostProcessorPanel extends GradientPanel {
if (x==0) x=recording.prefs.framebufferWidth;
TTT.userPrefs.putInt("VideoResolution", x);
int y = (int)(x * recording.prefs.framebufferHeight)/recording.prefs.framebufferWidth;
if (y%2==1) y++; // y-resolution needs to be a power of 2 due to h264
int cropx = 0, cropy=0;
int cropw=x, croph=y;
System.out.println(" creating MP4-Video with resolution "+x+"x"+y);
......
......@@ -26,6 +26,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;
import javax.imageio.ImageIO;
......@@ -255,7 +256,7 @@ public class PodcastCreator {
//create window movie using ffmpeg
//write scaled window image
ImageIO.write(ImageCreator.getScaledInstance(recording.getGraphicsContext().getScreenshot(), resolutionWidth, resolutionHeight, RenderingHints.VALUE_INTERPOLATION_BICUBIC, true), "png", windowImageFile);
windowMovieFile.delete();
if (!TTT.debug) windowMovieFile.delete();
exec.createListenerStream();
j = exec.exec(new String[] {
ffmpegCmd,
......@@ -278,10 +279,12 @@ public class PodcastCreator {
});
if (j != 0 || windowMovieFile.length() == 0) {
//error while creating window movie
if (!TTT.debug) {
windowMovieFile.delete();
outMovieFile.delete();
outMovieTmpFile.delete();
windowImageFile.delete();
}
if(TTT.verbose){
System.out.println("Unable to create window movie using ffmpeg:");
System.out.println(exec.getListenerStream());}
......@@ -315,10 +318,12 @@ public class PodcastCreator {
j = exec.exec(line);
if (j != 0 || outMovieTmpFile.length() == 0) {
//error while appending the slideMovie to the output file
if (!TTT.debug) {
windowMovieFile.delete();
outMovieFile.delete();
outMovieTmpFile.delete();
windowImageFile.delete();
}
String cmdline="";
for (String s:line) cmdline+=s+" ";
if(TTT.verbose){
......@@ -329,14 +334,16 @@ public class PodcastCreator {
}
}
//replace outMovieFile by outMovieFileTmp
outMovieFile.delete();
if (!TTT.debug) outMovieFile.delete();
if (i < recording.messages.size()) {
outMovieTmpFile.renameTo(outMovieFile);
}
}
windowMovieFile.delete();
outMovieFile.delete();
windowImageFile.delete();
if (!TTT.debug) {
windowMovieFile.delete();
outMovieFile.delete();
windowImageFile.delete();
}
if(TTT.verbose){
//audio encoding with ffmpeg. The audio stream must be converted via aac to achieve ipod compatibility
......@@ -392,8 +399,11 @@ public class PodcastCreator {
System.out.println("debugging ffmpeg line: "+cmdline);
}
j = exec.exec(line);
outMovieTmpFile.delete();
Process p = Runtime.getRuntime().exec(line);
j=p.waitFor();
if (!TTT.debug) outMovieTmpFile.delete();
if (!batch) {
timer.stop();
if (ShowProgressmonitor&&progressMonitor.isCanceled()) {
......@@ -415,8 +425,8 @@ public class PodcastCreator {
String cmdline="";
for (String s:line) cmdline+=s+" ";
if(TTT.verbose){
System.out.println("Unable add audio stream using the command:");
System.out.println(cmdline);
System.err.println("Unable add audio stream using the command:");
System.err.println(cmdline);
System.out.println(exec.getListenerStream());
}else
outMovieFile.delete();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment