Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpacifico authored Nov 24, 2024
1 parent 75c1a25 commit 130d84e
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 82 deletions.
28 changes: 14 additions & 14 deletions src/application/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public Settings() {
txtImageDuration.setName("txtImageDuration");
comboLanguage.setName("comboLanguage");

frame.setSize(370, 742);
frame.setSize(370, 750);
if (Shutter.getLanguage.equals(Locale.of("ru").getDisplayLanguage()) || Shutter.getLanguage.equals(Locale.of("uk").getDisplayLanguage()))
{
frame.setSize(frame.getWidth() + 50, frame.getHeight());
Expand Down Expand Up @@ -484,24 +484,24 @@ public void actionPerformed(ActionEvent arg0) {

if (Settings.txtCustomFFmpegPath.getText().equals("") == false)
{
VideoPlayer.PathToFFMPEG = Settings.txtCustomFFmpegPath.getText();
FFMPEG.PathToFFMPEG = Settings.txtCustomFFmpegPath.getText();
}
}
else
{
txtCustomFFmpegPath.setEnabled(false);

VideoPlayer.PathToFFMPEG = Shutter.class.getProtectionDomain().getCodeSource().getLocation().getPath();
FFMPEG.PathToFFMPEG = Shutter.class.getProtectionDomain().getCodeSource().getLocation().getPath();

if (System.getProperty("os.name").contains("Windows"))
{
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(1,VideoPlayer.PathToFFMPEG.length()-1);
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(0,(int) (VideoPlayer.PathToFFMPEG.lastIndexOf("/"))).replace("%20", " ") + "\\Library\\ffmpeg.exe";
FFMPEG.PathToFFMPEG = FFMPEG.PathToFFMPEG.substring(1,FFMPEG.PathToFFMPEG.length()-1);
FFMPEG.PathToFFMPEG = FFMPEG.PathToFFMPEG.substring(0,(int) (FFMPEG.PathToFFMPEG.lastIndexOf("/"))).replace("%20", " ") + "\\Library\\ffmpeg.exe";
}
else
{
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(0,VideoPlayer.PathToFFMPEG.length()-1);
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(0,(int) (VideoPlayer.PathToFFMPEG.lastIndexOf("/"))).replace("%20", "\\ ") + "/Library/ffmpeg";
FFMPEG.PathToFFMPEG = FFMPEG.PathToFFMPEG.substring(0,FFMPEG.PathToFFMPEG.length()-1);
FFMPEG.PathToFFMPEG = FFMPEG.PathToFFMPEG.substring(0,(int) (FFMPEG.PathToFFMPEG.lastIndexOf("/"))).replace("%20", "\\ ") + "/Library/ffmpeg";
}
}

Expand Down Expand Up @@ -542,24 +542,24 @@ public void keyReleased(KeyEvent e) {

if (Settings.txtCustomFFmpegPath.getText().equals("") == false)
{
VideoPlayer.PathToFFMPEG = Settings.txtCustomFFmpegPath.getText();
FFMPEG.PathToFFMPEG = Settings.txtCustomFFmpegPath.getText();
}
}
else
{
txtCustomFFmpegPath.setEnabled(false);

VideoPlayer.PathToFFMPEG = Shutter.class.getProtectionDomain().getCodeSource().getLocation().getPath();
FFMPEG.PathToFFMPEG = Shutter.class.getProtectionDomain().getCodeSource().getLocation().getPath();

if (System.getProperty("os.name").contains("Windows"))
{
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(1,VideoPlayer.PathToFFMPEG.length()-1);
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(0,(int) (VideoPlayer.PathToFFMPEG.lastIndexOf("/"))).replace("%20", " ") + "\\Library\\ffmpeg.exe";
FFMPEG.PathToFFMPEG = FFMPEG.PathToFFMPEG.substring(1,FFMPEG.PathToFFMPEG.length()-1);
FFMPEG.PathToFFMPEG = FFMPEG.PathToFFMPEG.substring(0,(int) (FFMPEG.PathToFFMPEG.lastIndexOf("/"))).replace("%20", " ") + "\\Library\\ffmpeg.exe";
}
else
{
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(0,VideoPlayer.PathToFFMPEG.length()-1);
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(0,(int) (VideoPlayer.PathToFFMPEG.lastIndexOf("/"))).replace("%20", "\\ ") + "/Library/ffmpeg";
FFMPEG.PathToFFMPEG = FFMPEG.PathToFFMPEG.substring(0,FFMPEG.PathToFFMPEG.length()-1);
FFMPEG.PathToFFMPEG = FFMPEG.PathToFFMPEG.substring(0,(int) (FFMPEG.PathToFFMPEG.lastIndexOf("/"))).replace("%20", "\\ ") + "/Library/ffmpeg";
}
}

Expand Down Expand Up @@ -1774,7 +1774,7 @@ else if (eElement.getElementsByTagName("Name").item(0).getFirstChild().getTextCo
//customFFmpeg
if (btnCustomFFmpegPath.isSelected() && txtCustomFFmpegPath.getText().equals("") == false)
{
VideoPlayer.PathToFFMPEG = txtCustomFFmpegPath.getText();
FFMPEG.PathToFFMPEG = txtCustomFFmpegPath.getText();
}
}
}
Expand Down
30 changes: 18 additions & 12 deletions src/application/Shutter.java
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,9 @@ public void windowStateChanged(WindowEvent arg0) {
Settings.txtThreads.setText("0");
Settings.txtImageDuration.setText("10");

//Initialize FFmpeg path
FFMPEG.getFFmpegPath();

Splash.increment();
topPanel();
Splash.increment();
Expand Down Expand Up @@ -23986,23 +23989,26 @@ public static void enfOfFunction() {
scrollPane.getViewport().setOpaque(false);
scrollPane.setPreferredSize( new Dimension( 500, 400 ) );

Object[] moreInfo = {"OK", language.getProperty("menuItemConsole")};

int result = JOptionPane.showOptionDialog(Shutter.frame, scrollPane, Shutter.language.getProperty("notProcessedFiles"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, moreInfo, null);

if (result == JOptionPane.NO_OPTION)
if (scanIsRunning == false)
{
if (Console.frmConsole != null)
Object[] moreInfo = {"OK", language.getProperty("menuItemConsole")};

int result = JOptionPane.showOptionDialog(Shutter.frame, scrollPane, Shutter.language.getProperty("notProcessedFiles"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, moreInfo, null);

if (result == JOptionPane.NO_OPTION)
{
if (Console.frmConsole.isVisible())
if (Console.frmConsole != null)
{
Console.frmConsole.toFront();
}
if (Console.frmConsole.isVisible())
{
Console.frmConsole.toFront();
}
else
new Console();
}
else
new Console();
}
else
new Console();
}
}

if (RenderQueue.frame != null && RenderQueue.frame.isVisible())
Expand Down
41 changes: 12 additions & 29 deletions src/application/VideoPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
public class VideoPlayer {

//Player
public static String PathToFFMPEG = Shutter.class.getProtectionDomain().getCodeSource().getLocation().getPath();
public static JPanel player;
public static Process playerVideo;
public static Process bufferVideo;
Expand Down Expand Up @@ -227,22 +226,6 @@ public VideoPlayer() {

showInfoMessage = true;

if (System.getProperty("os.name").contains("Windows"))
{
PathToFFMPEG = PathToFFMPEG.substring(1,PathToFFMPEG.length()-1);
PathToFFMPEG = PathToFFMPEG.substring(0,(int) (PathToFFMPEG.lastIndexOf("/"))).replace("%20", " ") + "\\Library\\ffmpeg.exe";
}
else
{
PathToFFMPEG = PathToFFMPEG.substring(0,PathToFFMPEG.length()-1);
PathToFFMPEG = PathToFFMPEG.substring(0,(int) (PathToFFMPEG.lastIndexOf("/"))).replace("%20", "\\ ") + "/Library/ffmpeg";
}

if (Settings.btnCustomFFmpegPath.isSelected() && Settings.txtCustomFFmpegPath.getText().equals("") == false)
{
PathToFFMPEG = Settings.txtCustomFFmpegPath.getText();
}

GraphicsConfiguration config = Shutter.frame.getGraphicsConfiguration();
GraphicsDevice myScreen = config.getDevice();
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
Expand Down Expand Up @@ -611,26 +594,26 @@ public static void playerProcess(float inputTime) {
if (System.getProperty("os.name").contains("Windows"))
{
//VIDEO STREAM
ProcessBuilder pbv = new ProcessBuilder("cmd.exe" , "/c", '"' + PathToFFMPEG + '"' + setVideoCommand(inputTime, player.getWidth(), player.getHeight(), playerPlayVideo));
ProcessBuilder pbv = new ProcessBuilder("cmd.exe" , "/c", '"' + FFMPEG.PathToFFMPEG + '"' + setVideoCommand(inputTime, player.getWidth(), player.getHeight(), playerPlayVideo));
playerVideo = pbv.start();

//AUDIO STREAM
if ((casePlaySound.isSelected() && inputTime > 0 && (mouseIsPressed == false || FFPROBE.audioOnly)) || mouseIsPressed == false)
{
ProcessBuilder pba = new ProcessBuilder("cmd.exe" , "/c", '"' + PathToFFMPEG + '"' + setAudioCommand(inputTime, false));
ProcessBuilder pba = new ProcessBuilder("cmd.exe" , "/c", '"' + FFMPEG.PathToFFMPEG + '"' + setAudioCommand(inputTime, false));
playerAudio = pba.start();
}
}
else
{
//VIDEO STREAM
ProcessBuilder pbv = new ProcessBuilder("/bin/bash", "-c", PathToFFMPEG + setVideoCommand(inputTime, player.getWidth(), player.getHeight(), playerPlayVideo));
ProcessBuilder pbv = new ProcessBuilder("/bin/bash", "-c", FFMPEG.PathToFFMPEG + setVideoCommand(inputTime, player.getWidth(), player.getHeight(), playerPlayVideo));
playerVideo = pbv.start();

//AUDIO STREAM
if ((casePlaySound.isSelected() && inputTime > 0 && (mouseIsPressed == false || FFPROBE.audioOnly)) || mouseIsPressed == false)
{
ProcessBuilder pba = new ProcessBuilder("/bin/bash", "-c", PathToFFMPEG + setAudioCommand(inputTime, false));
ProcessBuilder pba = new ProcessBuilder("/bin/bash", "-c", FFMPEG.PathToFFMPEG + setAudioCommand(inputTime, false));
playerAudio = pba.start();
}
}
Expand Down Expand Up @@ -811,13 +794,13 @@ private static void playerPlayAudioOnly(float inputTime) {
if (System.getProperty("os.name").contains("Windows"))
{
//AUDIO STREAM
ProcessBuilder pba = new ProcessBuilder("cmd.exe" , "/c", '"' + PathToFFMPEG + '"' + setAudioCommand(inputTime, true));
ProcessBuilder pba = new ProcessBuilder("cmd.exe" , "/c", '"' + FFMPEG.PathToFFMPEG + '"' + setAudioCommand(inputTime, true));
playerAudio = pba.start();
}
else
{
//AUDIO STREAM
ProcessBuilder pba = new ProcessBuilder("/bin/bash", "-c", PathToFFMPEG + setAudioCommand(inputTime, true));
ProcessBuilder pba = new ProcessBuilder("/bin/bash", "-c", FFMPEG.PathToFFMPEG + setAudioCommand(inputTime, true));
playerAudio = pba.start();
}

Expand Down Expand Up @@ -1154,7 +1137,7 @@ public static void setMedia() {
{
@Override
public void run()
{
{
if (FFMPEG.isRunning == false
|| (Shutter.btnStart.getText().equals(Shutter.language.getProperty("btnPauseFunction")) == false
&& Shutter.btnStart.getText().equals(Shutter.language.getProperty("resume")) == false
Expand Down Expand Up @@ -1189,7 +1172,7 @@ public void run()
}

//Reset when changing file
if (Shutter.fileList.getSelectedValue().equals(videoPath) == false)
if (Shutter.fileList.getSelectedValue().equals(videoPath) == false && (new File(Shutter.fileList.getSelectedValue()).isFile() || Shutter.scanIsRunning))
{
//IMPORTANT
if (FFPROBE.isRunning)
Expand Down Expand Up @@ -2037,10 +2020,10 @@ else if (System.getProperty("os.name").contains("Mac"))

if (System.getProperty("os.name").contains("Windows"))
{
codec = VideoEncoders.setCodec() + VideoEncoders.setBitrate() + AdvancedFeatures.setPreset() + yadif + freezeFrame + " -an -f " + format + " pipe:1 | " + '"' + PathToFFMPEG + '"' + " -v quiet -hide_banner -i pipe:0" + setFilter("", speed, false);
codec = VideoEncoders.setCodec() + VideoEncoders.setBitrate() + AdvancedFeatures.setPreset() + yadif + freezeFrame + " -an -f " + format + " pipe:1 | " + '"' + FFMPEG.PathToFFMPEG + '"' + " -v quiet -hide_banner -i pipe:0" + setFilter("", speed, false);
}
else
codec = VideoEncoders.setCodec() + VideoEncoders.setBitrate() + AdvancedFeatures.setPreset() + yadif + freezeFrame + " -an -f " + format + " pipe:1 | " + PathToFFMPEG + " -v quiet -hide_banner -i pipe:0" + setFilter("", speed, false);
codec = VideoEncoders.setCodec() + VideoEncoders.setBitrate() + AdvancedFeatures.setPreset() + yadif + freezeFrame + " -an -f " + format + " pipe:1 | " + FFMPEG.PathToFFMPEG + " -v quiet -hide_banner -i pipe:0" + setFilter("", speed, false);

cmd = gpuDecoding + Colorimetry.setInputCodec(extension) + " -strict -2 -v quiet -hide_banner -ss " + (long) (inputTime * inputFramerateMS) + "ms" + concat + " -i " + '"' + video + '"' + " -r " + FFPROBE.currentFPS + codec + freezeFrame + " -c:v bmp -an -f image2pipe -";
}
Expand Down Expand Up @@ -5195,12 +5178,12 @@ private static void generatePreview(String cmd) {

if (System.getProperty("os.name").contains("Windows"))
{
ProcessBuilder pbv = new ProcessBuilder("cmd.exe" , "/c", '"' + PathToFFMPEG + '"' + cmd);
ProcessBuilder pbv = new ProcessBuilder("cmd.exe" , "/c", '"' + FFMPEG.PathToFFMPEG + '"' + cmd);
process = pbv.start();
}
else
{
ProcessBuilder pbv = new ProcessBuilder("/bin/bash", "-c", PathToFFMPEG + cmd);
ProcessBuilder pbv = new ProcessBuilder("/bin/bash", "-c", FFMPEG.PathToFFMPEG + cmd);
process = pbv.start();
}

Expand Down
4 changes: 2 additions & 2 deletions src/functions/Picture.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,12 @@ public void run() {
Process process;
if (System.getProperty("os.name").contains("Windows"))
{
ProcessBuilder pbv = new ProcessBuilder('"' + VideoPlayer.PathToFFMPEG + '"' + " -v quiet -hide_banner -i pipe:0" + logo + cmd + '"' + fileOut + '"');
ProcessBuilder pbv = new ProcessBuilder('"' + FFMPEG.PathToFFMPEG + '"' + " -v quiet -hide_banner -i pipe:0" + logo + cmd + '"' + fileOut + '"');
process = pbv.start();
}
else
{
ProcessBuilder pbv = new ProcessBuilder("/bin/bash", "-c", VideoPlayer.PathToFFMPEG + " -v quiet -hide_banner -i pipe:0" + logo + cmd + '"' + fileOut + '"');
ProcessBuilder pbv = new ProcessBuilder("/bin/bash", "-c", FFMPEG.PathToFFMPEG + " -v quiet -hide_banner -i pipe:0" + logo + cmd + '"' + fileOut + '"');
process = pbv.start();
}

Expand Down
Loading

0 comments on commit 130d84e

Please sign in to comment.