@@ -5,6 +5,9 @@ A mod that lets developers easily interact with ffmpeg to record raw videos, and
5
5
6
6
### Record videos
7
7
8
+ <details >
9
+ <summary >Normal API</summary >
10
+
8
11
``` cpp
9
12
#include < eclipse.ffmpeg-api/include/recorder.hpp>
10
13
@@ -35,8 +38,48 @@ void video() {
35
38
}
36
39
```
37
40
41
+ </details >
42
+
43
+ <details >
44
+ <summary >Event-based API</summary >
45
+
46
+ ``` cpp
47
+ #include < events.hpp>
48
+
49
+ void video () {
50
+ ffmpeg::events::Recorder recorder;
51
+
52
+ ffmpeg::RenderSettings settings;
53
+
54
+ //ffmpeg-api will automatically handle conversion between the input pixel
55
+ //format and the codec's pixel format
56
+ settings.m_pixelFormat = PixelFormat::RGB0;
57
+ settings.m_codec = "h264_nvenc"; //fetch codecs using recorder.getAvailableCodecs()
58
+ settings.m_bitrate = 30000000;
59
+ settings.m_width = 1920;
60
+ settings.m_height = 1080;
61
+ settings.m_fps = 60;
62
+ settings.m_outputFile = "output_video.mp4";
63
+
64
+ //insert your raw data here
65
+ std::vector<uint8_t> frame;
66
+
67
+ recorder.init(settings);
68
+
69
+ for(int i = 0; i < 60; i++)
70
+ recorder.writeFrame(frame);
71
+
72
+ recorder.stop();
73
+ }
74
+ ```
75
+
76
+ </details >
77
+
38
78
### Mix audio
39
79
80
+ <details >
81
+ <summary >Normal API</summary >
82
+
40
83
``` cpp
41
84
#include < eclipse.ffmpeg-api/include/audio_mixer.hpp>
42
85
@@ -51,10 +94,35 @@ void audioRaw() {
51
94
52
95
//insert your raw data here
53
96
std::vector<float> raw;
54
- mixer.mixVideoRaw("video.mp4", raw, "output_raw.mp4", 44100 );
97
+ mixer.mixVideoRaw("video.mp4", raw, "output_raw.mp4");
55
98
}
56
99
```
57
100
101
+ </details >
102
+
103
+ <details >
104
+ <summary >Event-based API</summary >
105
+
106
+ ``` cpp
107
+ #include < events.hpp>
108
+
109
+ void audioFile () {
110
+ ffmpeg::events::AudioMixer mixer;
111
+ mixer.mixVideoAudio("video.mp4", "audio.mp3", "output_mp3.mp4");
112
+ mixer.mixVideoAudio("video.mp4", "audio.wav", "output_wav.mp4");
113
+ }
114
+
115
+ void audioRaw () {
116
+ ffmpeg::events::AudioMixer mixer;
117
+
118
+ //insert your raw data here
119
+ std::vector<float> raw;
120
+ mixer.mixVideoRaw("video.mp4", raw, "output_raw.mp4");
121
+ }
122
+ ```
123
+
124
+ </details >
125
+
58
126
## Build instructions
59
127
### Windows
60
128
To get the needed libraries on Windows, you can use vcpkg:
0 commit comments