Skip to content

Commit 969cfd2

Browse files
committed
Initial EDL output support
1 parent 511c927 commit 969cfd2

File tree

10 files changed

+405
-11
lines changed

10 files changed

+405
-11
lines changed

Cargo.lock

Lines changed: 101 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ uuid = { version = "1.1.2", features = ["v4"] }
1515

1616
dolby_vision = "3.1.2"
1717
# TODO: Use timecode as unique id, as an option.
18-
#vtc = "0.1.9"
18+
vtc = "0.1.12"
1919
chrono = "0.4.24"
2020
serde = { version = "1.0.158", features = ["derive"] }
2121
serde-aux = "4.0.0"

README.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dovi_meta <SUBCOMMAND> --help
2929
## All options
3030
- `--help`, `--version`
3131
## All subcommands
32-
Currently, the only available subcommand is **`convert`**
32+
Currently, the available subcommand is **`convert`** and **`edl`**.
3333

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

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

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

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

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

7171
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.
7272

73+
* ### **edl**
74+
Convert a binary RPU to EDL (Edit Decision List).
75+
* Currently, the per-frame metadata in RPU is not parsed to transition.
76+
77+
**Arguments**
78+
* `INPUT` Set the input RPU file to use
79+
- No limitation for RPU file extension.
80+
* `OUTPUT` Set the output XML file location
81+
- When `OUTPUT` is not set, the output file is `metadata.edl` at current path.
82+
* `CLIP_NAME` Set the clip name in EDL
83+
- If there are too many cuts to be saved in a single file,
84+
multiple files will be saved with a suffix added to the file name.
85+
86+
**Options**
87+
* `-r`, `--rate` Set the frame rate. Format: integer `NUM` or `NUM/DENOM`
88+
- Default value is `24000/1001`
89+
* `-s`, `--start-timecode` Set the starting timecode in timeline. Format: `HH:MM:SS:FF` or integer `FRAMES` offset
90+
- Default value is `01:00:00:00`
91+
* `-t`, `--skip` Set the number of frames to be skipped from start
92+
- Default value is `0`
93+
* `-n`, `--count` Set the number of frames to be parsed explicitly
94+
95+
**Flags**
96+
* `-f`, `--force` Force output even if per-frame RPU is detected
7397

7498
## **Notes**
7599
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.

src/commands/convert.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ pub struct ConvertArgs {
2020
long,
2121
default_value = "3840x2160",
2222
use_value_delimiter = true,
23-
// FIXME: Clap bug? values with custom delimiter is parsed as one value
2423
value_delimiter = 'x',
2524
num_args(1..=2),
2625
help = "Set the canvas size"
@@ -56,7 +55,11 @@ pub struct ConvertArgs {
5655
)]
5756
pub skip: usize,
5857

59-
#[clap(short = 'n', long, help = "Set the number of frames to be parsed")]
58+
#[clap(
59+
short = 'n',
60+
long,
61+
help = "Set the number of frames to be parsed explicitly"
62+
)]
6063
pub count: Option<usize>,
6164

6265
#[clap(

src/commands/edl.rs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
use clap::{Args, ValueHint};
2+
use std::path::PathBuf;
3+
4+
#[derive(Args, Debug)]
5+
pub struct EdlArgs {
6+
#[clap(
7+
help = "Set the input RPU file to use",
8+
value_hint = ValueHint::FilePath
9+
)]
10+
pub input: Option<PathBuf>,
11+
12+
#[clap(
13+
help = "Set the output EDL file location. See --help for more info",
14+
long_help = "Set the output EDL file location.\n \
15+
If there are too many cuts to be saved in a single file,\n \
16+
multiple files will be saved with a suffix added to the file name.",
17+
value_hint = ValueHint::FilePath
18+
)]
19+
pub output: Option<PathBuf>,
20+
21+
#[clap(
22+
help = "Set the clip name in EDL",
23+
value_hint = ValueHint::FilePath
24+
)]
25+
pub clip_name: String,
26+
27+
#[clap(
28+
short = 'f',
29+
long,
30+
help = "Force output even if per-frame RPU is detected"
31+
)]
32+
pub force: bool,
33+
34+
#[clap(
35+
short = 'r',
36+
long,
37+
default_value = "24000/1001",
38+
use_value_delimiter = true,
39+
value_delimiter = '/',
40+
num_args(1..=2),
41+
help = "Set the frame rate. Format: integer NUM or NUM/DENOM"
42+
)]
43+
pub rate: Vec<usize>,
44+
45+
#[clap(
46+
short = 's',
47+
long,
48+
default_value = "01:00:00:00",
49+
help = "Set the starting timecode in timeline. Format: HH:MM:SS:FF or integer FRAMES offset"
50+
)]
51+
pub start_timecode: String,
52+
53+
#[clap(
54+
short = 't',
55+
long,
56+
default_value = "0",
57+
help = "Set the number of frames to be skipped from start"
58+
)]
59+
pub skip: usize,
60+
61+
#[clap(
62+
short = 'n',
63+
long,
64+
help = "Set the number of frames to be parsed explicitly"
65+
)]
66+
pub count: Option<usize>,
67+
}

src/commands/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
pub mod convert;
2+
pub mod edl;
23

34
// use crate::commands::analyze::AnalyzeArgs;
45
use crate::commands::convert::ConvertArgs;
6+
use crate::commands::edl::EdlArgs;
57
use clap::Parser;
68

79
#[derive(Parser, Debug)]
@@ -11,4 +13,10 @@ pub enum Command {
1113
arg_required_else_help(true)
1214
)]
1315
Convert(ConvertArgs),
16+
17+
#[clap(
18+
about = "Convert a binary RPU to EDL (Edit Decision List)",
19+
arg_required_else_help(true)
20+
)]
21+
Edl(EdlArgs),
1422
}

0 commit comments

Comments
 (0)