diff --git a/Cargo.lock b/Cargo.lock index 92a3018..7a8d802 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -185,7 +185,7 @@ dependencies = [ [[package]] name = "dovi_tool" -version = "1.3.0" +version = "1.3.1" dependencies = [ "anyhow", "bitvec", diff --git a/Cargo.toml b/Cargo.toml index 21564d3..089c3a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dovi_tool" -version = "1.3.0" +version = "1.3.1" authors = ["quietvoid"] edition = "2018" rust-version = "1.51.0" diff --git a/README.md b/README.md index b7b037e..ed5b845 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,12 @@ For working with an HEVC source file, there are multiple options that apply to m Rust port of yusesope's python tool. Credits goes to them. Demuxes single track dual layer Dolby Vision into Base layer and Enhancement layer files. Also can be used to remove the RPUs from an HEVC file. - + + Flags: + - `--el-only` Output the EL file only. + +   + Examples: * `dovi_tool demux file.hevc` * `ffmpeg -i input.mkv -c:v copy -vbsf hevc_mp4toannexb -f hevc - | dovi_tool demux -` diff --git a/src/commands.rs b/src/commands.rs index 64968ce..26bfce8 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -37,6 +37,9 @@ pub enum Command { parse(from_os_str) )] el_out: Option, + + #[structopt(long, help = "Output the EL file only")] + el_only: bool, }, ExtractRpu { diff --git a/src/dovi/demuxer.rs b/src/dovi/demuxer.rs index 6ecbed1..7240335 100644 --- a/src/dovi/demuxer.rs +++ b/src/dovi/demuxer.rs @@ -11,15 +11,23 @@ pub struct Demuxer { input: PathBuf, bl_out: PathBuf, el_out: PathBuf, + el_only: bool, } impl Demuxer { - pub fn new(format: Format, input: PathBuf, bl_out: PathBuf, el_out: PathBuf) -> Self { + pub fn new( + format: Format, + input: PathBuf, + bl_out: PathBuf, + el_out: PathBuf, + el_only: bool, + ) -> Self { Self { format, input, bl_out, el_out, + el_only, } } @@ -28,6 +36,7 @@ impl Demuxer { stdin: Option, bl_out: Option, el_out: Option, + el_only: bool, options: CliOptions, ) -> Result<()> { let input = match input { @@ -50,7 +59,7 @@ impl Demuxer { None => PathBuf::from("EL.hevc"), }; - let demuxer = Demuxer::new(format, input, bl_out, el_out); + let demuxer = Demuxer::new(format, input, bl_out, el_out, el_only); demuxer.process_input(options) } @@ -65,7 +74,14 @@ impl Demuxer { fn demux_raw_hevc(&self, pb: Option<&ProgressBar>, options: CliOptions) -> Result<()> { let mut dovi_reader = DoviReader::new(options); - let mut dovi_writer = DoviWriter::new(Some(&self.bl_out), Some(&self.el_out), None, None); + + let bl_out = if self.el_only { + None + } else { + Some(self.bl_out.as_path()) + }; + + let mut dovi_writer = DoviWriter::new(bl_out, Some(self.el_out.as_path()), None, None); dovi_reader.read_write_from_io(&self.format, &self.input, pb, &mut dovi_writer) } diff --git a/src/main.rs b/src/main.rs index ef88e74..4227eb8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,7 +61,8 @@ fn main() -> Result<()> { stdin, bl_out, el_out, - } => Demuxer::demux(input, stdin, bl_out, el_out, cli_options), + el_only, + } => Demuxer::demux(input, stdin, bl_out, el_out, el_only, cli_options), Command::Editor { input, json_file,