Commit 8334232a authored by petter's avatar petter

Flexible resolution for mp4 generation and ffmpeg elimination; experiments...

Flexible resolution for mp4 generation and ffmpeg elimination; experiments with invokelater to get rid of blank window when maximising in Linux

git-svn-id: https://www2.in.tum.de/repos/ttt/trunk@158 0463f305-d864-43cb-8a47-61cf597d4139
parent 3ab95980
...@@ -548,7 +548,7 @@ public class TTT extends JFrame { ...@@ -548,7 +548,7 @@ public class TTT extends JFrame {
recording)); recording));
frame.pack(); frame.pack();
frame.setResizable(true); frame.setResizable(true);
frame.setClosable(true);
// post processing // post processing
TTT ttt = getInstance(); TTT ttt = getInstance();
ttt.showTTT(); ttt.showTTT();
...@@ -907,7 +907,6 @@ public class TTT extends JFrame { ...@@ -907,7 +907,6 @@ public class TTT extends JFrame {
protected void activateNativeLook() { protected void activateNativeLook() {
try { try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
this.paintAll(this.getGraphics()); this.paintAll(this.getGraphics());
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
...@@ -1553,7 +1552,11 @@ public class TTT extends JFrame { ...@@ -1553,7 +1552,11 @@ public class TTT extends JFrame {
break; break;
} }
} }
getInstance().showTTT(); SwingUtilities.invokeLater(new Runnable() {
public void run() {
getInstance().showTTT();
}
});
} }
// MOD TD // MOD TD
......
...@@ -1533,7 +1533,8 @@ public class PostProcessorPanel extends GradientPanel { ...@@ -1533,7 +1533,8 @@ public class PostProcessorPanel extends GradientPanel {
int x = Integer.parseInt(mp4WidthString.getText()); int x = Integer.parseInt(mp4WidthString.getText());
if (x==0) x=480; if (x==0) x=480;
TTT.userPrefs.putInt("VideoResolution", x); TTT.userPrefs.putInt("VideoResolution", x);
int y = (int)(x * .75); int y = (int)(x * recording.prefs.framebufferHeight)/recording.prefs.framebufferWidth;
System.out.println(" creating MP4-Video with resolution "+x+"x"+y);
PodcastCreator.createPodcast(recording, x, y, batch,true); PodcastCreator.createPodcast(recording, x, y, batch,true);
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -47,7 +47,7 @@ public class PodcastCreator { ...@@ -47,7 +47,7 @@ public class PodcastCreator {
private static final int RESOLUTION_WIDTH = 480; private static final int RESOLUTION_WIDTH = 480;
private static final int RESOLUTION_HEIGTH = 320; private static final int RESOLUTION_HEIGTH = 320;
private static final String FFMPEG = "ffmpeg"; private static final String FFMPEG = "avconv";
private static final String MP4BOX = "MP4Box"; private static final String MP4BOX = "MP4Box";
private static final double FRAMES_PER_SEC = 1; private static final double FRAMES_PER_SEC = 1;
...@@ -188,9 +188,9 @@ public class PodcastCreator { ...@@ -188,9 +188,9 @@ public class PodcastCreator {
if (ShowProgressmonitor && !batch && i < recording.messages.size()) { if (ShowProgressmonitor && !batch && i < recording.messages.size()) {
progressMonitor.setProgress(i); progressMonitor.setProgress(i);
} }
if(TTT.verbose){ //if(TTT.verbose){
System.out.println(" Message (" + i + "/" + recording.messages.size() + ")"); // System.out.println(" Message (" + i + "/" + recording.messages.size() + ")");
} //}
//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);
...@@ -200,8 +200,8 @@ public class PodcastCreator { ...@@ -200,8 +200,8 @@ public class PodcastCreator {
ffmpegCmd, ffmpegCmd,
"-loop", "1", "-loop", "1",
"-r", String.valueOf(framesPerSec), "-r", String.valueOf(framesPerSec),
"-i", windowImageFile.getPath().replace(" ", "\\ "),
"-pix_fmt", "rgb24", "-pix_fmt", "rgb24",
"-i", windowImageFile.getPath().replace(" ", "\\ "),
"-vcodec", "mpeg4", "-vcodec", "mpeg4",
"-vframes", String.valueOf(vFrames), "-vframes", String.valueOf(vFrames),
"-s", resolutionWidth + "x" + resolutionHeight, "-s", resolutionWidth + "x" + resolutionHeight,
...@@ -295,9 +295,9 @@ public class PodcastCreator { ...@@ -295,9 +295,9 @@ public class PodcastCreator {
scanner.useDelimiter("[ ]+"); scanner.useDelimiter("[ ]+");
if (scanner.findInLine("frame=") != null && scanner.hasNextInt()){ if (scanner.findInLine("frame=") != null && scanner.hasNextInt()){
int i = scanner.nextInt(); int i = scanner.nextInt();
if(TTT.verbose){ //if(TTT.verbose){
System.out.println(" Frame (" + i + "/" + nFrames + ")"); // System.out.println(" Frame (" + i + "/" + nFrames + ")");
} //}
if(ShowProgressmonitor){ if(ShowProgressmonitor){
progressMonitor.setProgress(i);} progressMonitor.setProgress(i);}
} }
...@@ -309,7 +309,7 @@ public class PodcastCreator { ...@@ -309,7 +309,7 @@ public class PodcastCreator {
exec.createListenerStream(); exec.createListenerStream();
outMovieFile = recording.getFileBySuffix("mp4"); outMovieFile = recording.getFileBySuffix("mp4");
String[] line = new String[] { String[] line = new String[] {
"avconv", ffmpegCmd,
"-i", audioFile.getPath().replace(" ", "\\ "), "-i", audioFile.getPath().replace(" ", "\\ "),
"-i", outMovieTmpFile.getPath().replace(" ", "\\ "), "-i", outMovieTmpFile.getPath().replace(" ", "\\ "),
"-strict","experimental", "-strict","experimental",
......
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