Skip to content

Commit 3afde6a

Browse files
committed
Update readme with ffmpeg examples for pre-fragmented media files. Add handling for split object option flag.
1 parent 0275dbf commit 3afde6a

4 files changed

Lines changed: 27 additions & 9 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ compile_commands.json
2020

2121
# Local test artifacts
2222
/tmp-*.mp4
23+
moqxr.code-workspace

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,22 +306,32 @@ ffmpeg -i input.mp4 \
306306
-f mp4 fragmented.mp4
307307
```
308308

309-
If the source codecs are not already compatible, re-encode instead of copying. For example:
309+
If the source codecs are not already compatible, re-encode instead of copying. For example (h264 and h265):
310310

311311
```bash
312-
ffmpeg -i input.mov \
313-
-map 0:v -map 0:a \
312+
ffmpeg -i bbb_sunflower_2160p_60fps_normal.mp4 \
313+
-map 0:v:0 -map 0:a:0 \
314314
-map_metadata -1 \
315315
-sn -dn \
316-
-c:v libx264 -preset medium -g 48 -keyint_min 48 \
317-
-c:a aac -profile:a aac_low -b:a 128k \
318-
-movflags +frag_keyframe+empty_moov+default_base_moof+separate_moof \
319-
-f mp4 fragmented.mp4
316+
-c:v libx264 -preset medium -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -bf 0 \
317+
-c:a aac -b:a 160k -ar 48000 -ac 2 \
318+
-movflags +frag_keyframe+empty_moov+default_base_moof \
319+
-f mp4 sunflower-frag.mp4
320+
321+
ffmpeg -i bbb_sunflower_2160p_60fps_normal.mp4 \
322+
-map 0:v:0 -map 0:a:0 \
323+
-map_metadata -1 \
324+
-sn -dn \
325+
-c:v libx265 -preset medium -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -bf 0 \
326+
-c:a aac -b:a 160k -ar 48000 -ac 2 \
327+
-movflags +frag_keyframe+empty_moov+default_base_moof \
328+
-f mp4 sunflower265-frag.mp4
320329
```
321330

322331
Practical notes:
323332

324333
- `-map 0:v -map 0:a` keeps only video and audio streams, excluding subtitle and other non-A/V tracks
334+
- `-map 0:v:0 -map 0:a:0` uses first audio stream if multiple exist
325335
- `-sn -dn` explicitly disables subtitle and data or text streams
326336
- `-map_metadata -1` drops container-level metadata from the output
327337
- `+frag_keyframe` starts a new fragment on keyframes

src/cli_options.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ CliOptions parse_cli_options(int argc, char** argv) {
114114
options.forward = parse_forward_flag(require_value("--forward"));
115115
} else if (argument == "--publish-catalog") {
116116
options.publish_catalog = true;
117-
} else if (argument == "--coalesce-cmaf-chunks") {
117+
} else if (argument == "--coalesce-cmaf-chunks" || argument == "--coalesce-cmaf-chunk") {
118118
options.split_cmaf_chunks = false;
119119
} else if (argument == "--timeout") {
120120
options.subscriber_timeout = parse_timeout(require_value("--timeout"));
@@ -148,7 +148,7 @@ CliOptions parse_cli_options(int argc, char** argv) {
148148
std::string build_usage(const char* argv0) {
149149
return std::string("Usage: ") + argv0 +
150150
" --input <mp4> [--draft 14|16] [--namespace <value>] [--forward 0|1] [--timeout <seconds>]"
151-
" [--publish-catalog] [--coalesce-cmaf-chunks] [--paced] [--dump-plan] [--emit-dir <dir>]"
151+
" [--publish-catalog] [--coalesce-cmaf-chunks|--coalesce-cmaf-chunk] [--paced] [--dump-plan] [--emit-dir <dir>]"
152152
" [--endpoint host:port|moqt://host:port/path] [--alpn value] [--sni value]"
153153
" [--cert file] [--key file] [--ca file] [--insecure]";
154154
}

tests/cli_options_test.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ int main() {
7676
ok &= expect(!options.split_cmaf_chunks, "expected --coalesce-cmaf-chunks to disable default chunk splitting");
7777
}
7878

79+
{
80+
const CliOptions options =
81+
parse({"openmoq-publisher", "--input", "sample.mp4", "--coalesce-cmaf-chunk"});
82+
ok &= expect(!options.split_cmaf_chunks,
83+
"expected --coalesce-cmaf-chunk compatibility alias to disable default chunk splitting");
84+
}
85+
7986
{
8087
bool threw = false;
8188
try {

0 commit comments

Comments
 (0)