Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rec #30

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ use crate::recording_state::RecordingState;
const AUDIO_SHEBANG: u16 = 1;

const EXPECTED_RP2040_FIRMWARE_HASH: &str = include_str!("../_releases/tc2-firmware.sha256");
const EXPECTED_RP2040_FIRMWARE_VERSION: u32 = 15;
const EXPECTED_RP2040_FIRMWARE_VERSION: u32 = 14;
const EXPECTED_ATTINY_FIRMWARE_VERSION: u8 = 1;

const SEGMENT_LENGTH: usize = 9760;
Expand Down
12 changes: 12 additions & 0 deletions src/save_audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ pub fn save_audio_file_to_disk(mut audio_bytes: Vec<u8>, device_config: DeviceCo
fs::create_dir(&output_dir)
.expect(&format!("Failed to create AAC output directory {}", output_dir));
}
let debug_dir = String::from("/home/pi/temp");
if !fs::exists(&debug_dir).unwrap_or(false) {
fs::create_dir(&debug_dir)
.expect(&format!("Failed to create debug output directory {}", debug_dir));
let output_path: String = format!(
"{}/{}.raw",
output_dir,
recording_date_time.format("%Y-%m-%d--%H-%M-%S")
);
fs::write(&output_path, &audio_bytes).unwrap();
}

let output_path: String =
format!("{}/{}.aac", output_dir, recording_date_time.format("%Y-%m-%d--%H-%M-%S"));
Expand Down Expand Up @@ -119,6 +130,7 @@ pub fn save_audio_file_to_disk(mut audio_bytes: Vec<u8>, device_config: DeviceCo
args.push("-f");
args.push("mp4");
args.push(&output_path);
info!("Saving AAC file with args {:#?}", args);
// Now transcode with ffmpeg – we create an aac stream in an m4a wrapper in order
// to support adding metadata tags.
let mut cmd = Command::new("ffmpeg")
Expand Down
Loading