From 82fc74f22ced14be0f7f20cd467e49c9d77d723f Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Tue, 10 Oct 2023 16:43:28 +0500 Subject: [PATCH] test decoder programs, write raw output to files for now --- src/decode/codecs/audio.rs | 6 ++++-- src/decode/codecs/video.rs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/decode/codecs/audio.rs b/src/decode/codecs/audio.rs index efab7a6..09a270d 100644 --- a/src/decode/codecs/audio.rs +++ b/src/decode/codecs/audio.rs @@ -28,7 +28,9 @@ impl Decoder for Arc> { } pub fn new_aac(metadata: Arc) -> Result> { - let f = File::create("raw.aac")?; - let cmd = Command::new("tee").stdin(Stdio::piped()).stdout(f).spawn()?; + let f = File::create("out.pcm")?; + let cmd = Command::new("faad") + .args(["-f", "2", "-w", "-q", "-"]) + .stdin(Stdio::piped()).stdout(f).spawn()?; return Ok(AACDecoder {cmd: cmd, metadata: metadata}) } diff --git a/src/decode/codecs/video.rs b/src/decode/codecs/video.rs index 7673deb..e49118b 100644 --- a/src/decode/codecs/video.rs +++ b/src/decode/codecs/video.rs @@ -28,7 +28,9 @@ impl Decoder for Arc> { } pub fn new_h264(metadata: Arc) -> Result> { - let f = File::create("raw.h264")?; - let cmd = Command::new("tee").stdin(Stdio::piped()).stdout(f).spawn()?; + let f = File::create("out.yuv")?; + let cmd = Command::new("ffmpeg") + .args(["-y", "-hide_banner", "-loglevel", "error" , "-i", "-", "-c:v", "rawvideo", "-pix_fmt", "yuv420p", "-f", "rawvideo", "-"]) + .stdin(Stdio::piped()).stdout(f).spawn()?; return Ok(H264Decoder {cmd: cmd, metadata: metadata}); }