aboutsummaryrefslogtreecommitdiff
path: root/remuxer/src/matroska_to_mpeg4.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-09-13 16:08:42 +0200
committermetamuffin <metamuffin@disroot.org>2025-09-13 16:08:42 +0200
commit044c7e1c75145f1ec9d002b4f6fc4433ff7f9540 (patch)
treedb326c8f2327396ed443a1822936927e7c847494 /remuxer/src/matroska_to_mpeg4.rs
parente99bde7a00a161ff5dd91eaf1ce546a9d98cef05 (diff)
downloadjellything-044c7e1c75145f1ec9d002b4f6fc4433ff7f9540.tar
jellything-044c7e1c75145f1ec9d002b4f6fc4433ff7f9540.tar.bz2
jellything-044c7e1c75145f1ec9d002b4f6fc4433ff7f9540.tar.zst
start remuxer crate rewrite; added matroska demuxer and format detection
Diffstat (limited to 'remuxer/src/matroska_to_mpeg4.rs')
-rw-r--r--remuxer/src/matroska_to_mpeg4.rs36
1 files changed, 0 insertions, 36 deletions
diff --git a/remuxer/src/matroska_to_mpeg4.rs b/remuxer/src/matroska_to_mpeg4.rs
deleted file mode 100644
index cc0b967..0000000
--- a/remuxer/src/matroska_to_mpeg4.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- This file is part of jellything (https://codeberg.org/metamuffin/jellything)
- which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
- Copyright (C) 2025 metamuffin <metamuffin.org>
-*/
-use anyhow::Result;
-use std::{
- fs::{remove_file, File},
- io::{copy, Read, Write},
- process::{Command, Stdio},
- random::random,
-};
-
-pub fn matroska_to_mpeg4(
- mut input: impl Read + Send + 'static,
- mut output: impl Write,
-) -> Result<()> {
- let path = format!("/tmp/jellything-tc-hack-{:016x}", random::<u64>(..));
- let args = format!(
- "-hide_banner -loglevel warning -f matroska -i pipe:0 -c copy -f mp4 -movflags frag_keyframe+empty_moov {path}"
- );
- let mut child = Command::new("ffmpeg")
- .args(args.split(" "))
- .stdin(Stdio::piped())
- .stderr(Stdio::inherit())
- .spawn()?;
-
- let mut stdin = child.stdin.take().unwrap();
- copy(&mut input, &mut stdin)?;
- drop(stdin);
- child.wait()?.exit_ok()?;
- copy(&mut File::open(&path)?, &mut output)?;
- remove_file(path)?;
-
- Ok(())
-}