Skip to content

Commit

Permalink
smaller output file & open in file explorer button
Browse files Browse the repository at this point in the history
  • Loading branch information
leomotors committed Aug 21, 2021
1 parent 4131b5e commit c7b1e62
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16)
project(RTX-2090-TiFy VERSION 1.0.44.7)
project(RTX-2090-TiFy VERSION 1.0.52)
set(APP_VERSION "${CMAKE_PROJECT_VERSION}")
configure_file(config/AppProps.h.in ${CMAKE_CURRENT_BINARY_DIR}/gen/AppProps.h)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Also, My First GUI Program on C++

## 🌿 Dependencies

- [wxWidgets 3.1.5 (C++ Library)](https://github.com/wxWidgets/wxWidgets)
- [wxWidgets 3.1.5 (C++ Library)](https://github.com/wxWidgets/wxWidgets) with FFmpeg Enabled
- [OpenCV 4.5.3 (C++ Library)](https://github.com/opencv/opencv)
- [FFmpeg (Command Line)](https://github.com/FFmpeg/FFmpeg)
- Compiler: Require C++20 and #pragma once (should exist everywhere?)
Expand Down
3 changes: 2 additions & 1 deletion inc/Events.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ enum EventsID
OPEN_FILE_BUTTON = 69,
SAVE_FILE_BUTTON = 420,
WARPSET_BUTTON = 1337,
GENERATE_BUTTON = 69420
GENERATE_BUTTON = 69420,
OPEN_IN_FILE_EXPLORER = 177013
};
1 change: 1 addition & 0 deletions inc/MyFrame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class MyFrame : public wxFrame
void OnSaveFile(wxCommandEvent &event);
void OnAdvanced(wxCommandEvent &event);
void OnGenerate(wxCommandEvent &event);
void OnFileExplorer(wxCommandEvent &event);

wxDECLARE_EVENT_TABLE();
};
4 changes: 1 addition & 3 deletions inc/Video.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

#include <string>

#include "AppConstants.h"

namespace Video
{
void linkAudio(std::string input, std::string output);
void linkAudio(std::string fileName);
}
1 change: 1 addition & 0 deletions src/Events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_BUTTON(SAVE_FILE_BUTTON, MyFrame::OnSaveFile)
EVT_BUTTON(WARPSET_BUTTON, MyFrame::OnAdvanced)
EVT_BUTTON(GENERATE_BUTTON, MyFrame::OnGenerate)
EVT_BUTTON(OPEN_IN_FILE_EXPLORER, MyFrame::OnFileExplorer)
wxEND_EVENT_TABLE();
// clang-format on
10 changes: 10 additions & 0 deletions src/MyFrame.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "MyFrame.hpp"

#include <cstdlib>
#include <opencv2/opencv.hpp>
#include <wx/listctrl.h>
#include <wx/wx.h>
Expand Down Expand Up @@ -37,6 +38,7 @@ MyFrame::MyFrame(const wxString &title, const wxPoint &pos, const wxSize &size)
mainColumn->Add(FileInputRow, 0, wxCENTER | wxLEFT | wxRIGHT | wxUP, 10);

// * Sub-Row: Configuration List
mainColumn->Add(new wxStaticText(this, wxID_ANY, "Your Configurations:"), 0, wxLEFT | wxUP, 10);
mainColumn->Add(ConfigList.getListView(), 4, wxEXPAND | wxALL, 10);

// * Sub-Row: Action Buttons
Expand All @@ -45,6 +47,8 @@ MyFrame::MyFrame(const wxString &title, const wxPoint &pos, const wxSize &size)
wxSTRETCH_NOT | wxALIGN_LEFT, 30);
buttonBar->Add(new wxButton(this, GENERATE_BUTTON, "Generate!"), 0,
wxSTRETCH_NOT | wxALIGN_RIGHT, 30);
buttonBar->Add(new wxButton(this, OPEN_IN_FILE_EXPLORER, "Open in File Explorer"), 0,
wxALIGN_RIGHT, 30);

mainColumn->Add(buttonBar, 0, wxEXPAND | wxALL, 5);

Expand Down Expand Up @@ -146,3 +150,9 @@ void MyFrame::OnGenerate(wxCommandEvent &event)

return;
}

void MyFrame::OnFileExplorer(wxCommandEvent &event)
{
// TODO go to exports directory based on settings, Support other file explorer
std::system("explorer.exe .");
}
2 changes: 1 addition & 1 deletion src/RTX2090Ti.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ bool RTX2090Ti::buildVideo()
OutVideo.release();
std::cout << "Video Build Success\n";

Video::linkAudio(Config.OutVideoPath + ".avi", Config.OutVideoPath + ".mp4");
Video::linkAudio(Config.OutVideoPath);

auto end{std::chrono::steady_clock::now()};

Expand Down
27 changes: 19 additions & 8 deletions src/Video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,27 @@
#include <iostream>
#include <string>

void Video::linkAudio(std::string input, std::string output)
#include "AppConstants.h"

void Video::linkAudio(std::string fileName)
{
std::string toExec("ffmpeg -y -i ");
toExec += input + " -i " + RTX_MUSIC +
" -b:a 384k -map 0:v:0 -map 1:a:0 -c:v "
"copy -shortest -b:v 1024k ";
toExec += output;
// TODO Make Bitrate adjustable
std::string lowerBitrateCommand = "ffmpeg -y -i " + fileName +
".avi -b:v 1024k -minrate 128k -maxrate 16M " + fileName +
".temp.avi";

std::cout << "Executing: " << lowerBitrateCommand << "\n";
std::system(lowerBitrateCommand.c_str());

std::string linkAudioCommand("ffmpeg -y -i ");
linkAudioCommand += fileName + ".temp.avi -i " + RTX_MUSIC +
" -b:a 384k -map 0:v:0 -map 1:a:0 -c:v "
"copy -shortest ";
linkAudioCommand += fileName + ".mp4";

std::cout << "Executing: " << linkAudioCommand << "\n";
std::system(linkAudioCommand.c_str());

std::cout << "Executing: " << toExec << "\n";
std::system(toExec.c_str());
std::cout << "FFmpeg: Linking Audio Success\n";
return;
}

0 comments on commit c7b1e62

Please sign in to comment.