-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultitool-Actions.cpp
More file actions
133 lines (100 loc) · 3.83 KB
/
Multitool-Actions.cpp
File metadata and controls
133 lines (100 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include <iostream>
#include <sstream>
#include <string>
namespace GlobalVariable
{
std::string sVideoFile;
std::string sAudioFile;
char cStringCheck = '\"';
std::string sResultFile(std::string sSourceFile, std::string sAppend)
{
return sSourceFile.insert(sSourceFile.length() - 5, sAppend);
}
std::string sResultFileNewFormat(std::string sSourceFile, std::string sAppend)
{
sSourceFile.erase(sSourceFile.length() - 5); // erasing the original video file format extension (e.g. .mp4) from the length - 5 to the end
return sSourceFile.insert(sSourceFile.length(), sAppend);
}
}
using namespace GlobalVariable;
// FUNCTIONS START HERE -------------------------------------------------------------------------------------------------------------------------------
void FfmpegFinished()
{
std::cout << "FFmpeg finished converting\n\n";
}
void ConvertVideo()
{
std::string sAppend = "-Nuendo";
std::cout << "Please drag and drop the video file to convert :\n";
std::getline(std::cin, sVideoFile);
while ((sVideoFile.at(0) != cStringCheck) || sVideoFile.length() < 4)
{
std::cout << "ERROR: Invalid input \n" << "Please drag and drop the video file to convert :\n";
std::cin.clear();
std::getline(std::cin, sVideoFile);
}
system(("ffmpeg -i " + sVideoFile + " -bf 0 -g 1 " + sResultFile(sVideoFile, sAppend)).c_str());
FfmpegFinished();
}
void ExtractAudio()
{
std::string sAppend = "-WavAudio.wav\"";
std::cout << "Please drag and drop the video file to extract audio track :\n";
std::getline(std::cin, sVideoFile);
while ((sVideoFile.at(0) != cStringCheck) || sVideoFile.length() < 4)
{
std::cout << "ERROR: Invalid input \n" << "Please drag and drop the video file to convert :\n";
std::cin.clear();
std::getline(std::cin, sVideoFile);
}
system(("ffmpeg -i " + sVideoFile + " -vn -c:a pcm_s24le " + sResultFileNewFormat(sVideoFile, sAppend)).c_str());
FfmpegFinished();
}
void CombineVideoAudioWav()
{
std::string sAppend = "-NewAudio.mov\"";
std::cout << "Please drag and drop the video file :\n";
std::getline(std::cin, sVideoFile);
while ((sVideoFile.at(0) != cStringCheck) || sVideoFile.length() < 4)
{
std::cout << "ERROR: Invalid input \n" << "Please drag and drop the video file to convert :\n";
std::cin.clear();
std::getline(std::cin, sVideoFile);
}
std::cout << "\nPlease drag and drop the audio file (WAV only!) : \n";
std::getline(std::cin, sAudioFile);
while ((sAudioFile.at(0) != cStringCheck) || sAudioFile.length() < 4)
{
std::cout << "ERROR: Invalid input \n" << "Please drag and drop the video file to convert :\n";
std::cin.clear();
std::getline(std::cin, sVideoFile);
}
system(("ffmpeg -i " + sVideoFile + " -i " + sAudioFile + " -map 0:v:0 -map 1:a:0 -c:v copy -c:a copy " + sResultFileNewFormat(sVideoFile, sAppend)).c_str());
FfmpegFinished();
}
void CombineVideoAudioAac()
{
std::string sVideoFile = "init";
std::string sAudioFile = "init";
std::string sAppend = "-NewAudio.mp4\"";
std::cout << "Please drag and drop the video file :\n";
std::getline(std::cin, sVideoFile);
std::cout << "\nPlease drag and drop the audio file : \n";
std::getline(std::cin, sAudioFile);
system(("ffmpeg -i " + sVideoFile + " -i " + sAudioFile + " -map 0:v:0 -map 1:a:0 -c:v copy -c:a aac " + sResultFileNewFormat(sVideoFile, sAppend)).c_str());
FfmpegFinished();
}
void ConvertAudioToMp3()
{
std::string sAppend = ".mp3\"";
std::cout << "Please drag and drop the audio file to convert to mp3 :\n";
std::getline(std::cin, sAudioFile);
while ((sAudioFile.at(0) != cStringCheck) || sAudioFile.length() < 4)
{
std::cout << "ERROR: Invalid input \n" << "Please drag and drop the video file to convert :\n";
std::cin.clear();
std::getline(std::cin, sAudioFile);
}
system(("ffmpeg -i " + sAudioFile + " -c:a libmp3lame -q:a 2 " + sResultFileNewFormat(sAudioFile, sAppend)).c_str());
FfmpegFinished();
}