Skip to content

Commit

Permalink
Initial EDL output support
Browse files Browse the repository at this point in the history
  • Loading branch information
saindriches committed May 19, 2023
1 parent 511c927 commit 969cfd2
Show file tree
Hide file tree
Showing 10 changed files with 405 additions and 11 deletions.
101 changes: 101 additions & 0 deletions 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
Expand Up @@ -15,7 +15,7 @@ uuid = { version = "1.1.2", features = ["v4"] }

dolby_vision = "3.1.2"
# TODO: Use timecode as unique id, as an option.
#vtc = "0.1.9"
vtc = "0.1.12"
chrono = "0.4.24"
serde = { version = "1.0.158", features = ["derive"] }
serde-aux = "4.0.0"
Expand Down
34 changes: 29 additions & 5 deletions README.md
Expand Up @@ -29,7 +29,7 @@ dovi_meta <SUBCOMMAND> --help
## All options
- `--help`, `--version`
## All subcommands
Currently, the only available subcommand is **`convert`**
Currently, the available subcommand is **`convert`** and **`edl`**.

**More information and detailed examples for the subcommands below.**

Expand All @@ -41,19 +41,19 @@ Currently, the only available subcommand is **`convert`**
- The output version is determined by input automatically.

**Arguments**
* `INPUT` Set the input RPU file to use.
* `INPUT` Set the input RPU file to use
- No limitation for RPU file extension.
* `OUTPUT` Set the output XML file location.
* `OUTPUT` Set the output XML file location
- When `OUTPUT` is not set, the output file is `metadata.xml` at current path.

**Options**
* `-s`, `--size` Set the canvas size. Use `x` as delimiter.
* `-s`, `--size` Set the canvas size. Use `x` as delimiter
- Default value is `3840x2160`
* `-r`, `--rate` Set the frame rate. Format: integer `NUM` or `NUM/DENOM`
- Default value is `24000/1001`
* `-t`, `--skip` Set the number of frames to be skipped from start
- Default value is `0`
* `-n`, `--count` Set the number of frames to be parsed
* `-n`, `--count` Set the number of frames to be parsed explicitly

**Flags**
* `-6`, `--use-level6` Use MaxCLL and MaxFALL from RPU, if possible
Expand All @@ -70,6 +70,30 @@ Currently, the only available subcommand is **`convert`**

The default color space of mastering display and target displays (except the anchor target) is **P3 D65** for CM v2.9 XML, also for CM v4.0 XML when it can't be determined by input.

* ### **edl**
Convert a binary RPU to EDL (Edit Decision List).
* Currently, the per-frame metadata in RPU is not parsed to transition.

**Arguments**
* `INPUT` Set the input RPU file to use
- No limitation for RPU file extension.
* `OUTPUT` Set the output XML file location
- When `OUTPUT` is not set, the output file is `metadata.edl` at current path.
* `CLIP_NAME` Set the clip name in EDL
- If there are too many cuts to be saved in a single file,
multiple files will be saved with a suffix added to the file name.

**Options**
* `-r`, `--rate` Set the frame rate. Format: integer `NUM` or `NUM/DENOM`
- Default value is `24000/1001`
* `-s`, `--start-timecode` Set the starting timecode in timeline. Format: `HH:MM:SS:FF` or integer `FRAMES` offset
- Default value is `01:00:00:00`
* `-t`, `--skip` Set the number of frames to be skipped from start
- Default value is `0`
* `-n`, `--count` Set the number of frames to be parsed explicitly

**Flags**
* `-f`, `--force` Force output even if per-frame RPU is detected

## **Notes**
The current build only support RPU as input. To extract RPU from an HEVC file, see [dovi_tool](https://github.com/quietvoid/dovi_tool) for more info.
Expand Down
7 changes: 5 additions & 2 deletions src/commands/convert.rs
Expand Up @@ -20,7 +20,6 @@ pub struct ConvertArgs {
long,
default_value = "3840x2160",
use_value_delimiter = true,
// FIXME: Clap bug? values with custom delimiter is parsed as one value
value_delimiter = 'x',
num_args(1..=2),
help = "Set the canvas size"
Expand Down Expand Up @@ -56,7 +55,11 @@ pub struct ConvertArgs {
)]
pub skip: usize,

#[clap(short = 'n', long, help = "Set the number of frames to be parsed")]
#[clap(
short = 'n',
long,
help = "Set the number of frames to be parsed explicitly"
)]
pub count: Option<usize>,

#[clap(
Expand Down
67 changes: 67 additions & 0 deletions src/commands/edl.rs
@@ -0,0 +1,67 @@
use clap::{Args, ValueHint};
use std::path::PathBuf;

#[derive(Args, Debug)]
pub struct EdlArgs {
#[clap(
help = "Set the input RPU file to use",
value_hint = ValueHint::FilePath
)]
pub input: Option<PathBuf>,

#[clap(
help = "Set the output EDL file location. See --help for more info",
long_help = "Set the output EDL file location.\n \
If there are too many cuts to be saved in a single file,\n \
multiple files will be saved with a suffix added to the file name.",
value_hint = ValueHint::FilePath
)]
pub output: Option<PathBuf>,

#[clap(
help = "Set the clip name in EDL",
value_hint = ValueHint::FilePath
)]
pub clip_name: String,

#[clap(
short = 'f',
long,
help = "Force output even if per-frame RPU is detected"
)]
pub force: bool,

#[clap(
short = 'r',
long,
default_value = "24000/1001",
use_value_delimiter = true,
value_delimiter = '/',
num_args(1..=2),
help = "Set the frame rate. Format: integer NUM or NUM/DENOM"
)]
pub rate: Vec<usize>,

#[clap(
short = 's',
long,
default_value = "01:00:00:00",
help = "Set the starting timecode in timeline. Format: HH:MM:SS:FF or integer FRAMES offset"
)]
pub start_timecode: String,

#[clap(
short = 't',
long,
default_value = "0",
help = "Set the number of frames to be skipped from start"
)]
pub skip: usize,

#[clap(
short = 'n',
long,
help = "Set the number of frames to be parsed explicitly"
)]
pub count: Option<usize>,
}
8 changes: 8 additions & 0 deletions src/commands/mod.rs
@@ -1,7 +1,9 @@
pub mod convert;
pub mod edl;

// use crate::commands::analyze::AnalyzeArgs;
use crate::commands::convert::ConvertArgs;
use crate::commands::edl::EdlArgs;
use clap::Parser;

#[derive(Parser, Debug)]
Expand All @@ -11,4 +13,10 @@ pub enum Command {
arg_required_else_help(true)
)]
Convert(ConvertArgs),

#[clap(
about = "Convert a binary RPU to EDL (Edit Decision List)",
arg_required_else_help(true)
)]
Edl(EdlArgs),
}

0 comments on commit 969cfd2

Please sign in to comment.