From 57530da214e42f3564b2567b5d8276ecbcaaf6c0 Mon Sep 17 00:00:00 2001 From: Viv Lim Date: Sun, 25 Jul 2021 22:02:40 -0700 Subject: [PATCH] able to record ok-sounding audio from picodrive --- .gitignore | 9 +++++++++ examples/ffmpeg_recorder.rs | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b956f11..6473eaf 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,12 @@ **/*.rs.bk /.idea /Cargo.lock + +*.so +*.dll +*.dylib +*.mp4 +*.ogv +*.gb +*.bin +.DS_Store \ No newline at end of file diff --git a/examples/ffmpeg_recorder.rs b/examples/ffmpeg_recorder.rs index 34d623a..7770848 100644 --- a/examples/ffmpeg_recorder.rs +++ b/examples/ffmpeg_recorder.rs @@ -160,7 +160,7 @@ let wavname = Path::new("out.wav"); av_info.geometry.aspect_ratio = 4.33; } if av_info.timing.sample_rate == 0.0 { - av_info.timing.sample_rate = 32040.0; + av_info.timing.sample_rate = 44100.0; } video_encoder.set_width(av_info.geometry.base_width); video_encoder.set_height(av_info.geometry.base_height); @@ -303,7 +303,7 @@ static bool ffmpeg_init_config(struct ff_config_param *params, ChannelLayout::STEREO ); aframe.set_channels(2); - aframe.set_rate(32040); + aframe.set_rate(44100); let aplane: &mut [(i16, i16)] = aframe.plane_mut(0); eprintln!("Audio buffer length {} -> {}", self.audio_buf.len(), aplane.len()); aplane.copy_from_slice(self.audio_buf.as_ref()); @@ -355,9 +355,9 @@ static bool ffmpeg_init_config(struct ff_config_param *params, } pub fn end(&mut self) { - self.video_encoder.send_eof().unwrap(); + self.video_encoder.send_eof(); self.receive_and_write_packets(EncoderToWriteFrom::Video); - self.audio_encoder.send_eof().unwrap(); + self.audio_encoder.send_eof(); self.receive_and_write_packets(EncoderToWriteFrom::Audio); self.octx.write_trailer().unwrap(); }