Skip to content

Commit

Permalink
Add --el-only flag to demux
Browse files Browse the repository at this point in the history
  • Loading branch information
quietvoid committed Dec 8, 2021
1 parent 3dccdf5 commit 81de9d1
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 -`
Expand Down
3 changes: 3 additions & 0 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ pub enum Command {
parse(from_os_str)
)]
el_out: Option<PathBuf>,

#[structopt(long, help = "Output the EL file only")]
el_only: bool,
},

ExtractRpu {
Expand Down
22 changes: 19 additions & 3 deletions src/dovi/demuxer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand All @@ -28,6 +36,7 @@ impl Demuxer {
stdin: Option<PathBuf>,
bl_out: Option<PathBuf>,
el_out: Option<PathBuf>,
el_only: bool,
options: CliOptions,
) -> Result<()> {
let input = match input {
Expand All @@ -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)
}

Expand All @@ -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)
}
Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 81de9d1

Please sign in to comment.