@@ -44,8 +44,10 @@ const FFMPEG_MACOS_RELEASE_URL: &str = "https://evermeet.cx/ffmpeg/ffmpeg-{}.zip
44
44
const FFMPEG_RECORD_FRAME_RATE : & str = "30" ;
45
45
const FFMPEG_RECORD_DESKTOP_WINDOWS_COMMAND : & str = "{} -f gdigrab -i desktop -r {} -q:v 1 -y {}" ;
46
46
const FFMPEG_RECORD_DESKTOP_LINUX_COMMAND : & str = "{} -f x11grab -i {} -r {} -vcodec huffyuv -y {}" ;
47
- const FFMPEG_RECORD_DESKTOP_MACOS_COMMAND : & str = r#"{} -f avfoundation -video_device_index 0 -r {} -y {}"# ;
48
- const FFMPEG_RECORDING_EXTENSION : & str = "avi" ;
47
+ const FFMPEG_RECORD_DESKTOP_MACOS_COMMAND : & str =
48
+ r#"{} -f avfoundation -video_device_index 0 -r {} -y {}"# ;
49
+ const FFMPEG_RECORDING_EXTENSION_AVI : & str = "avi" ;
50
+ const FFMPEG_RECORDING_EXTENSION_MKV : & str = "mkv" ;
49
51
const FFMPEG_RECORDING_FOLDER : & str = "recordings" ;
50
52
const FFMPEG_DEFAULT_DISPLAY : & str = ":0" ;
51
53
@@ -189,9 +191,14 @@ pub fn uncompress_ffmpeg(
189
191
Ok ( ( ) )
190
192
}
191
193
192
- fn get_recording_name ( ) -> String {
194
+ fn get_recording_name ( os : & str ) -> String {
193
195
let now = chrono:: Local :: now ( ) ;
194
- now. format ( "%Y-%m-%d_%H-%M-%S" ) . to_string ( ) + "." + FFMPEG_RECORDING_EXTENSION
196
+ let extension = if MACOS . is ( os) {
197
+ FFMPEG_RECORDING_EXTENSION_MKV
198
+ } else {
199
+ FFMPEG_RECORDING_EXTENSION_AVI
200
+ } ;
201
+ now. format ( "%Y-%m-%d_%H-%M-%S" ) . to_string ( ) + "." + extension
195
202
}
196
203
197
204
pub fn record_desktop_with_ffmpeg (
@@ -202,7 +209,7 @@ pub fn record_desktop_with_ffmpeg(
202
209
) -> Result < ( ) , Error > {
203
210
let recording_target = cache_path
204
211
. join ( FFMPEG_RECORDING_FOLDER )
205
- . join ( get_recording_name ( ) ) ;
212
+ . join ( get_recording_name ( os ) ) ;
206
213
let recording_name = path_to_string ( & recording_target) ;
207
214
create_parent_path_if_not_exists ( & recording_target) ?;
208
215
0 commit comments