Commit b97b161f authored by Administrator's avatar Administrator
Browse files

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