Skip to content

Commit bb64ca0

Browse files
committed
Document ffmpeg fragmentation workflow
1 parent 9364104 commit bb64ca0

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,35 @@ Try the draft-16 compatibility profile:
9090
./build/openmoq-publisher --input sample.mp4 --draft 16 --dump-plan
9191
```
9292

93+
## Creating Fragmented MP4 with FFmpeg
94+
95+
The publisher’s preferred fast path is already fragmented MP4 input. You can generate that with `ffmpeg` by copying compatible AAC-LC or H.264 streams and enabling CMAF-style fragmentation flags:
96+
97+
```bash
98+
ffmpeg -i input.mp4 \
99+
-c:v copy \
100+
-c:a copy \
101+
-movflags +frag_keyframe+empty_moov+default_base_moof+separate_moof \
102+
-f mp4 fragmented.mp4
103+
```
104+
105+
If the source codecs are not already compatible, re-encode instead of copying. For example:
106+
107+
```bash
108+
ffmpeg -i input.mov \
109+
-c:v libx264 -preset medium -g 48 -keyint_min 48 \
110+
-c:a aac -profile:a aac_low -b:a 128k \
111+
-movflags +frag_keyframe+empty_moov+default_base_moof+separate_moof \
112+
-f mp4 fragmented.mp4
113+
```
114+
115+
Practical notes:
116+
117+
- `+frag_keyframe` starts a new fragment on keyframes
118+
- `+empty_moov` writes initialization metadata up front
119+
- `+default_base_moof` and `+separate_moof` produce a layout that is easier for fragmented-MP4 pipelines to consume
120+
- if you start from a progressive MP4, this project can remux it internally, but pre-fragmented input is still the simpler and more efficient path
121+
93122
## CI
94123

95124
GitHub Actions is configured to build and test the project on:

0 commit comments

Comments
 (0)