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 10, 2024
1 parent 7f8f8f0 commit 9c8af74
Show file tree
Hide file tree
Showing 18 changed files with 157 additions and 40 deletions.
81 changes: 65 additions & 16 deletions src/application/Shutter.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ public class Shutter {
protected static boolean subtitlesBurn = true;
public static boolean autoBurn = false;
public static boolean autoEmbed = false;
private static boolean cutKeyframesIsDisplayed = false;
private static boolean rewrapKeyframesIsDisplayed = false;
private static boolean conformKeyframesIsDisplayed = false;
public static StringBuilder errorList = new StringBuilder();
public static NumberFormat formatter = new DecimalFormat("00");
public static NumberFormat formatterToMs = new DecimalFormat("000");
Expand Down Expand Up @@ -1077,12 +1080,23 @@ public void itemStateChanged(ItemEvent e) {
changeFunction(true);
changeFilters();

if (Shutter.comboFonctions.getSelectedItem().toString().equals(Shutter.language.getProperty("functionCut"))
|| Shutter.comboFonctions.getSelectedItem().toString().equals(Shutter.language.getProperty("functionRewrap"))
|| Shutter.comboFonctions.getSelectedItem().toString().equals(Shutter.language.getProperty("functionConform")))
{
if (Settings.btnDisableVideoPlayer.isSelected() == false)
if (Settings.btnDisableVideoPlayer.isSelected() == false)
{
if (Shutter.comboFonctions.getSelectedItem().toString().equals(Shutter.language.getProperty("functionCut")) && cutKeyframesIsDisplayed == false)
{
JOptionPane.showMessageDialog(frame, language.getProperty("cutOnKeyframesOnly"), comboFonctions.getSelectedItem().toString(), JOptionPane.INFORMATION_MESSAGE);
cutKeyframesIsDisplayed = true;
}
else if (Shutter.comboFonctions.getSelectedItem().toString().equals(Shutter.language.getProperty("functionRewrap")) && rewrapKeyframesIsDisplayed == false)
{
JOptionPane.showMessageDialog(frame, language.getProperty("cutOnKeyframesOnly"), comboFonctions.getSelectedItem().toString(), JOptionPane.INFORMATION_MESSAGE);
rewrapKeyframesIsDisplayed = true;
}
else if (Shutter.comboFonctions.getSelectedItem().toString().equals(Shutter.language.getProperty("functionConform")) && conformKeyframesIsDisplayed == false)
{
JOptionPane.showMessageDialog(frame, language.getProperty("cutOnKeyframesOnly"), comboFonctions.getSelectedItem().toString(), JOptionPane.INFORMATION_MESSAGE);
conformKeyframesIsDisplayed = true;
}
}

if (VideoPlayer.btnPlay.isVisible() && liste.getSize() > 0)
Expand Down Expand Up @@ -4046,6 +4060,18 @@ public void run() {
if (FFMPEG.error == false)
graphicsAccel.add("AMD AMF Encoder");
}
else if (System.getProperty("os.name").contains("Mac"))
{
FFMPEG.hwaccel("-f lavfi -i nullsrc -t 1 -c:v av1_videotoolbox -s 640x360 -f null -");
do {
try {
Thread.sleep(10);
} catch (InterruptedException e) {}
} while (FFMPEG.runProcess.isAlive());

if (FFMPEG.error == false)
graphicsAccel.add("OSX VideoToolbox");
}

if (comboAccel.getModel().getSize() != graphicsAccel.size())
{
Expand Down Expand Up @@ -6684,12 +6710,7 @@ else if (comboAudioCodec.getSelectedItem().toString().equals("Opus"))

if (comboFonctions.getSelectedItem().toString().contains("H.26"))
{
if (comboAudioCodec.getSelectedItem().toString().contains("PCM"))
{
comboFilter.setSelectedIndex(1);
lblAudioKbs.setVisible(true);
}
else if (comboAudioCodec.getSelectedItem().toString().contains("FLAC"))
if (comboAudioCodec.getSelectedItem().toString().contains("FLAC"))
{
comboFilter.setSelectedIndex(2);
lblAudioKbs.setVisible(false);
Expand Down Expand Up @@ -9564,6 +9585,7 @@ public void mouseMoved(MouseEvent e) {
text.setSize(grpOverlay.getWidth() - text.getX() - 10, 21);
text.setHorizontalAlignment(SwingConstants.LEFT);
text.setFont(new Font("SansSerif", Font.PLAIN, 12));
text.setToolTipText("<html>{codec/function}<br>{preset}<br>{resolution/scale}<br>{width}<br>{height}<br>{ratio/aspect}<br>{framerate/fps}<br>{bitrate}<br>{timecode}<br>{duration/time}<br>{date}</html>");
grpOverlay.add(text);

text.addKeyListener(new KeyListener(){
Expand Down Expand Up @@ -9675,7 +9697,9 @@ protected void paintComponent(Graphics g)
String str = new File(file).getName().replace(ext, "");

if (caseAddText.isSelected())
str = text.getText();
{
str = FunctionUtils.setSuffix(text.getText(), true);
}

Rectangle bounds = getStringBounds(g2, str, 0 ,0);

Expand Down Expand Up @@ -18266,7 +18290,7 @@ public void actionPerformed(ActionEvent arg0) {
comboForcePreset.setSelectedIndex(3);
}
}
else if (comboAccel.getSelectedItem().equals("AMD AMF Encoder") || comboAccel.getSelectedItem().equals("OSX VideoToolbox"))
else if (comboAccel.getSelectedItem().equals("AMD AMF Encoder") || comboAccel.getSelectedItem().equals("OSX VideoToolbox") || comboAccel.getSelectedItem().equals("Vulkan Video"))
{
caseForcePreset.setSelected(false);
caseForcePreset.setEnabled(false);
Expand Down Expand Up @@ -20659,6 +20683,14 @@ else if ("H.266".equals(comboFonctions.getSelectedItem().toString()))
if (FFMPEG.error == false)
graphicsAccel.add("AMD AMF Encoder");

FFMPEG.hwaccel("-f lavfi -i nullsrc -t 1 -c:v " + codec + "_vulkan -s 640x360 -f null -" + '"');
do {
Thread.sleep(10);
} while (FFMPEG.runProcess.isAlive());

if (FFMPEG.error == false)
graphicsAccel.add("Vulkan Video");

/*
if (codec == "hevc")
{
Expand Down Expand Up @@ -20830,7 +20862,7 @@ else if (comboForceProfile.getModel().getSize() != 3 || comboForceProfile.getMod
comboForcePreset.setSelectedIndex(3);
}
}
else if (comboAccel.getSelectedItem().equals("AMD AMF Encoder") || comboAccel.getSelectedItem().equals("OSX VideoToolbox"))
else if (comboAccel.getSelectedItem().equals("AMD AMF Encoder") || comboAccel.getSelectedItem().equals("OSX VideoToolbox") || comboAccel.getSelectedItem().equals("Vulkan Video"))
{
caseForcePreset.setSelected(false);
caseForcePreset.setEnabled(false);
Expand Down Expand Up @@ -21251,6 +21283,18 @@ else if ("AV1".equals(comboFonctions.getSelectedItem().toString()))
if (FFMPEG.error == false)
graphicsAccel.add("AMD AMF Encoder");
}
else if (System.getProperty("os.name").contains("Mac"))
{
FFMPEG.hwaccel("-f lavfi -i nullsrc -t 1 -c:v av1_videotoolbox -s 640x360 -f null -");
do {
try {
Thread.sleep(10);
} catch (InterruptedException e) {}
} while (FFMPEG.runProcess.isAlive());

if (FFMPEG.error == false)
graphicsAccel.add("OSX VideoToolbox");
}
}

if (comboAccel.getModel().getSize() != graphicsAccel.size())
Expand Down Expand Up @@ -23099,7 +23143,10 @@ else if (tabs == 6)
}

public static void disableAll() {


Utils.disableSleepMode = false;
Utils.disableSleepMode();

Component[] components = frame.getContentPane().getComponents();

if (scanIsRunning) {
Expand Down Expand Up @@ -23266,6 +23313,8 @@ public static void disableAll() {

public static void enableAll() {

Utils.disableSleepMode = true;

Component[] components = frame.getContentPane().getComponents();

if (scanIsRunning) {
Expand Down Expand Up @@ -23643,7 +23692,7 @@ public static void enableAll() {
case2pass.setEnabled(false);
}

if (comboAccel.getSelectedItem().equals(language.getProperty("aucune").toLowerCase()) == false && (comboAccel.getSelectedItem().equals("AMD AMF Encoder") || comboAccel.getSelectedItem().equals("OSX VideoToolbox")))
if (comboAccel.getSelectedItem().equals(language.getProperty("aucune").toLowerCase()) == false && (comboAccel.getSelectedItem().equals("AMD AMF Encoder") || comboAccel.getSelectedItem().equals("OSX VideoToolbox") || comboAccel.getSelectedItem().equals("Vulkan Video")))
{
caseForcePreset.setSelected(false);
caseForcePreset.setEnabled(false);
Expand Down
31 changes: 31 additions & 0 deletions src/application/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import java.awt.Dimension;
import java.awt.FileDialog;
import java.awt.Insets;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.Robot;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
Expand All @@ -34,6 +37,8 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;

import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
Expand Down Expand Up @@ -88,6 +93,7 @@ public class Utils extends Shutter {
public static Color highlightColor = new Color(129, 198, 253);
public static boolean yesToAll = false;
public static boolean noToAll = false;
public static boolean disableSleepMode = true;
public final static String username = "[email protected]";
public final static String password = "";

Expand Down Expand Up @@ -2193,6 +2199,31 @@ public static void restartApp() {

}

public static void disableSleepMode() {

Timer timer = new Timer();

timer.scheduleAtFixedRate(new TimerTask() {

@Override
public void run() {
try {
// Simulate moving the mouse slightly (1 pixel)
Robot robot = new Robot();
Point currentMousePosition = MouseInfo.getPointerInfo().getLocation();
robot.mouseMove(currentMousePosition.x + 1, currentMousePosition.y + 1);
robot.mouseMove(currentMousePosition.x, currentMousePosition.y);

if (disableSleepMode)
{
timer.cancel();
}

} catch (Exception e) {}
}
}, 0, 60000);
}

public static void killProcesses() {

try {
Expand Down
3 changes: 2 additions & 1 deletion src/application/VideoPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -5344,8 +5344,9 @@ else if (FFMPEG.qsvAvailable && yadif == "")
{
filter += "scale_qsv=" + width + ":" + height + ":mode=low_power,hwdownload,format=" + bitDepth;
}
else if (FFMPEG.videotoolboxAvailable && yadif == "")
else if (FFMPEG.videotoolboxAvailable)
{
filter = filter.replace("yadif", "yadif_videotoolbox");
filter += "scale_vt=" + width + ":" + height + ",hwdownload,format=" + bitDepth;
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/functions/AudioEncoders.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void run() {
String extensionName = "";
if (btnExtension.isSelected())
{
extensionName = FunctionUtils.setSuffix(txtExtension.getText());
extensionName = FunctionUtils.setSuffix(txtExtension.getText(), false);
}

//DRC
Expand Down
2 changes: 1 addition & 1 deletion src/functions/AudioNormalization.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void run() {
String extensionName = "";
if (btnExtension.isSelected())
{
extensionName = FunctionUtils.setSuffix(txtExtension.getText());
extensionName = FunctionUtils.setSuffix(txtExtension.getText(), false);
}

//Output name
Expand Down
11 changes: 9 additions & 2 deletions src/functions/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,16 @@ public void run() {
//Output folder
String labelOutput = FunctionUtils.setOutputDestination("", file);

//Output name
String fileOutputName = labelOutput + "/" + fileName.replace(extension, comboFilter.getEditor().getItem().toString()) ;
//File output name
String extensionName = "";
if (btnExtension.isSelected())
{
extensionName = FunctionUtils.setSuffix(txtExtension.getText(), false);
}

//Output name
String fileOutputName = labelOutput + "/" + fileName.replace(extension, extensionName + comboFilter.getEditor().getItem().toString()) ;

//File output
File fileOut = new File(fileOutputName);
if(fileOut.exists())
Expand Down
2 changes: 1 addition & 1 deletion src/functions/Conform.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void run() {
String extensionName = "";
if (btnExtension.isSelected())
{
extensionName = FunctionUtils.setSuffix(txtExtension.getText());
extensionName = FunctionUtils.setSuffix(txtExtension.getText(), false);
}

//Output name
Expand Down
6 changes: 3 additions & 3 deletions src/functions/Extract.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void run() {

if (btnExtension.isSelected())
{
extensionName = FunctionUtils.setSuffix(txtExtension.getText());
extensionName = FunctionUtils.setSuffix(txtExtension.getText(), false);
}
}
else if (comboFilter.getSelectedItem().toString().equals(language.getProperty("audio")))
Expand All @@ -94,7 +94,7 @@ else if (comboFilter.getSelectedItem().toString().equals(language.getProperty("a

if (btnExtension.isSelected())
{
extensionName = FunctionUtils.setSuffix(txtExtension.getText()) + "_" + (audioStream + 1);
extensionName = FunctionUtils.setSuffix(txtExtension.getText(), false) + "_" + (audioStream + 1);
}
}
else if (comboFilter.getSelectedItem().toString().equals(language.getProperty("subtitles")))
Expand All @@ -103,7 +103,7 @@ else if (comboFilter.getSelectedItem().toString().equals(language.getProperty("s

if (btnExtension.isSelected())
{
extensionName = FunctionUtils.setSuffix(txtExtension.getText()) + "_" + (subStream + 1);
extensionName = FunctionUtils.setSuffix(txtExtension.getText(), false) + "_" + (subStream + 1);
}
}

Expand Down
15 changes: 11 additions & 4 deletions src/functions/Merge.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import library.FFMPEG;
import library.FFPROBE;
import settings.FunctionUtils;
import settings.Timecode;

public class Merge extends Shutter {

Expand Down Expand Up @@ -66,7 +67,9 @@ public void run() {

int totalLength = 0;
frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
PrintWriter writer = new PrintWriter(listeBAB, "UTF-8");
PrintWriter writer = new PrintWriter(listeBAB, "UTF-8");
//Timecode
String timecode = "";

for (int i = 0 ; i < liste.getSize() ; i++)
{
Expand All @@ -91,8 +94,12 @@ public void run() {
try {
Thread.sleep(1);
} catch (InterruptedException e1) {}
} while (FFPROBE.isRunning);

} while (FFPROBE.isRunning);

if (i == 0)
{
timecode = Timecode.setTimecode();
}
totalLength += FFPROBE.totalLength;
FFPROBE.totalLength = 0;

Expand Down Expand Up @@ -123,7 +130,7 @@ public void run() {
openGOP = " -copyinkf";

//Command
String cmd = " -timecode 00:00:00:00" + openGOP + " -video_track_timescale 90000 -c:v copy -c:s copy" + audio + " -map v:0?" + audioMapping + metadatas + " -map s? -y ";
String cmd = timecode + openGOP + " -video_track_timescale 90000 -c:v copy -c:s copy" + audio + " -map v:0?" + audioMapping + metadatas + " -map s? -y ";
FFMPEG.run(" -safe 0 -f concat -i " + '"' + listeBAB.toString() + '"' + cmd + '"' + fileOutputName + '"');

do
Expand Down
6 changes: 5 additions & 1 deletion src/functions/Picture.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public void run() {
String extensionName = "";
if (btnExtension.isSelected())
{
extensionName = FunctionUtils.setSuffix(txtExtension.getText());
extensionName = FunctionUtils.setSuffix(txtExtension.getText(), false);
}

//Container
Expand Down Expand Up @@ -467,6 +467,10 @@ else if (comboAccel.getSelectedItem().equals("AMD AMF Encoder"))
{
encoder = " -c:v av1_amf";
}
else if (comboAccel.getSelectedItem().equals("OSX VideoToolbox"))
{
encoder = " -c:v av1_videotoolbox";
}
}

return encoder + " -crf " + Math.round((float) 63 - (float) ((float) ((float) Integer.valueOf(comboImageOption.getSelectedItem().toString().replace("%", "")) * 63) / 100));
Expand Down
2 changes: 1 addition & 1 deletion src/functions/ReplaceAudio.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private static void main(String audioFiles, String audioExt, File videoFile) thr
String extensionName = "";
if (btnExtension.isSelected())
{
extensionName = FunctionUtils.setSuffix(txtExtension.getText());
extensionName = FunctionUtils.setSuffix(txtExtension.getText(), false);
}

//Output name
Expand Down
2 changes: 1 addition & 1 deletion src/functions/Rewrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void run() {
String extensionName = "";
if (btnExtension.isSelected())
{
extensionName = FunctionUtils.setSuffix(txtExtension.getText());
extensionName = FunctionUtils.setSuffix(txtExtension.getText(), false);
}

//Function cut without re-encoding
Expand Down
Loading

0 comments on commit 9c8af74

Please sign in to comment.